-
Tell MC to go to frame x and then load external jpg...
Hi Guys!
Sorry if this is obvious for you, but I am still kind of a newbie...
Here is the thing: I would like to tell a movieclip through a button that is outside it to go to a specific frame and, once it gets there, load an external jpg file.
For instance: let´s say that I have a MC which has a tween inside it. On the first frame I have "stop" as a code, as well as on frame 20, which is the last frame. Outside the MC, I have a button. If we could mix Action Script and english, the button should carry the following code: movieclip.gotoandPlay(2) and once movieclip gets there load the external jpg file "picture.jpg".
I hope I could explain what I need properly... Thanks in advance!
-
You could put the loadMovie() at frame 20 of your clip, so that when it gets there the frame calls the action.
As to make the clip gotoAndPlay(), you first need to give it an instance name in the properties panel, then you'll be able to 'talk' to it.
For example put a play() on frame 2 and say:
myInstanceName.gotoAndPlay(2)
gparis
-
Thanks, GParis!
However, I would like to put the load command in the button, so that I can have different buttons which will load different JPG files inside the MC.
Thus, I will have one movie clip, with (let´s say) 4 buttons outside it. Each button will carry a script that will tell the movieclip to go to frame 2 (so that the tween effect takes place) and then, once it gets in frame 20 (which is the last) load a different JPG... This way, I will only have to creat a single MC...
Something like this (let´s consider that the MC timeline has a motion tween that goes from frame 1 - which has a STOP script - to frame 20 - which also has a STOP script):
BUTTON #1 = MC.gotoandPlay(2) and once you get to frame 20 load pic1.jpg
BUTTON #2 = MC.gotoandPlay(2) and once you get to frame 20 load pic2.jpg
BUTTON #3 = MC.gotoandPlay(2) and once you get to frame 20 load pic3.jpg
BUTTON #4 = MC.gotoandPlay(2) and once you get to frame 20 load pic4.jpg
Do you think this is possible?
Thanks again for your help (and sorry if I had written too much...)
-
Hi Guys!
Anyone has got some ideas on how can I solve my problem?
Best regards!!
-
use a variable. On frame 20 of your MC put this:
code: loadMovieNum(_level0.myPic,1);
and on your buttons:
code: _level0.myPic = "pic1.jpg";
MC.gotoandPlay(2);
on another button:
code: _level0.myPic = "pic2.jpg";
MC.gotoandPlay(2);
gparis
-
Thank you so much, GParis! I´ll give it a try! But, I´m used to load "stuff" (swfs, mostly) into a movieclip using the loadmovie command. Thus, I know that whatever is loaded it will be loaded into the movieclip, so that I know where it will be displayed on the stage.
When I use the loadmovienum command, I cannot specify a destination movieclip. I have to specify a level (0, for instance). But then, how can I be sure where the loaded stuff (let´s say, a swf, or a JPG) will be displayed into the stage?
GParis, I´m not (by all means) refusing your solution... It will help me A LOT and I am very grateful for it. I just want to understand how it works.
Gosh... I hope I´m not pushing it... sorry...
-
If you want to load into a container clip, just use loadMovie() instead, using the empty movieClip's instance name as target.
So on frame 20 of your MC:
code: loadMovie(_level0.myPic,_parent.host);
// will load into an mc with instance name "host" set on the parent timeline.
gparis
Last edited by gparis; 12-06-2006 at 09:47 AM.
-
Thanks, GParis!
Works like a charm!
You are my hero!
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
|