Solved

Use of asp variable in flash

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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 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.

691 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