Good practices for server folder structure

So your pulling your swf from a sub-directory and displaying it in a page on your main directory. Flash will still see as being in the sub-directory even though it’s being viewed in a page on your main directory(root).
This has had many people wondering why there scripts don’t work.
Usually what i do with my swf’s is to have them all in my root directory and then there assets in sub directories of the main.
Example:

httdocs/root/
-index.html
-someswf1.swf
-someswf2.swf
-images/
-images/image1.jpg
-images/image2.jpg
-xml/
-xml/somexml.xml
-php/
-php/some.php

As you can see i store my swf assets and site assets in sub-directories of the root folder.

if you don’t want to go that route then you can just direct link to the php/xml/image in the swf.
Example:
URLRequest(“http://www.somedomain.com/php/contact.php”);

Though with some servers this can also throw up issues.
With some server set-ups if your domain is accessible via http://www.somedomain.com/ and http://somedomain.com/
This can throw a crossdomain issue with your flash app so it is best to lin to the local file
Example:
var req:URLRequest = new URLRequest(”php/contact.php”);

This entry was posted in Flash general, php and tagged , , , , . Bookmark the permalink.