Return to Snippet

Revision: 12350
at March 11, 2009 18:40 by timstepp


Updated Code
public class SpriteWrapper extends UIComponent
{
	public function SpriteWrapper(s:Sprite)
	{
		super();
			
		explicitHeight = s.height;
		explicitWidth = s.width;

		addChild(s);
	}
}

Revision: 12349
at March 11, 2009 18:34 by timstepp


Updated Code
/*
	In order to add a sprite to a flex document, you must wrap it with a UIComponent.
	This class will be used as the wrapper.
	*/
	public class SpriteWrapper extends UIComponent
	{
		public function SpriteWrapper(s:Sprite)
		{
			super();
			
			explicitHeight = s.height;
    		        explicitWidth = s.width;

    		        addChild(s);
		}
		
	}
}

Revision: 12348
at March 11, 2009 18:30 by timstepp


Initial Code
/*
	In order to add a sprite to a flex document, you must wrap it with a UIComponent.
	This class will be used as the wrapper.
	*/
	public class SpriteUIComponent extends UIComponent
	{
		public function SpriteUIComponent(sprite:Sprite)
		{
			super();
			
			explicitHeight = sprite.height;
    		explicitWidth = sprite.width;

    		addChild (sprite);
		}
		
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
AS3 Sprites in Flex

Initial Tags
Flex

Initial Language
ActionScript 3