-
URGENT! Dynamic Image load - using variable result
Greetings and MANY thanks for taking a look at this!!!
What I am trying to do is simply load an image based on the result of a variable. In "english" this is what I want to do:
if variableA is equal to 1 then load image01
if variableA is equal to 2 then load image02
I am not sure if this was necessary but just incase:
I have placed image01 in a movieclip, so now I have movie01
I have placed image02 in a movieclip, so now I have movie02
On frame 10 layer 1 my variableA is displayed as dynamic text.
On frame 10 layer 2, shouldn't I be able to place movie01, select it, then whip up an actionscript statement?
For example, I've tried:
Code:
onClipEvent (load) {
if (variableA==1) {
setProperty("movie01", _visible, "1");
}
}
The trouble with this is, the movie is displayed whether variableA is equal to 1, 2, 10, or even 0.
Again THANKS SO MUCH for ANY help on this. I think I've thought about this too much and am now just stuck!
-
It isn't immediately clear what you have done without seeing your FLA.
However, here are a couple of methods:
From library:
Load the images in your library, right-click and set the "linkage" name to movie01 and movie02 respectively.
On the main timeline, for the frame where you want to show the images:
attachMovie("movie0"+variableA,1);
From URL:
On the frame where you want to load the movie, put a holder MC with instance name "holder" where you want the image to show. On the main timeline, put:
holder.loadMovie("movie0"+variableA+".swf",1);
-
THANKS!
Thanks for your help.
I attempted what you suggested using the LIBRARY instructions. (I should have specified that this will be a projector file and not on the web). I may be missing something simple as it is not working. I stripped down my .fla to a few frames -- would you care to look at it and tell me what I am missing????
It's a VERY simple quiz. If you answer True, the variable gets 2 added to it. It you answer Mostly True, the variable gets 1 added to it.
When you get to the "Results" frame, if the variable is 2, a long graphical bar will appear. If the variable is 1, a short graphical bar appears.
Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|