this is driving me insane, and i can't figure out why its not working...
ok, basically, i've created a template fla file that will dynamically pull the contents from an XML file, and load the data from nodes that correspond to the file name
ie
<node>
<name>foo</name>
</node>
<node>
<name>bar</name>
</node>
if the file is named foo.swf, it will load "foo". got it? good.
i've got the script working like i want...only problem is, it either works locally, and not remotely, or remotely and not locally.
and the problem comes in from the file name. which is in the following convention... XXXXXXX_foo.swf (where X is a digit)
the exact problem is how the "_" is handled. locally, it is translated to "%5F", and remotely, it remains "_".
the way that i'm getting the name is from the _url property.
remotely it returns
http://server/path/XXXXXXX_foo.swf
locally it returns file:///path/to/file/XXXXXXX%5Ffoo.swf
so, here is my code...
Code:
Quote:
swfName = _url;
swfName = String(swfName);
if (swfName.substring("_")){
swfName = swfName.split("_");
} else {
swfName = swfName.split("%5F");
}
|
both of the statements work, they just don't work in the if/else statement. basically its not recognizing the else condition.
the code, like it is written, will work for viewing the file remotely in a browser/webpage. but locally, it is not recognizing the else condition and splitting the file name at the "%5F"
any thoughts?