dcsimg
A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 21

Thread: Error #1009 when unloading external SWF

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Posts
    26

    Error #1009 when unloading external SWF

    I'm trying to unload an external SWF, and this seems to work, but i get the #1009 error, and i can't figure out why. Please help, thanks!~

    Code:
    stop();
    this.removeEventListener(Event.ENTER_FRAME, gotTicket);
    
    var loader:Loader = new Loader();
    var external:URLRequest = new URLRequest("maya_import.swf");
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loader.load(external);
    
    function loadComplete(event:Event):void {
    	this.remove = event.currentTarget.content;
    	this.addChild(this.remove);
    /*	addChild(loader);
    	MovieClip(loader.content);
    	loader.x=150;
    	loader.y=80;
    	unloadButton.addEventListener(MouseEvent.CLICK, unloader);*/
    	homeButton.addEventListener(MouseEvent.CLICK, unloader2);
    }
    
    function unloader2(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader.unload();
    		loader=this.remove=null;
    		gotoAndStop("start");
    	}
    }
    
    /*function unloader(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(loader);
    		loader.unload();
    		loader=null;
    		gotoAndStop("back");
    		ticketPass=0;
    	}
    }*/

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Internal to Loader's unload method, it calls removeChild to remove its content from its internal displaylist. Since you added that content to another parent, you implicitly removed it from the loader. Later, you call loader.unload(), and will get an error.

    I'm not sure if that's the error you're seeing, but it's definitely in there.

  3. #3
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Well the error i'm getting is; "TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at MethodInfo-1025()"

    Apparently it means that i'm calling on something that doesn't exist or something.

    I've tried all sorts of things, and i think the thing responsible is "removeChild(this.remove);"

    I can comment out the "loader.unload();" and it will still work the same.

    The original code, which successfully unloads an external SWF is:

    Code:
    stop();
    this.removeEventListener(Event.ENTER_FRAME, gotTicket);
    
    var loader:Loader = new Loader();
    var external:URLRequest = new URLRequest("the_loaded_content_2.swf");
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loader.load(external);
    
    function loadComplete(event:Event):void {
    	addChild(loader);
    	MovieClip(loader.content);
    	loader.x=150;
    	loader.y=80;
    	unloadButton.addEventListener(MouseEvent.CLICK, unloader);
    	homeButton.addEventListener(MouseEvent.CLICK, unloader2);
    }
    
    function unloader(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(loader);
    		loader.unload();
    		loader=null;
    		gotoAndStop("back");
    		ticketPass=0;
    	}
    }
    
    function unloader2(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(loader);
    		loader.unload();
    		loader=null;
    		gotoAndStop("start");
    	}
    }
    
    // loadButton -> unloadButton, no more "button"
    However i had to modify it because i was loading a 3d papervision (collada) object thingy into it. And it wouldn't remove it using the code above, even though for any other external SWF it would.

    Thanks.

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I really doubt that the removeChild line is directly responsible. "this" cannot be null, so calling removeChild is fine. Even if this.remove was null you'd get "parameter must be a child of the caller" rather than 1009. If there were a listener for REMOVED_FROM_STAGE or REMOVED on this.remove, that could be executing and causing the error.

    I also can't see any reason why the papervision swf would act any differently from other swfs regarding remove behavior.

    If you aren't already, publish for debug, and see if you can get a method name or a line number for your error.

    There are only 2 lines in the code you posted which can throw 1009, and I don't think it's either one, so it must be in different code.
    Code:
    	this.remove = event.currentTarget.content;
    This could throw a null reference error if event is null. It isn't.

    Code:
    	homeButton.addEventListener(MouseEvent.CLICK, unloader2);
    This could throw a null reference if homeButton doesn't exist. But since you said that other code worked with this same line, I don't think that's it.

  5. #5
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    I don't understand why my original code didn't remove the papervision SWF either (but it didn't, that's why i had to change it). Although the difference in the 2 codes listed above means that the papervision is removed (first one, with then with error).

    We did a bunch of tracing tests, and if we commented out "removeChild(this.remove);" it would trace what he had before it (trace("-------------")) and then stop. If we didn't, it would trace the above, and then continue to send out error #1009, and it will keep doing this until we close the SWF.

  6. #6
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Sounds like there's an enterframe or timer listener in the loaded swf which is throwing the errors. Possibly because it is referencing root or stage, which will become null when the movie is removed.

  7. #7
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Well, i just tested the file again (first bit of code) with "the_loaded_content_2.swf", in the 2nd bit of code and it does the job with no errors, which leads me to think the problem lies in the papervision AS code, or something along those lines..?

    I've attached the files if you could look at them? This is keeeeeelling me :<

    I'm jumping from one method to another, and i seem to be making more progress each time, but i just can't officially fix this problem. :|
    Attached Files Attached Files

  8. #8
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    In maya_import.as, which I assume is the document class of the loaded swf, there is this:
    Code:
    addEventListener(Event.ENTER_FRAME, loop);
    	   
    			function loop(e:Event):void
    			{
    				var xDist:Number = mouseX - stage.stageWidth*0.5;
    				var yDist:Number = mouseY - stage.stageHeight*0.5;
    				collada.rotationY -= xDist*0.08;
    				collada.rotationX += yDist*0.08;
    				renderer.renderScene(scene,camera,viewport);
    			}
    When this instance is removed, stage will become null, throwing the null reference error.

    It also explains why the error message was less than helpful with the MethodInfo-1025 instead of a real method name: because loop is defined inside another method and is local to it.

    Try this as maya_import.as instead:
    Code:
    package { // coding similar to required in "Stage2_Collada_importa_to_PV3D-2.swf"
    	
    	import flash.display.Sprite;
    	import flash.events.Event;
    	import org.papervision3d.view.Viewport3D;
    	import org.papervision3d.scenes.Scene3D;
    	import org.papervision3d.cameras.Camera3D;
    	import org.papervision3d.materials.BitmapFileMaterial;
    	import org.papervision3d.materials.ColorMaterial;
    	import org.papervision3d.materials.WireframeMaterial;
    	import org.papervision3d.materials.utils.MaterialsList;
    	import org.papervision3d.objects.parsers.Collada;
    	import org.papervision3d.render.BasicRenderEngine;
    
    	public class maya_import extends Sprite // change name for file renames
    	{
    		private var viewport: Viewport3D;
    		private var scene: Scene3D;
    		private var camera: Camera3D;
    		private var bitmapFileMaterial: BitmapFileMaterial;
    		private var collada: Collada;
    		private var renderer: BasicRenderEngine;
    		
    		public function maya_import():void // change name for file renames
    		{
    			viewport = new Viewport3D(550,400,false,true);
    			addChild(viewport);
    			scene = new Scene3D();
    			camera = new Camera3D();
    			renderer = new BasicRenderEngine();
    			
    			bitmapFileMaterial = new BitmapFileMaterial("bulge1-pCube2.png");
    			bitmapFileMaterial.doubleSided = true;
    	
    			var materialsList:MaterialsList = new MaterialsList();
    			materialsList.addMaterial(bitmapFileMaterial,"cube_SG");
    			
    			collada = new Collada("cube.DAE", materialsList, .05);
    			scene.addChild(collada);
    			
    			//camera.zoom = 11;
    			camera.zoom = 20;
    			camera.focus = 200;
    			addEventListener(Event.ENTER_FRAME, loop);
                            addEventListener(Event.REMOVED_FROM_STAGE, cleanup);
    	   
    		}
    
    		private function loop(e:Event):void
    		{
    			var xDist:Number = mouseX - stage.stageWidth*0.5;
    			var yDist:Number = mouseY - stage.stageHeight*0.5;
    			collada.rotationY -= xDist*0.08;
    			collada.rotationX += yDist*0.08;
    			renderer.renderScene(scene,camera,viewport);
    		}
    
    		private function cleanup(e:Event):void{
    			removeEventListener(Event.ENTER_FRAME, loop);
    		}
    
    	}
    }

  9. #9
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    If this line here:

    Code:
    addEventListener(Event.ENTER_FRAME, loop);
    Located in the AS of my papervision is the one that is causing the error, because it's hte only EventListener where it has not been removed, how would i go about removing it?

    I'm assuming i need to place the removerEventListener inside my main SWF, but i have no idea how to target that line... i tried;

    Code:
    var loop:Event;
    
    this.removeEventListener(Event.ENTER_FRAME, loop);
    On frame 1 "start" of my main SWF, and no luck, maybe i'm making some sort of basic mistake.

  10. #10
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Oh, i didn't see your post, will try it now, thanks!

  11. #11
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Woah, that was it!

    Your 'cleanup' really did the work! Gosh me and my mate have been scratching our heads over this problem for like 5 hours. We thought it was something to do with the code i posted in my first reply.

    Thanks so much for taking time to look at this and fixing it up, this and my last thread, you're a legend! >D

    There's still heaps to do in this project, so might see you again soon >D

    Or i hope so anyways! But thanks again!!

  12. #12
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Hi again, i'm back for more help. I tried to apply your cleanup function to my main file where a few EventListeners were applied to my buttons, but it seems it doesn't work, probably because i don't understand the theory right, so i didn't apply it right. Here is what it looks like:

    Code:
    stop();
    
    //trace("you are at book1");
    
    this.removeEventListener(Event.ENTER_FRAME, whichBook);
    
    var loader:Loader = new Loader();
    var external:URLRequest = new URLRequest("maya_import.swf");
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loader.load(external);
    
    function loadComplete(event:Event):void {
    	this.remove = event.currentTarget.content;
    	this.addChild(this.remove);
    	loader.y=200;
    	back_btn.addEventListener(MouseEvent.CLICK, unloaderA);
    	addEventListener(MouseEvent.REMOVED_FROM_STAGE, cleanA);
    	home_btn.addEventListener(MouseEvent.CLICK, unloaderB);
    }
    
    function unloaderA(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader=this.remove=null;
    		gotoAndStop("browse");
    	}
    }
    
    function cleanupA(event:MouseEvent):void{
    	back_btn.removeEventListener(Event.CLICK, unloaderA);
    }
    
    function unloaderB(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader=this.remove=null;
    		gotoAndStop("start");
    	}
    }
    And it seems that when i do go back to "start", i can't seem to play the main SWF again, it's like something has disabled it. I have a button at "start" that play(); the SWF again.

  13. #13
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You've got some weird inconsistencies there. For one, it's Event.REMOVED_FROM_STAGE, not MouseEvent.REMOVED_FROM_STAGE. Although, due to the magic of inheritence that actually works. But you are adding a function "cleanA" which is not defined. And cleanupA is defined, but appears to take a MouseEvent instead of an Event (this one doesn't work).

    I haven't evaluated it further to see if fixing those will solve your problems.

  14. #14
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Yah, i just realised that the cleanup you applied worked because something was actually removed from stage, where as here, those buttons are still here. Unless somehow i can use the event of the SWF being removed from stage to remove those EventListeners from the buttons also.

    Here's my next attempt, on my mock up file it seems to work (as in i could play the SWF again), but on my main file it can't.

    MAIN
    Code:
    stop();
    
    //trace("you are at book1");
    
    this.removeEventListener(Event.ENTER_FRAME, whichBook);
    
    var loader:Loader = new Loader();
    var external:URLRequest = new URLRequest("maya_import.swf");
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loader.load(external);
    
    function loadComplete(event:Event):void {
    	this.remove = event.currentTarget.content;
    	this.addChild(this.remove);
    	loader.y=200;
    	back_btn.addEventListener(MouseEvent.CLICK, unloaderA);
    	home_btn.addEventListener(MouseEvent.CLICK, unloaderB);
    }
    
    function unloaderA(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader=this.remove=null;
    		back_btn.removeEventListener(MouseEvent.CLICK, unloaderA);
    		gotoAndStop("browse");
    	}
    }
    
    function unloaderB(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader=this.remove=null;
    		home_btn.removeEventListener(MouseEvent.CLICK, unloaderB);
    		gotoAndStop("start");
    	}
    }
    TEST
    Code:
    stop();
    this.removeEventListener(Event.ENTER_FRAME, gotTicket);
    
    var loader:Loader = new Loader();
    var external:URLRequest = new URLRequest("maya_import.swf"); // "the_loaded_content_2.swf"
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loader.load(external);
    
    function loadComplete(event:Event):void {
    	this.remove = event.currentTarget.content;
    	this.addChild(this.remove);
    	homeButton.addEventListener(MouseEvent.CLICK, unloader2);
    }
    
    function unloader2(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		//loader.unload();
    		loader=this.remove=null;
    		homeButton.removeEventListener(MouseEvent.CLICK, unloader2);
    		gotoAndStop("start");
    	}
    }

  15. #15
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Quote Originally Posted by 5TonsOfFlax View Post
    You've got some weird inconsistencies there. For one, it's Event.REMOVED_FROM_STAGE, not MouseEvent.REMOVED_FROM_STAGE. Although, due to the magic of inheritence that actually works. But you are adding a function "cleanA" which is not defined. And cleanupA is defined, but appears to take a MouseEvent instead of an Event (this one doesn't work).

    I haven't evaluated it further to see if fixing those will solve your problems.
    Yah, those were some silly mistakes, i tried doing what you said here, i thought it looks closer to what its meant to look but still not working, the error i get is:

    Code:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    	at new_tech_b2_5_fla::MainTimeline/new_tech_b2_5_fla::frame1()
    So i'm really betting it's because of those button EvenListeners still existing at frame 1, and they are the cause of my file not being able to play(); again.

    :-(

    Code:
    stop();
    
    //trace("you are at book1");
    
    this.removeEventListener(Event.ENTER_FRAME, whichBook);
    
    var loader:Loader = new Loader();
    var external:URLRequest = new URLRequest("maya_import.swf");
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loader.load(external);
    
    function loadComplete(event:Event):void {
    	this.remove = event.currentTarget.content;
    	this.addChild(this.remove);
    	back_btn.addEventListener(MouseEvent.CLICK, unloaderA);
    	home_btn.addEventListener(MouseEvent.CLICK, unloaderB);
    }
    
    function unloaderA(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader=this.remove=null;
    		//back_btn.removeEventListener(MouseEvent.CLICK, unloaderA);
    		addEventListener(Event.REMOVED_FROM_STAGE, cleanA);
    		gotoAndStop("browse");
    	}
    }
    function unloaderB(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader=this.remove=null;
    		//home_btn.removeEventListener(MouseEvent.CLICK, unloaderB);
    		addEventListener(Event.REMOVED_FROM_STAGE, cleanB);
    		gotoAndStop("start");
    	}
    }
    
    function cleanA(e:Event):void{
    	back_btn.removeEventListener(MouseEvent.CLICK, unloaderA);
    }
    function cleanB(e:Event):void{
    	home_btn.removeEventListener(MouseEvent.CLICK, unloaderB);
    }

  16. #16
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Your clean functions there won't run because they are added to the document class. The document class is never removed from the stage during normal execution. So they're ultimately harmless, but not particularly helpful either.

    Unless you're hitting the buttons again, their click listeners won't fire, so that's not causing your error.

    Can you post the frame1 code?

  17. #17
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Here we are:

    FRAME 1 "start"
    Code:
    stop();
    trace("YAY, BACK HOME!")
    main_txt.text = "Welcome to Borders";
    sub_txt.text = "Pick and option below to begin";
    
    var bookNumber:Number=0;
    var testNumber:Number;
    //trace(bookNumber)
    
    browse_btn.addEventListener(MouseEvent.CLICK, browseRelease) 
    	function browseRelease(evt:MouseEvent):void {
    		play();
    	};
    
    home_btn.addEventListener(MouseEvent.CLICK, homeRelease) 
    	function homeRelease(evt:MouseEvent):void {
    		gotoAndStop("start");
    	};
    FRAME 20 "browse"
    Code:
    stop();
    
    a_cat_btn.addEventListener(MouseEvent.CLICK, aCatRealease) 
    	function aCatRealease(evt:MouseEvent):void {
    		cat_list.gotoAndStop("list_a");
    	};
    	
    b_cat_btn.addEventListener(MouseEvent.CLICK, bCatRealease) 
    	function bCatRealease(evt:MouseEvent):void {
    		cat_list.gotoAndStop("list_b");
    	};
    	
    c_cat_btn.addEventListener(MouseEvent.CLICK, cCatRealease) 
    	function cCatRealease(evt:MouseEvent):void {
    		cat_list.gotoAndStop("list_c");
    	};
    And here's the file...

    It's probably really unconventional, and there's probably much cleaner, simpler, better ways of doing it, but i'm a complete novice so :-(

    But thanks for looking :-D
    Attached Files Attached Files

  18. #18
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Well, the good news is that since you know your error is a null reference on frame 1, and you have posted frame 1, we can find out which item is null.

    Code:
    stop();
    trace("YAY, BACK HOME!");
    trace("main_txt: "+main_txt);
    trace("sub_txt: "+sub_txt);
    trace("browse_btn: "+browse_btn);
    trace("home_btn: "+home_btn);
    
    main_txt.text = "Welcome to Borders";
    sub_txt.text = "Pick and option below to begin";
    
    var bookNumber:Number=0;
    var testNumber:Number;
    //trace(bookNumber)
    
    browse_btn.addEventListener(MouseEvent.CLICK, browseRelease) 
    	function browseRelease(evt:MouseEvent):void {
    		play();
    	};
    
    home_btn.addEventListener(MouseEvent.CLICK, homeRelease) 
    	function homeRelease(evt:MouseEvent):void {
    		gotoAndStop("start");
    	};
    At least one of those traces will come out as null. Then you've got to find out why.

  19. #19
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Wow, i got it working. Unbelievable.

    Frame 1 "start"
    Code:
    stop();
    trace("YAY, BACK HOME!")
    main_txt.text = "Welcome to Borders";
    sub_txt.text = "Pick and option below to begin";
    
    var bookNumber:Number=0;
    //var testNumber:Number;
    //trace(bookNumber)
    
    browse_btn.addEventListener(MouseEvent.CLICK, browseRelease) 
    	function browseRelease(evt:MouseEvent):void {
    		play();
    	};
    
    home_btn.addEventListener(MouseEvent.CLICK, homeRelease) 
    	function homeRelease(evt:MouseEvent):void {
    		if(loader != null){
    			removeChild(this.remove);
    			loader=this.remove=null;
    			gotoAndStop("start");
    		} else {
    			gotoAndStop("start");
    		}
    	};
    Frame 40 "book1"
    Code:
    stop();
    this.removeEventListener(Event.ENTER_FRAME, whichBook);
    //trace("you are at book1");
    
    var loader:Loader = new Loader();
    var external:URLRequest = new URLRequest("maya_import.swf");
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
    loader.load(external);
    
    function loadComplete(event:Event):void {
    	this.remove = event.currentTarget.content;
    	this.addChild(this.remove);
    	back_btn.addEventListener(MouseEvent.CLICK, unloaderA);
    }
    
    function unloaderA(event:MouseEvent):void {
    	if(loader != null){
    		removeChild(this.remove);
    		loader=this.remove=null;
    		gotoAndStop("start");
    	}
    }

  20. #20
    Junior Member
    Join Date
    Mar 2007
    Posts
    26
    Hey again 5Tons, with the AS code you gave me for the 'maya_import.as' above, how do i change the rotation axes to be the center of the object, instead of the edge?

    Right now i just have it rotation, instead of flipping around by the mouse movement. The direction i intend to go is to be able to control the rotation in my main SWF, but i just need to change the axes first, so it's not rotating around the edge.

    Auto-rotation:

    Code:
    		private function loop(e:Event):void
    		{
    			collada.rotationY +=3;
    			renderer.renderScene(scene,camera,viewport);
    		}
    As opposed to rotation based on mouse movement:

    Code:
    		private function loop(e:Event):void
    		{
    			var xDist:Number = mouseX - stage.stageWidth*0.5;
    			var yDist:Number = mouseY - stage.stageHeight*0.5;
    			collada.rotationY -= xDist*0.08;
    			collada.rotationX += yDist*0.08;
    			renderer.renderScene(scene,camera,viewport);
    		}
    Code:
    package { // coding similar to required in "Stage2_Collada_importa_to_PV3D-2.swf"
    	
    	import flash.display.Sprite;
    	import flash.events.Event;
    	import org.papervision3d.view.Viewport3D;
    	import org.papervision3d.scenes.Scene3D;
    	import org.papervision3d.cameras.Camera3D;
    	import org.papervision3d.materials.BitmapFileMaterial;
    	import org.papervision3d.materials.ColorMaterial;
    	import org.papervision3d.materials.WireframeMaterial;
    	import org.papervision3d.materials.utils.MaterialsList;
    	import org.papervision3d.objects.parsers.Collada;
    	import org.papervision3d.render.BasicRenderEngine;
    
    	public class maya_import extends Sprite // change name for file renames
    	{
    		private var viewport: Viewport3D;
    		private var scene: Scene3D;
    		private var camera: Camera3D;
    		private var bitmapFileMaterial: BitmapFileMaterial;
    		private var collada: Collada;
    		private var renderer: BasicRenderEngine;
    		
    		public function maya_import():void // change name for file renames
    		{
    			viewport = new Viewport3D(1000,320,false,true); //(550,400,false,true)
    			addChild(viewport);
    			scene = new Scene3D();
    			camera = new Camera3D();
    			renderer = new BasicRenderEngine();
    			
    			bitmapFileMaterial = new BitmapFileMaterial("bulge1-pCube2.png");
    			bitmapFileMaterial.doubleSided = true;
    	
    			var materialsList:MaterialsList = new MaterialsList();
    			materialsList.addMaterial(bitmapFileMaterial,"cube_SG");
    			
    			collada = new Collada("cube.DAE", materialsList, .05);
    			scene.addChild(collada);
    			
    			//camera.zoom = 11;
    			camera.zoom = 20;
    			camera.focus = 200;
    			addEventListener(Event.ENTER_FRAME, loop);
    			addEventListener(Event.REMOVED_FROM_STAGE, cleanup); 
    		}
    
    		private function loop(e:Event):void
    		{
    			collada.rotationY +=3;
    			renderer.renderScene(scene,camera,viewport);
    		}
    
    		private function cleanup(e:Event):void{
    			removeEventListener(Event.ENTER_FRAME, loop);
    		}
    
    	}
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center