all groups > flash (macromedia) > october 2003 >
You're in the

flash (macromedia)

group:

Question: Using variables in a URL path?


Question: Using variables in a URL path? Lunatech3D
10/19/2003 11:42:35 PM
flash (macromedia):
I am getting a variable from a PHP page and trying to use that number in loading an image in flash. Here is the code.



code:--------------------------------------------------------------------------------
imgNum=_root.newNum;
loadMovieNum("/images/small/"+imgNum+".jpg", 2);
--------------------------------------------------------------------------------


Currently it is not working. I have a dynamic text field showing the correct number using 'imgNum' as the var:

The code works fine if I use:

code:--------------------------------------------------------------------------------
imgNum=1;
loadMovieNum("/images/small/"+imgNum+".jpg", 2);
--------------------------------------------------------------------------------


What am I doing wrong here? Thanks for any help!

Re: Question: Using variables in a URL path? filip NO[at]SPAM bloodforge
10/20/2003 12:29:27 AM
Try running your flash swf on an actual server instead of the stand-alone player (as in, upload your movie to the server and access it through the browser; or run it through apache/iis). Flash does not accept outside variables when it is ran locally (at least that has been my experience). Hopefully that will fix your problem, since your code seems to be correct.

Filip Stanek


Re: Question: Using variables in a URL path? Lunatech3D
10/20/2003 1:02:55 AM
Actually it should work locally. I have am using Apache, ane have my own server running. I regularly run php pages and it works just the same as if I upload it.

I'll try though just in case...

Re: Question: Using variables in a URL path? Jack.
10/20/2003 10:18:59 AM
external variables are received by Flash as "strings"
so try -

imgNum=Number(_root.newNum);
loadMovieNum("/images/small/"+imgNum+".jpg", 2);

hth



cheers
Re: Question: Using variables in a URL path? Lunatech3D
10/20/2003 1:57:07 PM
Uploaded and tried it and it still did not work.
I also tried:

imgNum=number(_root.newNum);
loadMovieNum("/images/small/"+imgNum+".jpg", 2);

Which also did not work. I still get the correct number displayed in my text box with var:imgNum.

I know you use '.' (periods) to concatenate in PHP. Is using '+' the correct syntax in flash?
Thanks again for any help!

Re: Question: Using variables in a URL path? Lunatech3D
10/20/2003 3:35:58 PM
Argh... of course something simple...

Instead of:
loadMovieNum("/images/small/"+imgNum+".jpg", 2);

I needed:
loadMovieNum("images/small/"+imgNum+".jpg", 2);

I had an extra forward slash. Issue resolved. Thanks!

Re: Question: Using variables in a URL path? Whitecrest
10/21/2003 7:12:39 AM
In article <bmv7ha$ok8$1@forums.macromedia.com>, "Lunatech3D"
webforumsuser@macromedia.com says...
[quoted text, click to view]

Have you tried to debug it, and see what the value if _root.newNum is?
How are you populating _root.newNum? The error may be when you are
loading the newNum variable.

--
Whitecrest Entertainment
AddThis Social Bookmark Button