away3d, starling - problem with GPU Memory

Software: Away3D 4.x

3pstation, Newbie
Posted: 13 April 2014 06:34 AM   Total Posts: 11

Hi!
There are Main class where i have starling and PrefabProject. I use Stage3DProxy for this. This swf(it’s 3D level-map) i use in main flash . When i do dispose, how i can see, GPU memory do not release… So when this map-swf is loaded again flash player crash… Please Help smile

//Main Class
  
public function My3DClass()
  
{
   addEventListener
(flash.events.Event.ADDED_TO_STAGEinitProxies);
  
}
  
  
private function initProxies(event:flash.events.Event null):void
  {
   removeEventListener
(flash.events.Event.ADDED_TO_STAGEinitProxies);
   
_stage3DManager Stage3DManager.getInstance(stage);
   
   
_stage3DProxy _stage3DManager.getFreeStage3DProxy();
   
_stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATEDinitApp);
   
_stage3DProxy.antiAlias 2;
   
_stage3DProxy.color 0xFF0000;
  
}
  
  
private function initApp(event:flash.events.Event):void
  {
   _stage3DProxy
.removeEventListener(Stage3DEvent.CONTEXT3D_CREATEDinitApp);
   
_prefab = new PrefabProject();
   
_prefab.initView(_stage3DProxythis);
   
addChild(_prefab);
   
initStarling();
  
}
  
private function initStarling():void
  {
   _starling 
= new Starling(StarlingStarsSpritestage_stage3DProxy.viewPort_stage3DProxy.stage3D);
   
_starling.addEventListener(starling.events.Event.ROOT_CREATEDstarlingActivated)
  
}

  
private function starlingActivated(event:starling.events.Event null):void
  {
   _starling
.removeEventListener(starling.events.Event.ROOT_CREATEDstarlingActivated)
   
_stage3DProxy.addEventListener(flash.events.Event.ENTER_FRAMEonEnterFrame);
  
}

  
private function onEnterFrame(event:flash.events.Event):void
  {
   Guys
.update();
   
_hoverController.update();
   
_prefab.renderFrame(null);
   
_starling.nextFrame();
  
}

  
public function destroy():void
  {
   _awayStates
.unregisterView(_prefab.view);
   
this.removeChild(_awayStates);
   
_stage3DProxy.removeEventListener(flash.events.Event.ENTER_FRAMEonEnterFrame);
   
   
_prefab.destroy();
   
_starling.stop();
   
_starling.dispose();
   
_stage3DProxy.dispose();
   
   
AssetLibraryBundle.getInstance().removeAllAssets(true);
   
   
_stage3DManager null;
   
   
this.removeChild(_prefab);
   
   try 
{
    
new LocalConnection().connect('foo');
    new 
LocalConnection().connect('foo');
   
catch (e:*) {};
}

//Prefab Class
  
public function initView(stage3DProxy:Stage3DProxyparent:DisplayObjectContainer):void
  {
   _view 
= new View3D();
   
_view.antiAlias 2;
   
_view.stage3DProxy stage3DProxy;
   
_view.shareContext true;
   
_view.backgroundColor 0xCCCCCC;

   
_camera _view.camera;
   
_camera.lens = new PerspectiveLens(48);
   
_camera.lens.near 10;
   
_camera.lens.far 550000;

   
_camera.= -2636.898193359375;
   
_camera.1824.3687744140625;
   
_camera.2308.4296875;

   
//addChild(_view);
   
parent.addChild(_view);
  
}

  
public function destroy():void
  {
   parent
.removeChild(_view);
   
_view.dispose();
  
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X