addChild to root and fade in
Posted
by steve
on Stack Overflow
See other posts from Stack Overflow
or by steve
Published on 2010-05-24T10:58:51Z
Indexed on
2010/05/24
11:01 UTC
Read the original article
Hit count: 355
actionscript-3
|fade
Still very newbish at Actionscript. Trying to get a website done for class on wednesday, but I can't get this one thing down. Currently there's the main timeline, then a movieclip called menu_mc, and within that are a bunch of buttons. For now, I only have one button scripted. When the button is scripted, I want a movieclip with content embedded in it to fade in on the right side, along with a close button. I can get the movie/button to appear and close, but I can't get them to fade in and out. This is what I have:
import flash.display.*;
import fl.transitions.*;
import flash.events.MouseEvent;
stop();
var closeBtn:close_btn = new close_btn();
closeBtn.x = 850;
closeBtn.y = 15;
var bagLink:MovieClip = new bag_link_mc();
bagLink.x = 900;
bagLink.y = 0;
menu_bag_button.addEventListener(MouseEvent.CLICK, bagClick);
function bagClick(event:MouseEvent):void{
if(MovieClip(root).currentFrame == 850) { }
else {
MovieClip(root).addChild (bagLink);
MovieClip(root).addChild (closeBtn);
MovieClip(root).gotoAndPlay(806);
}
}
closeBtn.addEventListener(MouseEvent.CLICK, closeBag);
function closeBag (event:MouseEvent):void{
MovieClip(root).removeChild(bagLink);
MovieClip(root).removeChild(closeBtn);
MovieClip(root).gotoAndPlay(850);
}
© Stack Overflow or respective owner