-
Detect current movie playing on stage in AS 3.0
HELP!!!!
I have no way to detect which movie is currently playing on stage so that when I click on a button I want movie 1 to play while I fade out the other movies that have previously been clicked but not removed from the stage.
I don't want to see stacked movies...
I have 8 buttons with 8 corresponding movies.
On Btn1 click, play Movie1,
on Btn2 click, play Movie2,
on Btn3 click, play Movie3,
ie. (all 8 of my buttons are movies, and I'm telling each mc btn to play a separate 8 image based mc movies)
btn1.addEventListener(MouseEvent.MOUSE_OVER, pushPlus);
btn1.addEventListener(MouseEvent.MOUSE_OUT, backPlus);
btn1.addEventListener(MouseEvent.CLICK, displayPlus);
function pushPlus(e:MouseEvent) {
btn1.gotoAndPlay("push");
}
function backPlus(e:MouseEvent) {
btn1.gotoAndPlay("back");
}
function displayPlus(e:MouseEvent) {
btn1.gotoAndPlay("on");
btn2.gotoAndPlay("hide");
btn3.gotoAndPlay("hide");
btn4.gotoAndPlay("hide");
btn5.gotoAndPlay("hide");
btn6.gotoAndPlay("hide");
btn7.gotoAndPlay("hide");
btn8.gotoAndPlay("hide");
img1_mc.gotoAndPlay("fadeIn"));
//-- I want to say here if it's playing img1_mc
then tell only the current movie (or previously clicked button img3_mc let's say) to fade out, and make sure rest of the other movies aren't playing and I'm not seeing it.
}
-
-
By "movie", do you mean a video or another movieclip?
-
The Following User Says Thank You to Medyman For This Useful Post:
-
Sorry, I meant "Movie" as in "movie clip".
Attached pix shows my stage layout.
As an example, I have 4 btns on right side and movie clips in center.
All 4 corresponding movies appearing in same location. So my problem is the buttons I clicked once stacks on top of each other and still shows up...
When I click on button1, I want movieClip1 to fly in & fade in (which I've animated inside the movie clip, calling it to gotoandplay label fadeIn which does this.)
When I click button2, I want mc1 to flyOut and fade (again, made in the mc1) THEN, play movieClip2 to fly in, fade in.
Now if I only had 2 buttons I'd be fine.
But since I have 4 I don't know how to assign which movie to fade out before I can play the current movieClip.
//Here's the AS3 I used for 3 buttons so far in the frame...
import flash.display.*;
import flash.events.MouseEvent;
//--shows hand on screen else doesn't show since it's a movie clip, these are my button names, ie. navPort = btn1, navSoonr = btn2, etc.
navPort.buttonMode = true;
navPort.useHandCursor = true;
navSoonr.buttonMode = true;
navSoonr.useHandCursor = true;
navPlus.buttonMode = true;
navPlus.useHandCursor = true;
portSlide.buttonMode = true;
portSlide.useHandCursor = true;
//--BTN portfolio function, ie. button1, portSlide = mc1
navPort.addEventListener(MouseEvent.MOUSE_OVER, pushPort);
function pushPort(e:MouseEvent) {
navPort.gotoAndPlay("push");
}
navPort.addEventListener(MouseEvent.MOUSE_OUT, backPort);
function backPort(e:MouseEvent) {
navPort.gotoAndPlay("back");
}
navPort.addEventListener(MouseEvent.CLICK, display);
function display(e:MouseEvent) {
navPort.gotoAndPlay("on");
navSoonr.gotoAndPlay("hide");
portSlide.gotoAndPlay("fadeIn");
plusSlide.gotoAndPlay("fadeOut");
}
//--BTN soonr function, btn2,
navSoonr.addEventListener(MouseEvent.MOUSE_OVER, pushSoonr);
function pushSoonr(e:MouseEvent) {
navSoonr.gotoAndPlay("push");
}
navSoonr.addEventListener(MouseEvent.MOUSE_OUT, backSoonr);
function backSoonr(e:MouseEvent) {
navSoonr.gotoAndPlay("back");
}
navSoonr.addEventListener(MouseEvent.CLICK, displaySoonr);
function displaySoonr(e:MouseEvent) {
navSoonr.gotoAndPlay("on");
navPort.gotoAndPlay("hide");
portSlide.gotoAndPlay("fadeOut");
}
//--BTN plus function
navPlus.addEventListener(MouseEvent.MOUSE_OVER, pushPlus);
function pushPlus(e:MouseEvent) {
navPlus.gotoAndPlay("push");
}
navPlus.addEventListener(MouseEvent.MOUSE_OUT, backPlus);
function backPlus(e:MouseEvent) {
navPlus.gotoAndPlay("back");
}
navPlus.addEventListener(MouseEvent.CLICK, displayPlus);
function displayPlus(e:MouseEvent) {
navPlus.gotoAndPlay("on");
navPort.gotoAndPlay("hide");
gotoAndPlay("plus");
plusSlide.gotoAndPlay("fadeIn");
}
//--port Slide
portSlide.addEventListener(MouseEvent.MOUSE_OVER, captionF);
function captionF(e:MouseEvent) {
portSlide.gotoAndPlay("over");
}
portSlide.addEventListener(MouseEvent.MOUSE_OUT, captionOut);
function captionOut(e:MouseEvent) {
portSlide.gotoAndPlay("out");
}
//--plus Slide
plusSlide.addEventListener(MouseEvent.MOUSE_OVER, captionPlus);
function captionPlus(e:MouseEvent) {
plusSlide.gotoAndPlay("over");
}
plusSlide.addEventListener(MouseEvent.MOUSE_OUT, captionPOut);
function captionPOut(e:MouseEvent) {
plusSlide.gotoAndPlay("out");
}
-
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
Bookmarks