actionscript 3 website load movieclips (frames) from library

Posted by steve on Stack Overflow See other posts from Stack Overflow or by steve
Published on 2010-05-24T11:45:59Z Indexed on 2010/05/24 11:51 UTC
Read the original article Hit count: 170

Here is my current code that doesn't function:

import flash.display.*;
import fl.transitions.*;
import flash.events.MouseEvent;

stop();

var contentBox:MovieClip = new MovieClip();
contentBox.width = 400;
contentBox.height = 500;
contentBox.x = 400;
contentBox.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 == 835) { }
else {
MovieClip(root).addChild (contentBox);
MovieClip(root).contentBox.addChild (bagLink);
MovieClip(root).contentBox.addChild (closeBtn);
MovieClip(root).gotoAndPlay(806);
}
}
closeBtn.addEventListener(MouseEvent.CLICK, closeBag);
function closeBag (event:MouseEvent):void{
MovieClip(root).removeChild(contentBox);
MovieClip(root).gotoAndPlay(850);
}

I don't know ActionScript at all, so this may be the complete wrong way of approaching it. The setup is as follows: site loads, there's a big menu in the center (frame 805). When you click on a menu item from there, the whole menu moves to the side, and the right side I want a "contentBox" movieclip, filled with "bagLink" (which is site content) and to have a close button (closeBtn.) It also needs to know that if you click the same link again on the left side that it doesn't reanimate, it just stays (which I achieved with the "if" statement.) Finally, if someone clicks another link, it needs to clear "contentBox" and refill it with whatever movieClip that was clicked.

I know this is a lot to ask, but I'm in dire need of help as this is due on Wednesday...

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about dynamic-data