Return to Snippet

Revision: 49033
at July 14, 2011 07:30 by ryanstewart


Initial Code
package skins
{
	import flash.display.Sprite;
	
	import spark.skins.mobile.ButtonSkin;
	
	public class ComboBoxButtonSkin extends ButtonSkin
	{
		[Bindable]
		[Embed(source="/assets/combobox_button_up.png")]
		private var up:Class;
		
		[Bindable]
		[Embed(source="/assets/combobox_button_down.png")]
		private var down:Class;		
		
		protected var _triangle:Sprite;
		
		public function ComboBoxButtonSkin()
		{
			super();
			
			upBorderSkin = up;
			downBorderSkin = down;

			_triangle = new Sprite();
		}
		
		override protected function createChildren():void
		{
			super.createChildren();
			addChild(_triangle);
			
		}
		
		override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
		{	
			var halfUnscaledHeight:int = Math.round(unscaledHeight/2);
			
			_triangle.graphics.beginFill(0xcee410);			
			_triangle.graphics.moveTo(unscaledWidth-20,halfUnscaledHeight-5);
			_triangle.graphics.lineTo(unscaledWidth-10,halfUnscaledHeight);
			_triangle.graphics.lineTo(unscaledWidth-20,halfUnscaledHeight+5);
			_triangle.graphics.lineTo(unscaledWidth-20,halfUnscaledHeight-5);
			_triangle.graphics.endFill();
		}

	}
}

Initial URL

                                

Initial Description
An example of a Flex Mobile button skin using PNG assets and the Flash drawing API

Initial Title
Flex Mobile Button Skin

Initial Tags
actionscript, flash, Flex

Initial Language
ActionScript 3