<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Unexpected &#8220;Gotcha&#8221; with Relative Paths in ActionScript</title>
	<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Tue, 06 Jan 2009 19:29:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Dana Jones</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-109688</link>
		<pubDate>Fri, 07 Dec 2007 20:52:36 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-109688</guid>
					<description>David:

Thanks SO MUCH for your insight into this problem. We’ll also check out ZINC and Jugglor, for additional functionality of the Projector.

Best Regards,

Dana</description>
		<content:encoded><![CDATA[<p>David:</p>
<p>Thanks SO MUCH for your insight into this problem. We’ll also check out ZINC and Jugglor, for additional functionality of the Projector.</p>
<p>Best Regards,</p>
<p>Dana
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-109621</link>
		<pubDate>Fri, 07 Dec 2007 14:13:28 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-109621</guid>
					<description>&lt;strong&gt;To Mechthild ...&lt;/strong&gt;

By your original description, it certainly sounds to me as if you had done everything right.  In any case, I'm glad to hear you resolved the issue!  Ultimately, I think you'll be happier with this closer control over the video.  And like you said, the visual design is now yours.  :)

Thanks for sharing those links, too!

&lt;strong&gt;To Dana ...&lt;/strong&gt;

The Projector is indeed the parent, or the base of your file references.  Obviously, you can't use the Debugger panel when you're testing a Projector (which is too bad!), but you can still arrange for something akin to &lt;code&gt;trace()&lt;/code&gt; statements in your Projectors.  In a case like this, you could put a dynamic text field somewhere on the Stage for testing purposes.  Give it an instance name, say &lt;code&gt;debugger&lt;/code&gt;.  In your keyframe code, add the following line:

&lt;pre&gt;&lt;code&gt;debugger.text = this._url;&lt;/code&gt;&lt;/pre&gt;

... which invokes &lt;code&gt;MovieClip._url&lt;/code&gt; on the main timeline (assuming that's where your code is) and sends the return value to the text field.  That will show you where the SWF believes itself to be, and if your experience is like mine, you'll see a file reference directly to the EXE.

That aside, if you're distributing this as a professional product, you may want to consider a 3rd party Projector enhancer like &lt;a href=&quot;http://www.multidmedia.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;ZINC&lt;/a&gt; or &lt;a href=&quot;http://www.flashjester.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;Jugglor&lt;/a&gt;.  Not only with those allow you to customize the appearance of the executable, they'll also give you system level functionality you can't get with a native Projector alone.</description>
		<content:encoded><![CDATA[<p><strong>To Mechthild &#8230;</strong></p>
<p>By your original description, it certainly sounds to me as if you had done everything right.  In any case, I&#8217;m glad to hear you resolved the issue!  Ultimately, I think you&#8217;ll be happier with this closer control over the video.  And like you said, the visual design is now yours.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks for sharing those links, too!</p>
<p><strong>To Dana &#8230;</strong></p>
<p>The Projector is indeed the parent, or the base of your file references.  Obviously, you can&#8217;t use the Debugger panel when you&#8217;re testing a Projector (which is too bad!), but you can still arrange for something akin to <code>trace()</code> statements in your Projectors.  In a case like this, you could put a dynamic text field somewhere on the Stage for testing purposes.  Give it an instance name, say <code>debugger</code>.  In your keyframe code, add the following line:</p>
<pre><code>debugger.text = this._url;</code></pre>
<p>&#8230; which invokes <code>MovieClip._url</code> on the main timeline (assuming that&#8217;s where your code is) and sends the return value to the text field.  That will show you where the SWF believes itself to be, and if your experience is like mine, you&#8217;ll see a file reference directly to the EXE.</p>
<p>That aside, if you&#8217;re distributing this as a professional product, you may want to consider a 3rd party Projector enhancer like <a href="http://www.multidmedia.com/" target="_blank" rel="nofollow">ZINC</a> or <a href="http://www.flashjester.com/" target="_blank" rel="nofollow">Jugglor</a>.  Not only with those allow you to customize the appearance of the executable, they&#8217;ll also give you system level functionality you can&#8217;t get with a native Projector alone.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Mechthild Scheierling</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-108832</link>
		<pubDate>Wed, 05 Dec 2007 08:50:03 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-108832</guid>
					<description>My solution to the &amp;#34;Mozilla-doesn't-play&amp;#34; phenomenon was to cancel using the FLVPlayback componet.
Decided to use NetStream with my own controls. 

The vid_player from Datic was a good starting-point.
Found it at tutorials.de:
http://www.tutorials.de/forum/flash-faq/180861-sammel-thread-und-flash-faq-2.html
This is the ZIP-File with fla and swf:
http://www.tutorials.de/forum/attachments/flash-faq/16585d1117140120-vid_player.zip

Now everything works fine. And I like my own design...

Mechthild</description>
		<content:encoded><![CDATA[<p>My solution to the &quot;Mozilla-doesn&#8217;t-play&quot; phenomenon was to cancel using the FLVPlayback componet.<br />
Decided to use NetStream with my own controls. </p>
<p>The vid_player from Datic was a good starting-point.<br />
Found it at tutorials.de:<br />
<a href='http://www.tutorials.de/forum/flash-faq/180861-sammel-thread-und-flash-faq-2.html' rel='nofollow'>http://www.tutorials.de/forum/flash-faq/180861-sammel-thread-und-flash-faq-2.html</a><br />
This is the ZIP-File with fla and swf:<br />
<a href='http://www.tutorials.de/forum/attachments/flash-faq/16585d1117140120-vid_player.zip' rel='nofollow'>http://www.tutorials.de/forum/attachments/flash-faq/16585d1117140120-vid_player.zip</a></p>
<p>Now everything works fine. And I like my own design&#8230;</p>
<p>Mechthild
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Dana Jones</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-107711</link>
		<pubDate>Sat, 01 Dec 2007 01:26:17 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-107711</guid>
					<description>Hi David:
Great topic. We're suffering a similar problem as those who have written here. We have a projector file running on a local machine. It calls an outside swf running on our CDN. That swf calls an .flv residing in the same folder as that swf on the CDN. The flv won't load/play. There are no HTML containers anywhere along the path. We've tried absolute paths and relative paths. No luck.

The projector is the parent file, right? Then how do we reference the projector file locale from the outside swf that's calling the .flv?

We are distributing a P2P product that will be a projector. It will call swfs that will call flvs. Thoughts?

--Dana</description>
		<content:encoded><![CDATA[<p>Hi David:<br />
Great topic. We&#8217;re suffering a similar problem as those who have written here. We have a projector file running on a local machine. It calls an outside swf running on our CDN. That swf calls an .flv residing in the same folder as that swf on the CDN. The flv won&#8217;t load/play. There are no HTML containers anywhere along the path. We&#8217;ve tried absolute paths and relative paths. No luck.</p>
<p>The projector is the parent file, right? Then how do we reference the projector file locale from the outside swf that&#8217;s calling the .flv?</p>
<p>We are distributing a P2P product that will be a projector. It will call swfs that will call flvs. Thoughts?</p>
<p>&#8211;Dana
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Mechthild Scheierling</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-99334</link>
		<pubDate>Sat, 10 Nov 2007 15:57:06 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-99334</guid>
					<description>Hi David,

I encounter an ugly phenomenon with Mozilla and relative paths.

The files are located in separate paths for html and flash related files:

webroot/html/showvideo.html

webroot/flash/player.swf
webroot/flash/skin.swf
webroot/flash/video.flv

So I embed 
* player.swf relative to the .html
* skin.swf relative to the .html 
* video.flv relative to the player.swf

This works fine as long as showvideo.html is opened locally in Mozilla.
When I open it via a host (webserver or localhost) it's going weird:
Opening the file the first time (after clearing the cache) everything is ok. 
But when opening again or pressing 'Refresh' or opening showanothervidedo.html to see anothervideo.flv there is no video and no skin displayed.
Even worse: Trying to see another video (video2.flv) with another player (player2.swf) and another skin (skin2.swf) from another html (showvideo2.html) on the same host fails.

To be true: I can see the skin for about a second, then it disappears into empty space.
To be completely true: sometimes the first picture of the video is shown.

The player.swf IS loaded (displaying some text).

Any idea what's going wrong there?

Maybe I have to set some -parameters I've never heard of?
But why does it work once an then nevermore? Sometimes even clearing the cache doesn't help.
Something wrong with the Flash-Plugin?
Because in InternetExplorer everything is fine. Only Firefox and Iceweasels do that!

It's really the relativity - when all files are in the same directory there is no problem..,

I'm completely at a loss.

Mechthild</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>I encounter an ugly phenomenon with Mozilla and relative paths.</p>
<p>The files are located in separate paths for html and flash related files:</p>
<p>webroot/html/showvideo.html</p>
<p>webroot/flash/player.swf<br />
webroot/flash/skin.swf<br />
webroot/flash/video.flv</p>
<p>So I embed<br />
* player.swf relative to the .html<br />
* skin.swf relative to the .html<br />
* video.flv relative to the player.swf</p>
<p>This works fine as long as showvideo.html is opened locally in Mozilla.<br />
When I open it via a host (webserver or localhost) it&#8217;s going weird:<br />
Opening the file the first time (after clearing the cache) everything is ok.<br />
But when opening again or pressing &#8216;Refresh&#8217; or opening showanothervidedo.html to see anothervideo.flv there is no video and no skin displayed.<br />
Even worse: Trying to see another video (video2.flv) with another player (player2.swf) and another skin (skin2.swf) from another html (showvideo2.html) on the same host fails.</p>
<p>To be true: I can see the skin for about a second, then it disappears into empty space.<br />
To be completely true: sometimes the first picture of the video is shown.</p>
<p>The player.swf IS loaded (displaying some text).</p>
<p>Any idea what&#8217;s going wrong there?</p>
<p>Maybe I have to set some -parameters I&#8217;ve never heard of?<br />
But why does it work once an then nevermore? Sometimes even clearing the cache doesn&#8217;t help.<br />
Something wrong with the Flash-Plugin?<br />
Because in InternetExplorer everything is fine. Only Firefox and Iceweasels do that!</p>
<p>It&#8217;s really the relativity - when all files are in the same directory there is no problem..,</p>
<p>I&#8217;m completely at a loss.</p>
<p>Mechthild
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-94739</link>
		<pubDate>Sun, 28 Oct 2007 02:28:57 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-94739</guid>
					<description>Brian,

Either use &quot;../CommonScripts/images.xml&quot; or simply &quot;/CommonScripts/images.xml&quot;, as the slash alone (preceding any path) should send the point of view to the root.

In the first case, the SWF effectively says, &quot;Okay, I am where my HTML page is, so that means I'm in the 'en' folder.  Let me back up one folder &amp;#8212; now I'm in the root &amp;#8212; and look for a folder named 'CommonScripts,' then a file named 'images.xml.'&quot;

In the second case, the SWF says, &quot;Let me go straight to the root and look for a folder named 'CommonScripts,' then a file named 'images.xml.'&quot;</description>
		<content:encoded><![CDATA[<p>Brian,</p>
<p>Either use &#8220;../CommonScripts/images.xml&#8221; or simply &#8220;/CommonScripts/images.xml&#8221;, as the slash alone (preceding any path) should send the point of view to the root.</p>
<p>In the first case, the SWF effectively says, &#8220;Okay, I am where my HTML page is, so that means I&#8217;m in the &#8216;en&#8217; folder.  Let me back up one folder &mdash; now I&#8217;m in the root &mdash; and look for a folder named &#8216;CommonScripts,&#8217; then a file named &#8216;images.xml.&#8217;&#8221;</p>
<p>In the second case, the SWF says, &#8220;Let me go straight to the root and look for a folder named &#8216;CommonScripts,&#8217; then a file named &#8216;images.xml.&#8217;&#8221;
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Brian Artka</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-93794</link>
		<pubDate>Thu, 25 Oct 2007 15:39:33 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-93794</guid>
					<description>Hi David,

Wow, thanks for the quick response.

actually, here is the file structure:

the index.html file, which calls the .swf file is located here:

/en/index.html

the swf file is located here:

/CommonScripts/myflash.swf

the images.xml and images folder are located here:

/CommonScripts/

right now the actionscript in the swf is &quot;images.xml&quot; and I understand that since the swf loads from the index.html, the &quot;images.xml&quot; means it looks in the 

/en/

folder since that is relative to the html file.

what the heck do I put in there to reference the images.xml from the CommonScripts folder.</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>Wow, thanks for the quick response.</p>
<p>actually, here is the file structure:</p>
<p>the index.html file, which calls the .swf file is located here:</p>
<p>/en/index.html</p>
<p>the swf file is located here:</p>
<p>/CommonScripts/myflash.swf</p>
<p>the images.xml and images folder are located here:</p>
<p>/CommonScripts/</p>
<p>right now the actionscript in the swf is &#8220;images.xml&#8221; and I understand that since the swf loads from the index.html, the &#8220;images.xml&#8221; means it looks in the </p>
<p>/en/</p>
<p>folder since that is relative to the html file.</p>
<p>what the heck do I put in there to reference the images.xml from the CommonScripts folder.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-93786</link>
		<pubDate>Thu, 25 Oct 2007 15:23:20 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-93786</guid>
					<description>Brian,

It sounds to me like your site has a swf folder and an images folder.  I'm guessing your HTML files are in the root, and they references images like this:

images/someImage.jpg

... and SWFs like this:

swf/someSwf.swf

If that's right, then from your SWF's point of view, the XML document is here:

../images/images.xml

But that's not how Flash works.  The SWF takes its point of view from the HTML document that contains it.  If I've correctly described the arrangement of your files, that would mean you'd drop the &quot;../&quot; in this case.  The only exception to &quot;the SWF's point of view is actually the HTML's point of view&quot; is when the SWF is loading FLV files.</description>
		<content:encoded><![CDATA[<p>Brian,</p>
<p>It sounds to me like your site has a swf folder and an images folder.  I&#8217;m guessing your HTML files are in the root, and they references images like this:</p>
<p>images/someImage.jpg</p>
<p>&#8230; and SWFs like this:</p>
<p>swf/someSwf.swf</p>
<p>If that&#8217;s right, then from your SWF&#8217;s point of view, the XML document is here:</p>
<p>../images/images.xml</p>
<p>But that&#8217;s not how Flash works.  The SWF takes its point of view from the HTML document that contains it.  If I&#8217;ve correctly described the arrangement of your files, that would mean you&#8217;d drop the &#8220;../&#8221; in this case.  The only exception to &#8220;the SWF&#8217;s point of view is actually the HTML&#8217;s point of view&#8221; is when the SWF is loading FLV files.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Brian Artka</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-93782</link>
		<pubDate>Thu, 25 Oct 2007 15:11:38 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-93782</guid>
					<description>Glad I found this topic on your blog. I have one quick question about actionscript and relative paths... this may be a silly one, but I'm stuck.

I am trying to load an xml file into the swf via actionscript and the swf file is located in a folder AHEAD of the folder where the images.xml file is. So, I have been trying, for example, this relative path:

../images/images.xml

I am assuming that I cannot backup out of the swf folder to get to the images folder using &quot;../&quot; because its not working... or does it and I am doing this wrong? any help would be appreciated.</description>
		<content:encoded><![CDATA[<p>Glad I found this topic on your blog. I have one quick question about actionscript and relative paths&#8230; this may be a silly one, but I&#8217;m stuck.</p>
<p>I am trying to load an xml file into the swf via actionscript and the swf file is located in a folder AHEAD of the folder where the images.xml file is. So, I have been trying, for example, this relative path:</p>
<p>../images/images.xml</p>
<p>I am assuming that I cannot backup out of the swf folder to get to the images folder using &#8220;../&#8221; because its not working&#8230; or does it and I am doing this wrong? any help would be appreciated.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-87243</link>
		<pubDate>Mon, 01 Oct 2007 16:23:32 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/unexpected-gotcha-with-relative-paths-in-actionscript#comment-87243</guid>
					<description>Gregg,

&lt;code&gt;#include&lt;/code&gt; is a compiler directive, which means it only comes into play at compile time, when a SWF is generated from its FLA source file.  In other words, &lt;code&gt;#include&lt;/code&gt; is read by the FLA, not the SWF, so it doesn't fall pray to any of the gotchas mentioned in this article or &lt;a href=&quot;http://www.quip.net/blog/2006/flash/unexpected-pov-swf-defers-to-html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;the earlier one&lt;/a&gt;. By the time your ActionScript is compiled into bytecode, the SWF is no longer aware of the &lt;code&gt;#include&lt;/code&gt; directive, because that's what &lt;code&gt;#include&lt;/code&gt; does: it tells the FLA to copy/paste the code it finds in external text files into the FLA itself, making that code indistinguishable from anything typed into the FLA by hand.

Your included .as files need to be located in relation to the FLA source file.  The JPGs listed in your XML need to be located in relation to the HTML document that loads your SWF.</description>
		<content:encoded><![CDATA[<p>Gregg,</p>
<p><code>#include</code> is a compiler directive, which means it only comes into play at compile time, when a SWF is generated from its FLA source file.  In other words, <code>#include</code> is read by the FLA, not the SWF, so it doesn&#8217;t fall pray to any of the gotchas mentioned in this article or <a href="http://www.quip.net/blog/2006/flash/unexpected-pov-swf-defers-to-html" target="_blank" rel="nofollow">the earlier one</a>. By the time your ActionScript is compiled into bytecode, the SWF is no longer aware of the <code>#include</code> directive, because that&#8217;s what <code>#include</code> does: it tells the FLA to copy/paste the code it finds in external text files into the FLA itself, making that code indistinguishable from anything typed into the FLA by hand.</p>
<p>Your included .as files need to be located in relation to the FLA source file.  The JPGs listed in your XML need to be located in relation to the HTML document that loads your SWF.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
