Hey all/Jack.
Im having an issue here and im scratching my head, I did do some research and after messing around with the flush parameters it still did not do what I wanted to accomplish So I have to ask for some help on this one.
Basically what I am doing is loading in an array of swfs so I can flow through them in a carousel style, with next and previous arrows,logically you click the next arrow,it fades out one swf,and loads in the following swf.
However when I use loaderQueue.unload(); and once again load. it will fade out the current swf,but when it loads in the new one it has the new swf overlapping the second one,if i press next again,it has 3 swfs,and so on. So it seems it is not removing my initial content.
Hopefully someobody can help me out here
Inside of swfVisualView I have
public function createListeners():void
{
BedrockDispatcher.addEventListener( SiteEvent.PREVIOUS_DONE, this.onUnloadSwf );
BedrockDispatcher.addEventListener( SiteEvent.NEXT_DONE, this.onUnloadSwfFinal );
BedrockDispatcher.addEventListener( SiteEvent.NEXT_READY, this.createLoader );
}
public function createLoader($event:SiteEvent):void
{
this.createLoaderQueue();
}
public function createLoaderQueue():void
{
trace("Creating Loader Queue");
var loaderQueue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:this.onProgressHandler, onComplete:this.onCompleteHandler, onError:this.onErrorHandler});
this.appendLoaders(this.data.swfSource);
}
// Append Several Loaders
public function appendLoaders($url:String):void
{
var urlRequest:String = (BedrockEngine.config.getEnvironmentValue( BedrockData.SWF_PATH ) + this.data.swfSource );
loaderQueue.append( new SWFLoader(urlRequest, {name:"mainClip", estimatedBytes:3000, container:this, autoPlay:false}) );
loaderQueue.load(true);
loaderQueue.autoDispose = true;
}
public function onUnloadSwf($event:SiteEvent):void
{
trace("I heard it was time to unload?");
loaderQueue.unload();
loaderQueue.dispose(true);
loaderQueue = null;
}
public function onLoadSwf():void
{
loaderQueue.load(true);
}
/*
Event Handlers
*/
public function onProgressHandler($event:LoaderEvent):void
{
trace("progress: " + $event.target.progress);
}
public function onCompleteHandler($event:LoaderEvent):void
{
trace($event.target + " is complete!");
//this.onLoadSwfFinal();
}
public function onErrorHandler($event:LoaderEvent):void
{
trace("error occured with " + $event.target + ": " + $event.text);
}
Inside of the initial container,where I make my index switches to reload a new swf to load I have
public function intro($data:Object=null):void
{
//BedrockDispatcher.dispatchEvent( new SiteEvent( SiteEvent.NEXT_READY, this) );
TweenLite.to(this.container, 3, {delay:0.5,alpha:1});
}
public function outro($data:Object=null):void
{
TweenLite.to(this.container, 1, {alpha:0,onComplete:this.outroDone});
}
public function outroDone():void
{
}
public function clear():void
{
}
/*
Create Functions
*/
public function createListeners():void
{
ButtonUtil.addListeners( this.leftArrow, { down:this.onPrevious} );
ButtonUtil.addListeners( this.rightArrow, { down:this.onNext} );
}
public function outroDoneNext():void
{
BedrockDispatcher.dispatchEvent( new SiteEvent( SiteEvent.NEXT_DONE, this) );
trace("new index number is " + this.indexNumber++);
var currentObject:Object = ReachModel.getInstance().brushes.data[this.indexNumber];
var swfContainerClip:SwfVisualView = new EmptyContainer;
this.container.removeChildAt(0);
this.container.addChild(swfContainerClip);
swfContainerClip.initialize(currentObject);
this.intro();
}
public function outroDonePrev():void
{
BedrockDispatcher.dispatchEvent( new SiteEvent( SiteEvent.PREVIOUS_DONE, this) );
var currentObject:Object = ReachModel.getInstance().brushes.data[this.indexNumber];
var swfContainerClip:SwfVisualView = new EmptyContainer;
this.container.removeChildAt(0);
swfContainerClip.initialize(currentObject);
this.container.addChild(swfContainerClip);
this.intro();
}
/*
Event Handlers
*/
public function onPrevious($event:MouseEvent):void
{
TweenLite.to(this.container, 1, {alpha:0,onComplete:this.outroDonePrev});
trace("new index number is " + this.indexNumber--);
//BedrockDispatcher.dispatchEvent( new SiteEvent( SiteEvent.PREVIOUS_DONE, this) );
}
public function onNext($event:MouseEvent):void
{
TweenLite.to(this.container, 1, {alpha:0,onComplete:this.outroDoneNext});
//BedrockDispatcher.dispatchEvent( new SiteEvent( SiteEvent.PREVIOUS_DONE, this) );
}
So basically when I unload I just re initilize a new index so it can load in the next swf in my array.
Which ultimately it does do,but it will have every previous swf loaded into it behind it.
Thanks in advance