Hey Flashers...it's been a while since I've run into trouble but it was always gonna happen! I'm not much of an AS user to be honest...but this is one instance when I want to use it!
Is it possible to use the loadMovie function and specify which frame the movie begins at? Basically, let us imagine, I'd like to have two buttons that load one swf file. One loads the movie at the beginning and the other on frame 10. Possible or not?
There are a few ways you can do it.
One way is to leave the first frame of your external movie blank.
Make each of the buttons set one variable to different values:
button1_btn.onRelease = function(){
_root.myVar = A;
}
Then, on the first from of the external swf, put a statement that checks to see which variable was set:
if (_level0.myVar ==A){
gotoAndPlay(2);
}else if(_level0.myVar ==B){
gotoAndPlay(20);
}
So the first thing that happens the moment the outside movie loads is that it checks to see which frame to start at.
Now, this does not take into account how heavy the external movie is and whether or not you need a preloader. That's another story.
Thanks man for the fast response! That should do the trick perfectly...it's not going to be a huge file so a preloader shouldn't be required! I'll bodge in the AS now and it's happy days!
create a new FLA. Save it with the name main.fla. Now, create an mc/btn. Drag 2 instances of it onto your main timeline (on frame 1)... give them the instance names 'btn0' and 'btn1' (without the quotes). create another layer (your ACTIONS layer) Then place this code on the actions layer, also in frame one:
Now create a new FLA. Save it to the same directory as main.fla but give it the name external.fla.
Now, create 3 layers in your external.fla file : actions, labels, & stuff.
Leave the first frame blank, except for this code in the actions layer
Code:
gotoAndStop(_level0.myFrame);
Nn frame 2 (or wherever you like) create a keyframe in the 'labels' layer and give it the frame label "sect_1" (without quotes) and create a keyframe (on the same frame as in labels layer) in the 'stuff' layer and draw whatever you want.
Move down the timeline a bit, and create a 2nd keyframe on both the 'labels' and 'stuff' layers... give the labels frame the name "sect_2", and draw whatever you want on the 'stuff' frame.
Publish the external.fla file using Flash Player 7 and ActionScript 2.0 settings (or higher)....
go back to your Main.fla and test the movie. when you press btn0, it will load the file to the second frame label, as specified in the code, and btn1, will load to the first frame label...
Last edited by madzigian; 08-22-2006 at 02:32 PM.
Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
OS X 10.3.9 || Flash MX04 Pro
| del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |
if you are loading files using a preloader... you'll need to make a few minor adjustments... but the changes are very simple and logical.
Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
OS X 10.3.9 || Flash MX04 Pro
| del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |
Wow! Thanks.....I 'almost' understand that! I've used your file and it works like a dream...it's exactly what I wanted to do!!!
The code you put in frame one in the main.fla file creates an empty holder for the swf to be loaded into, I've created a box (instance name 'loadbox') that is a specific size and in a certain area that I'd like the movie to be loaded into!
One final thing...how do I make it load into a 'holder' that is already present!?
i would suggest making your content the size you want it to be..... keep your empty 'holder' clip EMPTY. if you want to place a background behind your content, create a separate clip for the background, and place it behind the holder (on a lower layer).
If you want to start manipulating the properties of your holder clip, I'd suggest using the MovieClipLoader() class to load your movies, and not loadMovie()
you don't have to create the empty clip via actionscript either, i just did because it was quicker for my example. just go to INSERT --> New Symbol... --> MovieClip . name it empty_mc. then just close the clip (got back to main timeline) and drag an instance of the empty movie clip onto your stage. give it whatever instance name you want, and place it where you want. And every time you need an empty movie clip for something, just drag another instance of it onto your stage and give it a unique instance name.
Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
OS X 10.3.9 || Flash MX04 Pro
| del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |
how do I make it load into a 'holder' that is already present!?
to answer that.... you just target the clip you want to load your movie into. If it's instance name is my_mc for example.... you use my_mc.loadMovie("movei.swf')
Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
OS X 10.3.9 || Flash MX04 Pro
| del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |
Thanks to both you and Big 'Un once again for helping me out! It's great to have such learned flashers out there on the interweb! No doubt I'll be back again with another problem at some point....but for now....job's a goodun!
Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
OS X 10.3.9 || Flash MX04 Pro
| del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |