Solved

Use of asp variable in flash

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

747 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

10 Experts available now in Live!

Get 1:1 Help Now