Return to Snippet

Revision: 34306
at October 20, 2010 23:04 by Empreintes


Updated Code
package 
{
	import flash.events.Event;
	
	public class MyClass extends MovieClip
	{
	   public function MyClass()
		{
			super();		
			addEventListener(Event.ADDED_TO_STAGE,added);
// stage is null; try trace(stage.stagewidth); ==> null object
		}
		
		public function added(evt:Event):void{
			removeEventListener(Event.ADDED_TO_STAGE,added);
// stage is not null; try trace(stage.stagewidth); ==> somevalue
			
		}
	}
}

Revision: 34305
at October 20, 2010 22:01 by Empreintes


Initial Code
package 
{
	import flash.events.Event;
	
	public class MyClass extends MovieClip
	{
	   public function MyClass()
		{
			super();		
			addEventListener(Event.ADDED_TO_STAGE,added);
// stage is null; try trace(stage.stagewidth) == null object
		}
		
		public function added(evt:Event):void{
			removeEventListener(Event.ADDED_TO_STAGE,added);
// stage is not null; try trace(stage.stagewidth) == somevalue
			
		}
	}
}

Initial URL


Initial Description


Initial Title
get access to stage object

Initial Tags


Initial Language
ActionScript 3