Hi was changing some away3d code round and I am confused, I wanted to do...

//my ColladaLoader class
public function load(): void
{
        _colladaModel = Collada.load( _path );
        _colladaModel.addOnSuccess( completed );
}

public function completed( e: * ):void
{
        // reposition when loaded based on some xml
        applyAttributeTo( _colladaModel, _xmlChanges.model3D[0] );
        loadedSignal.dispatch();//signal
}

then in my ZoneLoader when all models are loaded, I then dispatch a signal to tell the 3d I wanted to add them to the scene.

_zoneLoader.loadedSignal.add( function() { _threeD.addChildren( _zoneLoader.get3DModels() ) };

But this does not work, instead I seem to need to

//my ColladaLoader class
public function load(): void
{
        _colladaModel = Collada.load( _path );
        applyAttributeTo( _colladaModel, _xmlChanges.model3D[0] );
        _view.scene.addChild( _colladaModel );
        _colladaModel.addOnSuccess( completed );
}

public function completed( e: * ):void
{       
        loadedSignal.dispatch();//signal
}

Which is annoying as I have to pass my _view into the class rather than what I was trying to do which was to get the _colladaModel's when loaded, position them and pass them to my _threeD class to be added. This seems more sensible as I only parse the positional data when the assets actually loaded and change materials etc... and only render it when loaded and adjusted, but for some reason Collada class does not work in the way? Is there a better approach.

I have a feeling I asked about this before last time I looked at away3d and my friends code but I have forgotten the solution.

Cheers

;j




Reply via email to