Solved

Use of asp variable in flash

Posted on 2008-10-22
4
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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 the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
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.

696 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