-
Button Transitions between swf's in a container...
I know there's a way, just not in Action Script, I could do this. I want to have a Menu Button, when pressed, tells on movie clip, to go to it's ending animation where it fades out, and then, when that's finished, go the movie clip the button was originally pressed for. The movies are being put into an empty container movie.
So, it goes like this:
Press button > Movie clip one goes to ending animation and fades out > then plays Movie clip that the button was pressed for > which has a fade in animation.
Is that confusing enough yet...
Last edited by Mr.Slausen; 10-05-2004 at 11:17 AM.
-
The Flashman
On frame 1 of the main movie (_root):
1) Initialize this varible:
Code:
currentMC = "temp";
newMC = "";
2) Set up an Empty MC (with 2 frames) off stage and give it an instance name: temp
3) Place a stop() action on first frame.
4) On 2nd frame place this:
Code:
_root[newMC].play();
5) Place the same code (_root[newMC].play()) on the last frame of all your movieclips.
6) On the buttons of your main menu, you have something like this:
[code]
on (release) {
newMC = "Profile";
_root[currentMC].gotoAndPlay(endingAnimation_frameNo);
currentMC = "Profile";
}
Note that Profile is the name of the next MC to be played after the other MC fades out.
i eat actionscripts for breakfast
-
Thanks I'll give that a try...I finally figured out what I was trying to do...Transition is the word. Finally figured that out and searched and holy hell...I've got alot of reading to do...
-
I have a quick question...since I'll be replacing one movie clip with another, because they are gonna be loaded into the same container, couldn't I just do soemthing like...and forgive me...you'll get my drift...
onPress
containerMovie set the Alpha to 0
speed = 6 or something
loadMovie (NewMovie.swf) in containerMovie
set the Alpha to 100
Would something like that work...
-
The Flashman
Yeah.. its possible:
code:
on (release) {
_root.container.newMovie = "newMovie.swf";
_root.container.fade = true;
}
and on your container movie:
code:
onClipEvent (eneterFrame) {
if (fade) {
_alpha -= 6;
if (_alpha < 0) {
fade = false;
this.loadMovie(newMovie);
_alpha = 100;
}
}
}
i eat actionscripts for breakfast
-
Sweet...I'll try that A.S.A.P...
-
I put the first Action on the button, and the second action on the Container Movie. When I hit the button, it fades the container movie, and that's it...nothing else happens. Here's the code on both...
code:
on (release) {
_root.container1.newMovie = "swf/Web.swf";
_root.container1.fade = true;
}
And here's the code for the container movie:
code:
onClipEvent (enterFrame) {
if (fade) {
_alpha -= 6;
if (_alpha<0) {
fade = false;
this.loadMovie(container1);
_alpha = 100;
}
}
}
Yes, I'm half retarded and this SHOULD probably be real easy, but I'm having trouble.
-
The Flashman
code:
this.loadMovie(container1);
must be...
code:
this.loadMovie(newMovie);
i eat actionscripts for breakfast
-
Yup, I'm an idiot...that worked...BUT...the movie fades out...but the new movie doesn't fade in, just pops in. When I hit that same button again, it's fades itself out and pops itself right back in. So, the fading out part is working, but it just ain't fading back in...dammit my head hurts...
-
The Flashman
Code:
onClipEvent (enterFrame) {
if (fade) {
_alpha -= 6;
if (_alpha<0) {
fade = false;
this.loadMovie(myMovie);
fadeIn = true;
}
}
if (fadeIn) {
_alpha += 6;
if (_alpha>100) {
fadeIn = false;
}
}
}
i eat actionscripts for breakfast
-
Thanks man..you've been real helpful...I'll try this code tomorrow...
-
Well, I tried your code...bad news...it fades off now and then nothing...nothing comes back...
-
_alpha can never be less than 0 or greater than 100, so those conditions can never be satisfied
to fix existing
code:
onClipEvent (enterFrame) {
if (fade) {
if (_alpha>0 {
alpha -= 6;
} else {
fade = false;
this.loadMovie(myMovie);
fadeIn = true;
}
}
if (fadeIn) {
if (_alpha<100) {
_alpha += 6;
} else {
fadeIn = false;
}
}
}
or a reusable function, not attached to any particular button or clip. put in frame, not on clip - everything, good habit to start is never script on clips or buttons. and have your enterframes kill themselves when they're not needed, might be important since your already working with heavy alpha channels. gl
code:
function fadein(target) {
target.onEnterFrame=function() {
if (this._alpha<100) {
this._alpha += 5;
} else {
delete this.onEnterFrame;
}
}
function fadeout(target) {
target.onEnterFrame=function() {
if (this._alpha>0) {
this._alpha -= 5;
} else {
delete this.onEnterFrame;
}
}
this.whateverbutton.onPress=function() {
fadein(whatevermovieclip);
}
this.anotherbutton.onRollOver=function() {
fadeout(this);
}
Last edited by moagrius; 10-05-2004 at 01:23 PM.
-
The Flashman
Originally posted by moagrius
_alpha can never be less than 0 or greater than 100
Really?!? Then I guess Flash has an error since i've been using the same condition since the days of Flash 5.. it works!!
i eat actionscripts for breakfast
-
I'll try those then..thanks again...
-
Originally posted by earl223
Really?!? Then I guess Flash has an error since i've been using the same condition since the days of Flash 5.. it works!!
you're right, i was wrong. i thought i had read that somewhere but testing your code proves otherwise. no need to be a smartass about it.
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
|