tags:

views:

82

answers:

1

Hi folks,

I have the following code in a flash application

loadMovie("original_files/default_image.jpg", "default_img");

It's a background image, AFAI can tell.

Now, notice how the path is for a local file. How does this impact when i have the flash application compiled to a swf file and embedded into an web page? That swf will look locally, right? (which none of the clients will have this file). So i would have to make this a URI (eg. http://mywebsite.com/images/flashBackground.png"). But if that's the case, how would the flash application find this file, when i'm trying to debug the flash app?

Yes, i've (more or less) never used flash :(

cheers :)

A: 

If you don't specify the url to be http:// then it'll be local. The local path will be relative to the html page hosting the swf file, not the actual path of the swf file. Also if you do use relative paths be careful with the slashes as /someFolder/someFile might point to a different location on a windows or *nix server.

As for the URI's you local copy of the swf when you're debugging should find the file with any problems as long as you're running the swf from your local filesystem. If on other hand you run from localhost then you will run into the Flash Player security sandbox issue. You can't load access resources different from that of the subdomain of the current swf.

Matti
>>The local path will be relative to the html page hosting the swf file, not the actual path of the swf file<< So, just to confirm. Even though the swf will be emdedd in an html file, which THEN gets downloaded to the user ... the path will be relative to website where the swf file originated from?
Pure.Krome
Sorry for the confusion. The local path will be relative to the html file where you embed the swf file. Even though the user eventually downloads the html file to their machine the local paths will be relative to the html page that the user is accessing with their browser. Keep this in mind if you have a folder (like "media/") for the swf but the html file is in server root. The local paths will then be relative to server root. Hope that helps.For security sandbox stuff have a look at this:http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes_02.html
Matti