actionscript 3 addchild within child and fade
- by steve
Here is my current code:
import flash.display.*;
import fl.transitions.*;
import flash.events.MouseEvent;
stop();
var container:MovieClip = new MovieClip();
container.width = 450;
container.height = 450;
container.x = 450;
container.y = 0;
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);
}
I need the first mouse function (bagClick) to create the bagLink within the container movieclip variable. I tried change it to this, but it didn't work:
else {
MovieClip(root).addchild (container);
MovieClip(root).container.addChild (bagLink);
MovieClip(root).addChild (closeBtn);
MovieClip(root).gotoAndPlay(806);
}
I'm also trying to make "container" or "bagLink" fade in when it loads but that doesn't work either. Any help is appreciated.