addChild to root and fade in
- by steve
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);
}