Hi Andreas,
I'm trying to implement the loader, but I'm having an issue that I can
only set the text of the dynamic text box on the stage after the
Event.Complete has fired from the loader. Here is the code. Can you
please take a look at this?
Thanks!
public function Main ( )
{
this.loader = new ColladaLoader ( ) ;
this.stage.align = StageAlign.TOP_LEFT ;
this.stage.scaleMode =
StageScaleMode.NO_SCALE ;
loader.addEventListener ( Event.COMPLETE ,
this.loadComplete ) ;
loader.addEventListener
( ProgressEvent.PROGRESS,
this.loaderProgress );
loader.load ( new URLRequest ( "models/
world.dae" ) ) ;
}
protected function loaderProgress ( event :
ProgressEvent )
{
var loadedBytes:Number = event.bytesLoaded;
var totalBytes:Number = event.bytesTotal;
displayInfo.text = "Loading Models - please
wait: "+"Bytes Loaded:
"+ loadedBytes+" of "+totalBytes+" Total Bytes";
if(loadedBytes == totalBytes)
{
displayInfo.text = "";
}
}
protected function loadComplete (event:Event) : void
{
var loader : ColladaLoader = event.target as
ColladaLoader ;
this.world = new WorldBuilder ( ) ;
this.world.data = loader.collada ;
this.world.startCamera = "overviewCam" ;
this.world.addEventListener
( Event.COMPLETE ,
this.worldComplete ) ;
this.addChild ( this.world ) ;
//Swap Depth with HUD
this.setChildIndex(this.world,0);
this.displayInfo.text = "This will set the
text of the textBox at
this point";
this.world.build ( ) ;
On Apr 23, 5:54 pm, Andreas Engstrom <[email protected]>
wrote:
> Hi Wes.
>
> The ColladaLoader class that is used in the Awaybuilder examples
> extends URLLoader, so you should be able to listen out for any of
> those events. URLLoader dispatches a ProgressEvent.PROGRESS that you
> can listen to for your preloader.
>
> Cheers,
> .andreas
>
> On 23 Apr 2009, at 21:57, wesm wrote:
>
> Hi,
>
> I would like to build a progress bar for loading my awaybuilder scene.
> I didn't see a progress event for loading Collada model.
>
> I am using Event.COMPLETE to call a loadComplete function, but there
> doesn't seem to be a Event.PROGRESS.
>
> loader.addEventListener (Event.COMPLETE, this.loadComplete);
>
> I am new to away3d and AS3, so I apologize for the simple question.
>
> Thanks,
>
> Wes