Solved

Use of asp variable in flash

Posted on 2008-10-22
4
169 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Auto Submit on dropdown box 3 79
IP API - need data... 4 27
ASP exit 10 18
Set time on Session (ASP) 14 21
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

790 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