vadirk
asked on
Use of asp variable in flash
I've managed to pass text variables from asp into flash and show the text in dynamic text fields. Now I have the problem that I want to use such a variable to load an image in flash. A variable named link has the value picture.jpg and I want to use this variable in the loadMovie() function (something like loadMovie(myPic,picture); where myPic is a flash variable with "picture.jpg" as value and picture is the movieclip in which the picture needs to be shown.). Could anyone help me with this problem? thx
ASKER
Well, I've tried the following, but the image doesn't show...
In the first frame, I've put the code: loadVariablesNum("default. asp", 0, "GET");
The output from default.asp is: &name=Picture&mylink=pictu re.jpg
So I have a dynamic text field which displays the name perfectly. Some frames further I've created a movieclip with the instance name picture. On that frame I have the following code:
loadMovie(mylink, picture); so normally it would display the picture. I've tried this with creating a variable pic="picture.jpg" and used loadMovie(pic, picture); and this works like a charm... It looks like there's something whrong with the mylink variable... As I am just beginning to use flash this way, I'm not so familiar with all the classes I can use for this... what do you think is going wrong with the code? thx
In the first frame, I've put the code: loadVariablesNum("default.
The output from default.asp is: &name=Picture&mylink=pictu
So I have a dynamic text field which displays the name perfectly. Some frames further I've created a movieclip with the instance name picture. On that frame I have the following code:
loadMovie(mylink, picture); so normally it would display the picture. I've tried this with creating a variable pic="picture.jpg" and used loadMovie(pic, picture); and this works like a charm... It looks like there's something whrong with the mylink variable... As I am just beginning to use flash this way, I'm not so familiar with all the classes I can use for this... what do you think is going wrong with the code? thx
might be a scope issue, i.e. by that frame the variable doesn't exist anymore.
if you trace picture on that frame, do you get the variable? if yes - then hmmm, if not.
what you can try.
on that frame where you do the loadVariables,
set a variable
var imgurl:String = _level0.mylink;
then use imgurl later on (again trace it to check)
if you trace picture on that frame, do you get the variable? if yes - then hmmm, if not.
what you can try.
on that frame where you do the loadVariables,
set a variable
var imgurl:String = _level0.mylink;
then use imgurl later on (again trace it to check)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
obviously assuming the image is in the same directory as the swf - if it pulls the values out correctly then you should be able to use it.
However, have a look at the Loader Class for loading jpegs rather than loadMovie (why - if you're not really doing anything with the jpeg it doesn't matter but the Loader class just offers more control over the process in terms of event listeners etc.)
blu.