Jump to content
GreenSock

kikster

Newbie question

Recommended Posts

Hello,

I'm sure this is pretty simple to do but i'm new to LoaderMax and was hoping someone could put me in the right direction.

 

I have a swf that contains 7 icons as the menu. I want each icon onClick to unload current child swf and replace it with a new swf. So basically each icon represents animation1.swf, animation2.swf, animation3.swf, etc. At the end of each animation swf two buttons will appear to either load the menu.swf or go to the next animation[#].swf.

 

I have downloaded the LoaderMax_subload_parent.as example and I believe I understand what is going on but it loads/unloads the same swf. how do I take the code below and make it load/unload multiple swfs where only one swf shows at a time?

 

thanks,

Stephen

 

----------------------------------------------------------

 

 

public function LoaderMax_subload_parent():void {

//create an

_swfLoader = new SWFLoader("LoaderMax_subload_child.swf", {x:25, y:60, estimatedBytes:780000, onComplete:_completeHandler});

 

//create the "overall" circular progress display in the lower left corner of the screen that shows the loading progress for the full-size images after the user clicks "load()"

_progressDisplay = new ProgressCircleLite({radius:26, thickness:4, trackColor:0xFFFFFF, trackAlpha:0.25, trackThickness:4, autoTransition:false, smoothProgress:0});

this.addChild(_progressDisplay);

_progressDisplay.mouseEnabled = false;

_progressDisplay.x = 69;

_progressDisplay.y = 389;

_progressDisplay.addLoader(_swfLoader);

 

//set up listeners

this.load_btn.addEventListener(MouseEvent.CLICK, _loadHandler, false, 0, true);

this.unload_btn.addEventListener(MouseEvent.CLICK, _unloadHandler, false, 0, true);

}

 

 

//---- EVENT HANDLERS ----------------------------------------------------------------

 

private function _completeHandler(event:LoaderEvent):void {

//add the SWFLoader's content to the stage

addChild(event.target.content);

}

 

private function _loadHandler(event:Event):void {

_swfLoader.vars.integrateProgress = this.integrateProgress_cb.selected;

//remove the content from the stage (if it's there). We'll add it again when the loader completes.

if (_swfLoader.content.parent != null) {

_swfLoader.content.parent.removeChild(_swfLoader.content);

}

_swfLoader.load(true);

}

 

private function _unloadHandler(event:Event):void {

_swfLoader.unload();

}

Link to comment
Share on other sites

Hi Kikster,

 

Welcome to the forums.

 

I don't know how your menu or project is currently configured so it would be difficult to try to guess how to adjust that code to fit the particular needs of your project.

 

You have described a full-featured interactive gallery which is largely driven by ActionScript logic. Don't know what type of assistance you need.

Unfortunately we can't build out full projects.

 

I would suggest that you start small and just try to get each button to load its own swf. Once you have something to work with it will be much easier to address specific questions related to the SWFLoader.

 

I'll take a look and see if I have any files that are close to fulfilling your needs. Its very likely that in the semi-near future I will be able to build something like this for our users to learn from.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×