Solved

Use of asp variable in flash

Posted on 2008-10-22
4
167 Views
Last Modified: 2013-11-11
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
0
Comment
Question by:vadirk
  • 2
  • 2
4 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 22776228
that should work, what's the problem.
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.
0
 

Author Comment

by:vadirk
ID: 22776437
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=picture.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
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 22778742
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)
0
 

Accepted Solution

by:
vadirk earned 0 total points
ID: 22785261
I've been trying to do this in another way and I've found a solution that works;  This is the code:
myVars = new LoadVars();
myVars.load("default.asp");
myVars.onLoad = function(success){
if(success){
loadMovie(myVars.mylink,picture);
}else{
test.text = "Error connecting.";
}
}

where test is a dynamic text field. Thx for the help anyway!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now