You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jh...@apache.org on 2012/05/12 01:03:57 UTC

svn commit: r1337407 [1/2] - in /incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate: ./ Library/ Library/bin/ Library/src/ Library/src/org/ Library/src/org/apache/ Library/src/org/apache/components/ Library/src/org/apache/skins/ Sample/ Sample/bin...

Author: jhouser
Date: Fri May 11 23:03:56 2012
New Revision: 1337407

URL: http://svn.apache.org/viewvc?rev=1337407&view=rev
Log:
This is code for an Extension/Alterate version of the ToggleSwitch component that exposes selectedLabel and unselectedLabel properties, so they are easy to change without creating a new skin.

Added:
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/bin/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/bin/ToggleSwitchAlternateLibrary.swc   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/LabelDisplayComponent.as   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/ToggleSwitch.as   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/skins/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/skins/ToggleSwitchSkin.as   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/ReadMe.txt   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample-app.xml
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.apk   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.swf   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/src/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/src/ToggleSwitchAlternateSample-app.xml
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/src/ToggleSwitchAlternateSample.mxml   (with props)
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/src/views/
    incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/src/views/ToggleSwitchAlternateSampleHomeView.mxml   (with props)

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/bin/ToggleSwitchAlternateLibrary.swc
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/bin/ToggleSwitchAlternateLibrary.swc?rev=1337407&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/bin/ToggleSwitchAlternateLibrary.swc
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/LabelDisplayComponent.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/LabelDisplayComponent.as?rev=1337407&view=auto
==============================================================================
--- incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/LabelDisplayComponent.as (added)
+++ incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/LabelDisplayComponent.as Fri May 11 23:03:56 2012
@@ -0,0 +1,145 @@
+package org.apache.components
+{
+	import flash.events.Event;
+	
+	import mx.core.UIComponent;
+	import mx.core.mx_internal;
+	import mx.events.FlexEvent;
+	
+	import spark.components.supportClasses.StyleableTextField;
+	import spark.core.IDisplayText;
+	
+	use namespace mx_internal;
+	
+	// created by JH DotComIt to make this component publicly available so it can be used as a skin part for the ToggleSwitch
+	// originally this was hidden as part of the ToggleSwitch
+	/**
+	 *  @private
+	 *  Component combining two labels to create the effect of text and its drop
+	 *  shadow. The component can be used with advanced style selectors and the
+	 *  styles "color", "textShadowColor", and "textShadowAlpha". Based off of
+	 *  ActionBar.TitleDisplayComponent. These two should eventually be factored.
+	 */
+	public class LabelDisplayComponent extends UIComponent implements IDisplayText
+	{
+		public var shadowYOffset:Number = 0;
+		private var labelChanged:Boolean = false;
+		private var labelDisplay:StyleableTextField;
+		private var labelDisplayShadow:StyleableTextField;
+		private var _text:String;
+		
+		public function LabelDisplayComponent() 
+		{
+			super();
+			_text = "";
+		}
+		
+		override public function get baselinePosition():Number 
+		{
+			return labelDisplay.baselinePosition;
+		}
+		
+		override protected function createChildren():void 
+		{
+			super.createChildren();
+			
+			labelDisplay = StyleableTextField(createInFontContext(StyleableTextField));
+			labelDisplay.styleName = this;
+			labelDisplay.editable = false;
+			labelDisplay.selectable = false;
+			labelDisplay.multiline = false;
+			labelDisplay.wordWrap = false;
+			labelDisplay.addEventListener(FlexEvent.VALUE_COMMIT,
+				labelDisplay_valueCommitHandler);
+			
+			labelDisplayShadow = StyleableTextField(createInFontContext(StyleableTextField));
+			labelDisplayShadow.styleName = this;
+			labelDisplayShadow.colorName = "textShadowColor";
+			labelDisplayShadow.editable = false;
+			labelDisplayShadow.selectable = false;
+			labelDisplayShadow.multiline = false;
+			labelDisplayShadow.wordWrap = false;
+			
+			addChild(labelDisplayShadow);
+			addChild(labelDisplay);
+		}
+		
+		override protected function commitProperties():void 
+		{
+			super.commitProperties();
+			
+			if (labelChanged)
+			{
+				labelDisplay.text = text;
+				invalidateSize();
+				invalidateDisplayList();
+				labelChanged = false;
+			}
+		}
+		
+		override protected function measure():void 
+		{
+			if (labelDisplay.isTruncated)
+				labelDisplay.text = text;
+			labelDisplay.commitStyles();
+			measuredWidth = labelDisplay.getPreferredBoundsWidth();
+			measuredHeight = labelDisplay.getPreferredBoundsHeight();
+		}
+		
+		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
+		{
+			if (labelDisplay.isTruncated)
+				labelDisplay.text = text;
+			labelDisplay.commitStyles();
+			
+			var labelHeight:Number = labelDisplay.getPreferredBoundsHeight();
+			var labelY:Number = (unscaledHeight - labelHeight) / 2;
+			
+			var labelWidth:Number = Math.min(unscaledWidth, labelDisplay.getPreferredBoundsWidth());
+			var labelX:Number = (unscaledWidth - labelWidth) / 2;
+			
+			labelDisplay.setLayoutBoundsSize(labelWidth, labelHeight);
+			labelDisplay.setLayoutBoundsPosition(labelX, labelY);
+			
+			labelDisplay.truncateToFit();
+			
+			labelDisplayShadow.commitStyles();
+			labelDisplayShadow.setLayoutBoundsSize(labelWidth, labelHeight);
+			labelDisplayShadow.setLayoutBoundsPosition(labelX, labelY + shadowYOffset);
+			
+			labelDisplayShadow.alpha = getStyle("textShadowAlpha");
+			
+			// unless the label was truncated, labelDisplayShadow.text was set in
+			// the value commit handler
+			if (labelDisplay.isTruncated)
+				labelDisplayShadow.text = labelDisplay.text;
+		}
+		
+		private function labelDisplay_valueCommitHandler(event:Event):void 
+		{
+			labelDisplayShadow.text = labelDisplay.text;
+		}
+		
+		public function get text():String 
+		{
+			return _text;
+		}
+		
+		public function set text(value:String):void 
+		{
+			_text = value;
+			labelChanged = true;
+			invalidateProperties();
+		}
+		
+		public function get isTruncated():Boolean 
+		{
+			return labelDisplay.isTruncated;
+		}
+		
+		public function showShadow(value:Boolean):void 
+		{
+			labelDisplayShadow.visible = value;
+		}
+	}
+}
\ No newline at end of file

Propchange: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/LabelDisplayComponent.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/ToggleSwitch.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/ToggleSwitch.as?rev=1337407&view=auto
==============================================================================
--- incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/ToggleSwitch.as (added)
+++ incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/ToggleSwitch.as Fri May 11 23:03:56 2012
@@ -0,0 +1,1028 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.components
+{
+	
+	import flash.events.Event;
+	import flash.events.MouseEvent;
+	import flash.geom.Point;
+	import flash.utils.Timer;
+	
+	import mx.core.IVisualElement;
+	import mx.core.UIComponent;
+	import mx.core.mx_internal;
+	import mx.events.FlexEvent;
+	import mx.events.ResizeEvent;
+	
+	import spark.components.supportClasses.ToggleButtonBase;
+	import spark.core.IDisplayText;
+	import spark.effects.Animate;
+	import spark.effects.animation.Animation;
+	import spark.effects.animation.IAnimationTarget;
+	import spark.effects.animation.MotionPath;
+	import spark.effects.animation.SimpleMotionPath;
+	import spark.effects.easing.Linear;
+	import spark.effects.easing.Sine;
+	import spark.utils.MouseEventUtil;
+	
+	use namespace mx_internal;
+	
+	//--------------------------------------
+	//  Styles
+	//--------------------------------------
+	
+	/**
+	 *  Color applied to highlight the selected side of the ToggleSwitch control.
+	 *  
+	 *  @default 0x3F7FBA
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.6
+	 */
+	[Style(name="accentColor", type="uint", format="Color", inherit="yes")]
+	
+	/**
+	 *  The duration, in milleseconds, for an animation of the thumb 
+	 *  as it slides between the selected and unselected sides of the track. 
+	 *  For animations between any two arbitrary positions on the track, 
+	 *  the animation takes a proportionally shorter amount of time.
+	 *  For example, after dragging the thumb half way along the track,
+	 *  the animation for the slide the remainder of the way along the track
+	 *  takes half the duration.
+	 *  
+	 *  @default 125
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.6
+	 */
+	[Style(name="slideDuration", type="Number", format="Time", inherit="no")]
+	
+	/**
+	 *  The alpha of text shadows.
+	 * 
+	 *  @default 0.65
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.6
+	 */
+	[Style(name="textShadowAlpha", type="Number", inherit="yes", minValue="0.0", maxValue="1.0", theme="mobile")]
+	
+	/**
+	 *  The color of text shadows.
+	 * 
+	 *  @default 0x000000
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.6
+	 */
+	[Style(name="textShadowColor", type="uint", format="Color", inherit="yes", theme="mobile")]
+	
+	//--------------------------------------
+	//  Excluded APIs
+	//--------------------------------------
+	
+	[Exclude(name="textAlign", kind="style")]
+	
+	//--------------------------------------
+	//  Other metadata
+	//--------------------------------------
+	
+//	[IconFile("ToggleSwitch.png")]
+	
+	/**
+	 *  The Spark ToggleSwitch control defines a binary switch that 
+	 *  can be in the selected or unselected position. 
+	 *  The ToggleSwitch consists of a thumb skin part that moves between 
+	 *  the two ends of the track skin part, similar to the Spark Slider control.
+	 *
+	 *  <p>The ToggleSwitch control has two positions: selected and unselected. 
+	 *  By default, the label OFF corresponds to the unselected position and ON 
+	 *  corresponds to the selected position.</p>
+	 *
+	 *  <p>The following image shows a ToggleSwitch control. 
+	 *  The labels below the control show the current switch label and position:</p>
+	 *
+	 * <p>
+	 *  <img src="../../images/ts_toggleSwitch_ts.png" alt="Toggle switch" />
+	 * </p>
+	 *
+	 *  <p>Clicking anywhere in the control toggles the position. 
+	 *  You can also slide the thumb along the track to change position. 
+	 *  When you release the thumb, it moves to the position, selected or unselected, 
+	 *  that is closest to the thumb location.</p>
+	 *
+	 *  <p>The ToggleSwitch control uses the following default values for 
+	 *  the unselected and selected labels: OFF (unselected) and ON (selected). 
+	 *  Define a custom skin to change the labels, or to change other visual 
+	 *  characteristics of the control.</p>
+	 *
+	 *  <p>The following skin class, defined as a subclass of 
+	 *  spark.skins.mobile.ToggleSwitchSkin, changes the labels to Yes and No:</p>
+	 *
+	 *  <pre>
+	 *  package skins
+	 *  // components\mobile\skins\MyToggleSwitchSkin.as
+	 *  {
+	 *      import spark.skins.mobile.ToggleSwitchSkin;
+	 *      
+	 *      public class MyToggleSwitchSkin extends ToggleSwitchSkin
+	 *      {
+	 *          public function MyToggleSwitchSkin()
+	 *          {
+	 *              super();
+	 *              // Set properties to define the labels 
+	 *              // for the selected and unselected positions.
+	 *              selectedLabel="Yes";
+	 *              unselectedLabel="No"; 
+	 *          }
+	 *      }
+	 *  }
+	 *  </pre>
+	 *
+	 *  @mxml
+	 *  
+	 *  <p>The <code>&lt;s:ToggleSwitch&gt;</code> tag inherits all of the tag 
+	 *  attributes of its superclass and adds the following tag attributes:</p>
+	 *  
+	 *  <pre>
+	 *  &lt;s:ToggleSwitch
+	 *   <strong>Properties</strong>
+	 *    selected="null"
+	 * 
+	 *   <strong>Common Styles</strong>
+	 *    accentColor="0x3F7FBA"
+	 *    slideDuration="125"
+	 * 
+	 *   <strong>Mobile Styles</strong>
+	 *    textShadowAlpha="0.65"
+	 *    textShadowColor="0x000000"
+	 *  &gt;
+	 *  </pre>
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.6
+	 * 
+	 *  @includeExample examples/ToggleSwitchExample.mxml -noswf
+	 *
+	 *  @see spark.components.ToggleButton
+	 *  @see spark.components.HSlider
+	 *  @see spark.skins.mobile.ToggleSwitchSkin
+	 */
+	public class ToggleSwitch extends ToggleButtonBase
+	{
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Class constants
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 * The amount the mouse can move before we consider the event a drag and not a click
+		 */
+		private static const MOUSE_MOVE_TOLERANCE:Number = 0.15;
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Constructor
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  Constructor. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		public function ToggleSwitch()
+		{
+			super();
+			stickyHighlighting = true;
+			animator = new Animation();
+			addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Variables
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  The last position of the mouse during a drag gesture
+		 */
+		private var lastMouseX:Number = 0;
+		
+		/**
+		 *  Controls the mouse events driving a drag gesture on a
+		 *  ToggleSwitch
+		 */
+		private var mouseDragUtil:MouseDragUtil;
+		
+		/**
+		 *  Whether the mouse has moved during the current drag
+		 *  gesture
+		 */
+		private var mouseMoved:Boolean = false;
+		
+		/**
+		 *  Where the thumb should be after the current animation ends
+		 */
+		private var slideToPosition:Number = 0;
+		
+		/**
+		 *  The point where the current mouse gesture began
+		 */
+		private var stageOffset:Point;
+		
+		/**
+		 *  The thumbPosition when the current mouse gesture began
+		 */
+		private var positionOffset:Number = 0;
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Skin parts
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		[SkinPart(required="false")]
+		
+		/**
+		 *  A skin part that can be dragged along the track. 
+		 *  The <code>thumbPosition</code> property contains the thumb's 
+		 *  current position along the track.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */ 
+		public var thumb:IVisualElement;
+		
+		[SkinPart(required="false")]
+		
+		/**
+		 *  A skin part that defines the bounds along which the thumb can
+		 *  be dragged.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		public var track:IVisualElement;
+		
+		
+		// added by JH DotCoMIt 5/11/2012
+		[SkinPart(required="false")]
+		/**
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion ???
+		 */ 
+		public var selectedLabelDisplay:LabelDisplayComponent;		
+
+		// added by JH DotCoMIt 5/11/2012
+		[SkinPart(required="false")]
+		/**
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion ???
+		 */ 
+		public var unselectedLabelDisplay:LabelDisplayComponent;		
+
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Overridden methods
+		//
+		//----------------------------------------------------------------------------------------------
+		/**
+		 *  @private
+		 */
+		override protected function commitProperties():void{
+			super.commitProperties();
+			if(this.selectedLabelChange){
+				this.selectedLabelChange = false;
+				this.selectedLabelDisplay.text = this.selectedLabel;
+				this.skin.invalidateSize();
+			}
+			if(this.unselectedLabelChange){
+				this.unselectedLabelChange = false;
+				this.unselectedLabelDisplay.text = this.unselectedLabel;
+				this.skin.invalidateSize();
+			}
+		}
+
+		/**
+		 *  @private
+		 */
+		override protected function partAdded(partName:String, instance:Object):void
+		{
+			super.partAdded(partName, instance);
+			if (instance == selectedLabelDisplay)
+			{
+				trace('selected label display');
+				selectedLabelDisplay.text = selectedLabel;
+			} else if (instance == unselectedLabelDisplay){
+				trace('unselected label display');
+				unselectedLabelDisplay.text = unselectedLabel;
+			}
+		}
+
+		//----------------------------------------------------------------------------------------------
+		//
+		//  properties
+		//
+		//----------------------------------------------------------------------------------------------
+
+		
+		private var _selectedLabel :String = "ON";
+		private var selectedLabelChange :Boolean = false;
+
+		[Bindable(event="selectedLabelChange")]
+		/**
+		 * This selectedLabel property is used to define the text on the selected label.
+		 */
+		public function get selectedLabel():String
+		{
+			return _selectedLabel;
+		}
+
+		public function set selectedLabel(value:String):void
+		{
+			if( _selectedLabel !== value)
+			{
+				_selectedLabel = value;
+				selectedLabelChange = true;
+				this.invalidateProperties();
+				dispatchEvent(new Event("selectedLabelChange"));
+			}
+		}
+
+		
+		private var _unselectedLabel :String = "OFF";
+		private var unselectedLabelChange :Boolean = false;
+
+		[Bindable(event="unselectedLabelChange")]
+		/**
+		 * This unselectedLabel property is used to define the text on the unselected label.
+		 */
+		public function get unselectedLabel():String
+		{
+			return _unselectedLabel;
+		}
+
+		public function set unselectedLabel(value:String):void
+		{
+			if( _unselectedLabel !== value)
+			{
+				_unselectedLabel = value;
+				unselectedLabelChange = true;
+				this.invalidateProperties();
+				dispatchEvent(new Event("unselectedLabelChange"));
+			}
+		}
+
+
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Overridden properties
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		//----------------------------------
+		//  selected
+		//----------------------------------
+		/**
+		 *  The current position of the toggle switch.
+		 *  A value of <code>false</code> corresponds to the unselected position,
+		 *  and a value of <code>1</code> corresponds to the selected position.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		override public function set selected(value:Boolean):void 
+		{
+			super.selected = value;
+			var newValue:Number = selectedToPosition(value);
+			slideToPosition = newValue;
+			setThumbPosition(newValue);
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Properties
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		//----------------------------------
+		//  thumbPosition
+		//----------------------------------
+		
+		/**
+		 *  The animation between thumbPosition and slideToPosition, which
+		 *  drives the thumb's position. exposed for testing.
+		 */
+		private var _animator:Animation = null;
+		
+		/**
+		 *  @private
+		 */
+		mx_internal function get animator():Animation 
+		{
+			return _animator;
+		}
+		
+		/**
+		 *  @private
+		 *  additional setup is performed on mouse events, before
+		 *  we start the animation
+		 */
+		mx_internal function set animator(value:Animation): void 
+		{
+			_animator = value;
+		}
+		
+		//----------------------------------
+		//  thumbPosition
+		//----------------------------------
+		
+		/**
+		 *  Storage for thumbPosition
+		 */
+		private var _thumbPosition:Number = 0.0;
+		
+		[Bindable(event="thumbPositionChanged")]
+		
+		/**
+		 *  The thumb's current position along the track.
+		 *  The range of value is between 0.0, unselected,
+		 *  and 1.0, selected.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */ 
+		public function get thumbPosition():Number 
+		{
+			return _thumbPosition;
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Overridden Methods
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  @private
+		 */
+		override protected function updateDisplayList(w:Number, h:Number):void
+		{
+			super.updateDisplayList(w, h);
+			updateSkinDisplayList();
+		}
+		
+		/**
+		 *  @private
+		 */
+		override protected function attachSkin():void 
+		{
+			super.attachSkin();
+			skin.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteHandler);
+			skin.addEventListener(ResizeEvent.RESIZE, resizeHandler);
+		}
+		
+		/**
+		 *  @private
+		 */
+		override protected function addHandlers():void 
+		{
+			super.addHandlers();
+			mouseDragUtil = new MouseDragUtil(this, mouseDownHandler, 
+				mouseDragHandler, thinnedMouseDragHandler, mouseUpHandler);
+			mouseDragUtil.setupHandlers();
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Methods
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  Convert the given thumb position to a selected value
+		 */
+		private function positionToSelected(value:Number):Boolean 
+		{
+			return value > 0.5; 
+		}
+		
+		/**
+		 *  Convert the selected value to a thumb position
+		 */
+		private function selectedToPosition(value:Boolean):Number 
+		{
+			return value ? 1.0 : 0.0;   
+		}
+		
+		/**
+		 *  Specify the new position the toggle switch should animate to.
+		 *  At the end of the animation, selection will update.
+		 */
+		private function moveToPositionAndSelect(newPosition:Number):void 
+		{
+			var slideDuration:Number = getStyle("slideDuration");
+			if (newPosition != thumbPosition && slideDuration > 0)
+			{
+				// Finish any current animation before we start the next one.
+				if (animator.isPlaying)
+					stopAnimation();
+				
+				// holds the final value to be set when animation ends
+				slideToPosition = newPosition;
+				
+				var duration:Number = slideDuration *  
+					(Math.abs(thumbPosition - slideToPosition));
+				animateToPosition(animator, thumbPosition, newPosition, duration);
+			} 
+			else 
+			{
+				// we are either at the destination position, 
+				// or we should update immediately
+				setSelected(positionToSelected(newPosition));
+			}
+		}
+		
+		/** 
+		 *  Specify the new position the toggle switch should animate to
+		 *  during mouse drag.
+		 *  Selection does not update after the animation.
+		 */
+		private function moveToPosition(newPosition:Number):void 
+		{
+			if (newPosition != thumbPosition)
+			{
+				// Finish any current animation before we start the next one.
+				if (animator.isPlaying) 
+					stopAnimation();
+				
+				animateToPosition(animator, thumbPosition, newPosition, MouseDragUtil.MAX_UPDATE_RATE);
+			} 
+		}
+		
+		/**
+		 *  When the selection is changed by user interactions, fire a change event
+		 *  when appropriate.
+		 */
+		private function setSelected(value:Boolean):void
+		{
+			var valueChanged:Boolean = value != selected;
+			selected = value;
+			if (valueChanged)
+				dispatchEvent(new Event(Event.CHANGE));
+		}
+		
+		/**
+		 *  Prepare the animator for use as a single animation to the edge of
+		 *  the track, or for use in a series of animations following mouse
+		 *  drag events.
+		 */
+		private function setupAnimator(animator:Animation, selectAtCompletion:Boolean):void 
+		{
+			stopAnimation();
+			
+			var animTarget:AnimationTargetHelper = animator.animationTarget as AnimationTargetHelper;
+			if (!animTarget)
+				animator.animationTarget = animTarget = new AnimationTargetHelper();
+			
+			animTarget.updateFunction = animationUpdateHandler;
+			animator.motionPaths = new <MotionPath>[null];
+			if (selectAtCompletion) 
+			{
+				animTarget.endFunction = animationEndHandler;
+				animator.easer = new Sine(0);
+			} 
+			else
+			{
+				animTarget.endFunction = null;
+				animator.easer = new Linear();
+			}
+		}
+		
+		/**
+		 *  Animate the thumb moving from startPosition to endPosition
+		 */
+		private function animateToPosition(animator:Animation, startPosition:Number, endPosition:Number, duration:Number):void 
+		{
+			if (animator.isPlaying)
+				stopAnimation();
+			animator.duration = duration;
+			animator.motionPaths[0] = new SimpleMotionPath("position", startPosition, endPosition);
+			animator.play();
+		}
+		
+		/**
+		 *  Set the thumb position and update the component
+		 */
+		private function setThumbPosition(value:Number):void 
+		{
+			if (value == _thumbPosition)
+				return;
+			value = Math.min(value, 1.0);
+			value = Math.max(value, 0.0);
+			if (value == _thumbPosition)
+				return;
+			_thumbPosition = value;
+			invalidateDisplayList();
+			if (hasEventListener("thumbPositionChanged"))
+				dispatchEvent(new Event("thumbPositionChanged"));
+		}
+		
+		/**
+		 *  Stops a running animation prematurely
+		 */
+		private function stopAnimation():void
+		{
+			animator.stop();
+		}
+		
+		/**
+		 *  Position the thumb along the track based on thumbPosition.
+		 *  The usable width of the track is equal to the track's layout width
+		 *  less the thumb's width, as the thumb should always be contained by
+		 *  the track.
+		 */
+		private function updateSkinDisplayList():void 
+		{
+			if (!thumb || !track || !thumb.parent || !track.parent)
+				return;
+			
+			// Perform calculations in global space, since track & thumb may have different coordinate spaces
+			var globalThumbXOffset:Number = getGlobalTrackRange() *  thumbPosition;
+			var globalThumbPos:Point = track.parent.localToGlobal(new Point(track.getLayoutBoundsX()));
+			globalThumbPos.x += globalThumbXOffset;
+			
+			var localThumbPos:Point = thumb.parent.globalToLocal(globalThumbPos);
+			thumb.setLayoutBoundsPosition(Math.round(localThumbPos.x), thumb.getLayoutBoundsY());
+		}
+		
+		/**
+		 *  Determine the global range of motion for the thumb on the track
+		 */
+		private function getGlobalTrackRange():Number 
+		{
+			var globalTrackDims:Point = track.parent.localToGlobal(new Point(track.getLayoutBoundsWidth()));
+			var globalThumbDims:Point = thumb.parent.localToGlobal(new Point(thumb.getLayoutBoundsWidth()));
+			return globalTrackDims.x - globalThumbDims.x;
+		}
+		
+		/**
+		 *  Is an animation running that will result in setting selected
+		 */
+		private function isSelectionAnimationRunning():Boolean 
+		{
+			return animator && animator.isPlaying && (AnimationTargetHelper(animator.animationTarget).endFunction != null);
+		}
+		
+		/**
+		 *  Adjust the skin when it updates
+		 */
+		private function updateCompleteHandler(event:FlexEvent):void 
+		{
+			updateSkinDisplayList();
+			skin.removeEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteHandler);
+		}
+		
+		/**
+		 *  Adjust the skin after it has finished resizing
+		 */
+		private function resizeHandler(event:ResizeEvent):void
+		{
+			skin.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCompleteHandler);
+		}
+		
+		/**
+		 *  Adjust the thumb when the component is added
+		 */
+		private function addedToStageHandler(event:Event):void 
+		{
+			updateSkinDisplayList();
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Overridden Event handlers
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  @private
+		 *  ignore mouse events while animating
+		 */
+		override protected function mouseEventHandler(event:Event):void 
+		{
+			if (isSelectionAnimationRunning())
+				return;
+			super.mouseEventHandler(event);
+		}
+		
+		/**
+		 *  @private
+		 *  If the thumb has moved, snap the it to the closest
+		 *  end of the track. If not, move it to the opposite end
+		 *  of where it is or was animating to.
+		 */
+		override protected function buttonReleased():void 
+		{
+			if (isSelectionAnimationRunning())
+				return;
+			setupAnimator(animator, true);
+			
+			var newPosition:Number;
+			
+			if (mouseMoved)
+				// the result of a drag is the nearest current position
+				newPosition = selectedToPosition(thumbPosition >= .5);
+			else
+				// the result of a click is the opposite side of the current
+				// destination (not always the current value, as when animating)
+				newPosition = selectedToPosition(slideToPosition < .5);
+			
+			moveToPositionAndSelect(newPosition);
+			mouseMoved = false;
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Event handlers
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  These mouse handlers are responsible for ToggleSwitch's dragging
+		 *  behavior. The toggling behavior is handled by buttonReleased and
+		 *  ToggleButtonBase. 
+		 */
+		private function mouseDownHandler(event:MouseEvent):void 
+		{
+			if (isSelectionAnimationRunning())
+				return;
+			setupAnimator(animator, false);
+			mouseMoved = false;
+			stageOffset = new Point(event.stageX, event.stageY);
+			positionOffset = thumbPosition;
+		}
+		
+		/**
+		 *  Cache the most recent mouse position for use when the thinning code
+		 *  is called
+		 */
+		private function mouseDragHandler(event:MouseEvent):void 
+		{
+			lastMouseX = event.stageX;
+		}
+		
+		/**
+		 *  Move the thumb to line up with the current mouse position
+		 *  The mouse needs to move at least MOUSE_MOVE_TOLERANCE before
+		 *  the thumb begins to move.
+		 *  On touch devices, the mouse position fired near mouse up can
+		 *  be unreliable.
+		 */
+		private function thinnedMouseDragHandler(event:Event):void 
+		{
+			if (mouseCaptured && track && thumb) 
+			{
+				var deltaX:Number = (lastMouseX - stageOffset.x) / getGlobalTrackRange();
+				// don't set mouseMoved unless the mouse position has changed enough
+				// don't rely on the last drag handler fired as part of mouse up
+				if (!mouseMoved && Math.abs(deltaX) > MOUSE_MOVE_TOLERANCE &&
+					event.type != MouseEvent.MOUSE_UP) 
+					mouseMoved = true;
+				// only move if we have passed the threshold
+				// dampen the movement by that threshold
+				if (mouseMoved)
+				{
+					moveToPosition(positionOffset + deltaX + 
+						(selected ? MOUSE_MOVE_TOLERANCE : -MOUSE_MOVE_TOLERANCE));
+				}
+			}
+		}
+		
+		/**
+		 *  We need to force a buttonRelease when mouse up occurs outside of
+		 *  the component, and the button has already released mouseCaptured
+		 */
+		private function mouseUpHandler(event:Event):void 
+		{
+			// mouseCaptured unset from ButtonBase.systemManager_mouseUpHandler
+			if (event.target != this && !mouseCaptured)
+				buttonReleased();
+		}
+		
+		/**
+		 *  Handles events from the Animation that runs the animated slide.
+		 *  We just update thumbPosition with the current animated value
+		 */
+		private function animationUpdateHandler(animation:Animation):void
+		{
+			setThumbPosition(animation.currentValue["position"]);
+		}
+		
+		/**
+		 *  Handles end event from the Animation that runs the animated slide.
+		 *  We update selected once the animation ends
+		 */
+		private function animationEndHandler(animation:Animation):void
+		{
+			setSelected(positionToSelected(slideToPosition));
+		}
+		
+	}
+	
+}
+
+//----------------------------------------------------------------------------------------------
+//
+//  Out-of-package Helper Classes
+//
+//----------------------------------------------------------------------------------------------
+
+import spark.effects.animation.Animation;
+import spark.effects.animation.IAnimationTarget;
+
+/**
+ *  @private
+ *  simple helper implementation of IAnimationTarget
+ */
+class AnimationTargetHelper implements IAnimationTarget 
+{
+	public var updateFunction:Function;
+	public var endFunction:Function;
+	
+	public function AnimationTargetHelper(updateFunction:Function = null, endFunction:Function = null)
+	{
+		this.updateFunction = updateFunction;
+		this.endFunction = endFunction;
+	}
+	
+	public function animationStart(animation:Animation):void
+	{
+	}
+	
+	public function animationEnd(animation:Animation):void
+	{
+		if (endFunction != null)
+			endFunction(animation);
+	}
+	
+	public function animationStop(animation:Animation):void
+	{
+	}
+	
+	public function animationRepeat(animation:Animation):void
+	{
+	}
+	
+	public function animationUpdate(animation:Animation):void
+	{
+		if (updateFunction != null)
+			updateFunction(animation);
+	}
+}
+
+import spark.utils.MouseEventUtil;
+import flash.events.MouseEvent;
+import flash.utils.Timer;
+import mx.core.UIComponent;
+import flash.events.TimerEvent;
+import flash.events.Event;
+
+/**
+ *  @private
+ *  A helper class responsible for handling mouse drag gestures,
+ *  and ensuring we do not update on every mouse move event
+ */
+class MouseDragUtil 
+{
+	private var mouseDownHandler:Function;
+	private var mouseMoveEveryHandler:Function;
+	private var mouseMoveThinnedHandler:Function;
+	private var mouseUpHandler:Function;
+	private var target:UIComponent;
+	
+	private var dragPending:Boolean;
+	private var dragTimer:Timer;
+	
+	public static const MAX_UPDATE_RATE:Number = 30;
+	
+	public function MouseDragUtil(target:UIComponent, handleDown:Function, handleMove:Function,
+								  handleThinnedMove:Function, handleUp:Function) 
+	{
+		this.target = target;
+		this.mouseDownHandler = handleDown;
+		this.mouseMoveEveryHandler = handleMove;
+		this.mouseMoveThinnedHandler = handleThinnedMove;
+		this.mouseUpHandler = handleUp;
+	}
+	
+	public function setupHandlers():void 
+	{
+		MouseEventUtil.addDownDragUpListeners(target, mouseDownHandlerWrapper, mouseDragHandlerWrapper, 
+			mouseUpHandlerWrapper);
+	}
+	
+	public function removeHandlers():void 
+	{
+		MouseEventUtil.removeDownDragUpListeners(target, mouseDownHandlerWrapper, mouseDragHandlerWrapper,
+			mouseUpHandlerWrapper);
+		if (dragTimer) {
+			dragTimer.stop();
+			dragTimer.removeEventListener(TimerEvent.TIMER, dragTimerHandler);
+			dragTimer = null;
+		}
+	}
+	
+	private function mouseDownHandlerWrapper(event:MouseEvent):void 
+	{
+		mouseDownHandler(event);
+	}
+	
+	private function mouseDragHandlerWrapper(event:MouseEvent):void 
+	{
+		mouseMoveEveryHandler(event);
+		
+		if (!dragTimer) 
+		{
+			dragTimer = new Timer(1000 / MAX_UPDATE_RATE, 0);
+			dragTimer.addEventListener(TimerEvent.TIMER, dragTimerHandler);
+		}
+		
+		if (!dragTimer.running) 
+		{
+			mouseMoveThinnedHandler(event);
+			dragPending = false;
+			dragTimer.start();
+		} 
+		else 
+		{
+			dragPending = true;
+		}
+	}
+	
+	private function dragTimerHandler(event:TimerEvent):void 
+	{
+		if (dragPending) 
+		{
+			mouseMoveThinnedHandler(event);
+			dragPending = false;
+		} 
+		else 
+		{
+			dragTimer.stop();
+		}
+	}
+	
+	private function mouseUpHandlerWrapper(event:Event):void 
+	{
+		if (dragTimer) 
+		{
+			if (dragPending) 
+			{
+				mouseMoveThinnedHandler(event);
+				dragPending = false;
+			}
+			dragTimer.stop();
+			dragTimer.removeEventListener(TimerEvent.TIMER, dragTimerHandler);
+			dragTimer = null;
+		}
+		
+		mouseUpHandler(event);
+	}
+}
\ No newline at end of file

Propchange: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/components/ToggleSwitch.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/skins/ToggleSwitchSkin.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/skins/ToggleSwitchSkin.as?rev=1337407&view=auto
==============================================================================
--- incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/skins/ToggleSwitchSkin.as (added)
+++ incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/skins/ToggleSwitchSkin.as Fri May 11 23:03:56 2012
@@ -0,0 +1,737 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.skins
+{
+	import flash.display.BlendMode;
+	import flash.display.DisplayObject;
+	import flash.display.GradientType;
+	import flash.display.Graphics;
+	import flash.display.Sprite;
+	import flash.events.Event;
+	
+	import mx.core.DPIClassification;
+	import mx.core.IVisualElement;
+	import mx.core.UIComponent;
+	import mx.core.mx_internal;
+	import mx.utils.ColorUtil;
+	
+	import org.apache.components.LabelDisplayComponent;
+	import org.apache.components.ToggleSwitch;
+	
+	import spark.components.supportClasses.StyleableTextField;
+	import spark.core.SpriteVisualElement;
+	import spark.skins.mobile.supportClasses.MobileSkin;
+	import spark.skins.mobile160.assets.ToggleSwitch_contentShadow;
+	import spark.skins.mobile240.assets.ToggleSwitch_contentShadow;
+	import spark.skins.mobile320.assets.ToggleSwitch_contentShadow;
+	
+	use namespace mx_internal;
+	
+	/**
+	 *  ActionScript-based skin for the ToggleSwitch control. 
+	 *  The colors of the component can
+	 *  be customized using styles. This class is responsible for most of the
+	 *  graphics drawing, with some additional fxg assets.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion AIR 3
+	 *  @productversion Flex 4.6
+	 *
+	 *  @see spark.components.ToggleSwitch 
+	 */
+	public class ToggleSwitchSkin extends MobileSkin
+	{
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Constructor
+		//
+		//----------------------------------------------------------------------------------------------
+		/**
+		 *  Constructor.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 **/
+		public function ToggleSwitchSkin()
+		{
+			super();
+			
+			switch(applicationDPI) 
+			{
+				case DPIClassification.DPI_320:
+				{
+					layoutThumbWidth = 94;
+					layoutThumbHeight = 56;
+					layoutStrokeWeight = 2;
+					layoutBorderSize = 2;
+					layoutTextShadowOffset = -2;
+					layoutInnerPadding = 14;
+					layoutOuterPadding = 22;
+					slidingContentOverlayClass = spark.skins.mobile320.assets.ToggleSwitch_contentShadow;
+					break;
+				}
+				case DPIClassification.DPI_240:
+				{
+					layoutThumbWidth = 70;
+					layoutThumbHeight = 42;
+					layoutStrokeWeight = 2;
+					layoutBorderSize = 1;
+					layoutTextShadowOffset = -1;
+					layoutInnerPadding = 10;
+					layoutOuterPadding = 17;
+					slidingContentOverlayClass = spark.skins.mobile240.assets.ToggleSwitch_contentShadow;
+					break;
+				}
+				case DPIClassification.DPI_160:
+				default:
+				{
+					layoutThumbWidth = 47;
+					layoutThumbHeight = 28;
+					layoutStrokeWeight = 1;
+					layoutBorderSize = 1;
+					layoutTextShadowOffset = -1;
+					layoutInnerPadding = 7;
+					layoutOuterPadding = 11;
+					slidingContentOverlayClass = spark.skins.mobile160.assets.ToggleSwitch_contentShadow;
+					break;
+				}
+			}
+			
+			layoutCornerEllipseSize = layoutThumbHeight;
+			selectedLabel = resourceManager.getString("components","toggleSwitchSelectedLabel");
+			unselectedLabel =  resourceManager.getString("components","toggleSwitchUnselectedLabel");
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Variables
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  The width to draw the thumb skin part.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutThumbWidth:Number;
+		
+		/**
+		 *  The height to draw the thumb skin part.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutThumbHeight:Number;
+		
+		/**
+		 *  The corner radius of the thumb and track.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutCornerEllipseSize:Number;
+		
+		/**
+		 *  The stroke weight outlining the graphics of the skin.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutStrokeWeight:Number;
+		
+		/**
+		 *  The size of the border surrounding the component.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutBorderSize:Number;
+		
+		/**
+		 *  The padding between the labels and the thumb.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutInnerPadding:Number;
+		
+		/**
+		 *  The padding between the labels and the edge of the track.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutOuterPadding:Number;
+		
+		/**
+		 *  The offset between a label and its shadow.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected var layoutTextShadowOffset:Number;
+		
+		/**
+		 *  The label for the selected side of the component.
+		 *  Exposed for styling purposes only.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		public var selectedLabelDisplay:LabelDisplayComponent;
+		
+		/**
+		 *  The label for the unselected side of the component.
+		 *  Exposed for styling purposes only.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		public var unselectedLabelDisplay:LabelDisplayComponent;
+		
+		/**
+		 *  The content clipped by the track that slides to match the thumb's
+		 *  position. 
+		 *  Contents include a background and the (un)selected labels.
+		 *  The sliding content is stacked, from back to front, as background,
+		 *  shadow, foreground.
+		 */
+		private var slidingContentBackground:SpriteVisualElement;
+		private var slidingContentForeground:UIComponent;
+		private var slidingContentOverlayClass:Class;
+		private var slidingContentOverlay:DisplayObject;
+		
+		/**
+		 *  The contents inside the skin, not including the outline
+		 *  stroke
+		 */
+		private var contents:UIComponent;
+		
+		/**
+		 *  The thumb erase overlay erases pixels behind the thumb. The thumb
+		 *  content contains the thumb graphics, and sits above the overlay.
+		 */
+		private var thumbEraseOverlay:Sprite;
+		private var thumbContent:Sprite;
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Skin parts
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  The thumb skin part.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		public var thumb:IVisualElement;
+		
+		/**
+		 *  The track skin part.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		public var track:IVisualElement;
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Overridden properties
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		//----------------------------------
+		//  currentState
+		//----------------------------------
+		/**
+		 *  @private
+		 */
+		override public function set currentState(value:String):void 
+		{
+			var isDown:Boolean = currentState && currentState.indexOf("down") >=0;
+			
+			super.currentState = value;
+			
+			if (isDown != currentState.indexOf("down") >= 0) 
+			{
+				invalidateDisplayList();
+			}
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Properties
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		//----------------------------------
+		//  hostComponent
+		//----------------------------------
+		// I had to specify the ToggleSwitch type here and make sure it was my "Custom" ToggleSwitch as opposed to the 
+		// spark.components.ToggleSwitch
+		
+		private var _hostComponent:ToggleSwitch;
+		
+		/**
+		 * @copy spark.skins.spark.ApplicationSkin#hostComponent
+		 */
+		public function get hostComponent():ToggleSwitch 
+		{
+			return _hostComponent;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function set hostComponent(value:ToggleSwitch):void 
+		{
+			if (_hostComponent)
+				_hostComponent.removeEventListener("thumbPositionChanged", thumbPositionChanged_handler);
+			_hostComponent = value;
+			if (_hostComponent)
+				_hostComponent.addEventListener("thumbPositionChanged", thumbPositionChanged_handler);
+		}
+		
+		//----------------------------------
+		//  selectedLabel
+		//----------------------------------
+		
+		private var _selectedLabel:String;
+		/**
+		 *  The text of the label showing when the component is selected.
+		 *  Subclasses can set or override this property to customize the selected label.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected function get selectedLabel():String 
+		{
+			return _selectedLabel;
+		}
+		
+		protected function set selectedLabel(value:String):void
+		{
+			_selectedLabel = value;
+		}
+		
+		//----------------------------------
+		//  unselectedLabel
+		//----------------------------------
+		
+		private var _unselectedLabel:String;
+		/**
+		 *  The text of the label showing when the component is not selected.
+		 *  Subclasses can set or override this property to customize the unselected label.
+		 * 
+		 *  @langversion 3.0
+		 *  @playerversion AIR 3
+		 *  @productversion Flex 4.6
+		 */
+		protected function get unselectedLabel():String 
+		{
+			return _unselectedLabel;
+		}
+		
+		protected function set unselectedLabel(value:String):void
+		{
+			_unselectedLabel = value;
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Overridden Methods
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  @private
+		 *  Redraw the graphics of the skin as necessary
+		 */
+		override protected function drawBackground(unscaledWidth:Number, unscaledHeight:Number):void
+		{
+			super.drawBackground(unscaledWidth, unscaledHeight);
+			
+			// calculate skin dimensions - outer stroke
+			var calculatedContentWidth:Number = Math.max(unscaledWidth - 2 * layoutBorderSize, 
+				getElementPreferredWidth(thumb));
+			var calculatedContentHeight:Number = Math.max(unscaledHeight - 2 * layoutBorderSize, 
+				getElementPreferredHeight(thumb));
+			
+			drawSlidingContent(calculatedContentWidth, calculatedContentHeight);
+			drawTrack(calculatedContentWidth, calculatedContentHeight);
+			drawThumb(calculatedContentWidth, calculatedContentHeight);
+			drawMask(calculatedContentWidth, calculatedContentHeight);
+			
+			// simulate outer stroke using a larger filled rounded rect
+			graphics.beginFill(0xffffff, 0.3);
+			graphics.drawRoundRect(0, (calculatedContentHeight - layoutThumbHeight) / 2, 
+				calculatedContentWidth + 2 * layoutBorderSize, 
+				layoutThumbHeight + 2 * layoutBorderSize, 
+				layoutCornerEllipseSize + layoutBorderSize);
+			graphics.endFill();
+		}
+		
+		/**
+		 *  @private
+		 *  Resize and reposition as necessary
+		 */
+		override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void 
+		{
+			super.layoutContents(unscaledWidth, unscaledHeight);
+			
+			// calculate skin dimensions - outer stroke
+			var calculatedContentWidth:Number = Math.max(unscaledWidth - 2 * layoutBorderSize, 
+				getElementPreferredWidth(thumb));
+			var calculatedContentHeight:Number = Math.max(unscaledHeight - 2 * layoutBorderSize, 
+				getElementPreferredHeight(thumb));
+			
+			setElementSize(contents, calculatedContentWidth, layoutThumbHeight);
+			setElementPosition(contents, layoutBorderSize, 
+				layoutBorderSize + (calculatedContentHeight - layoutThumbHeight) / 2);
+			
+			layoutTrack(calculatedContentWidth, layoutThumbHeight);
+			layoutThumb(calculatedContentWidth, layoutThumbHeight);
+			// Sliding content must be positioned after the track & thumb have been sized
+			layoutSlidingContent(calculatedContentWidth, layoutThumbHeight);
+			layoutMask(calculatedContentWidth, layoutThumbHeight);
+		}
+		
+		/**
+		 *  @private
+		 */
+		override protected function measure():void 
+		{
+			// The skin must be at least as large as the thumb + outer stroke
+			measuredMinWidth = layoutThumbWidth + 2 * layoutBorderSize;
+			measuredMinHeight = layoutThumbWidth + 2 * layoutBorderSize;
+			
+			// The preferred size will display all label text
+			var labelWidth:Number = Math.max(getElementPreferredWidth(selectedLabelDisplay), 
+				getElementPreferredWidth(unselectedLabelDisplay));
+			
+			measuredWidth = layoutThumbWidth + labelWidth + layoutInnerPadding + 
+				layoutOuterPadding + 2 * layoutBorderSize;
+			measuredHeight = layoutThumbHeight + 2 * layoutBorderSize;
+		}
+		
+		/**
+		 *  @private
+		 */
+		override protected function commitCurrentState():void 
+		{
+			if (currentState && currentState.indexOf("disabled") >= 0) 
+			{ 
+				alpha = 0.5;
+				selectedLabelDisplay.showShadow(false);
+				unselectedLabelDisplay.showShadow(false);
+			}
+			else
+			{
+				alpha = 1.0;
+				selectedLabelDisplay.showShadow(true);
+				unselectedLabelDisplay.showShadow(true);
+			}
+		}
+		
+		/**
+		 *  @private
+		 */
+		override protected function createChildren():void 
+		{
+			super.createChildren();
+			
+			contents = new UIComponent();
+			contents.blendMode = BlendMode.LAYER;
+			addChild(contents);
+			
+			// SlidingContent: background, overlay, labels
+			slidingContentBackground = new SpriteVisualElement();
+			contents.addChild(slidingContentBackground);
+			
+			slidingContentOverlay = new slidingContentOverlayClass();
+			contents.addChild(slidingContentOverlay);
+			
+			slidingContentForeground = new UIComponent();
+			contents.addChild(slidingContentForeground);
+			
+			selectedLabelDisplay = new LabelDisplayComponent();
+			selectedLabelDisplay.id = "selectedLabelDisplay";
+			selectedLabelDisplay.text = selectedLabel;
+			selectedLabelDisplay.shadowYOffset = layoutTextShadowOffset;
+			slidingContentForeground.addChild(selectedLabelDisplay);
+			
+			unselectedLabelDisplay = new LabelDisplayComponent();
+			unselectedLabelDisplay.id = "unselectedLabelDisplay";
+			unselectedLabelDisplay.text = unselectedLabel;
+			unselectedLabelDisplay.shadowYOffset = layoutTextShadowOffset;
+			slidingContentForeground.addChild(unselectedLabelDisplay);
+			
+			// Track
+			track = new SpriteVisualElement();
+			contents.addChild(SpriteVisualElement(track));
+			
+			// Thumb
+			thumb = new SpriteVisualElement();
+			contents.addChild(SpriteVisualElement(thumb));
+			
+			thumbEraseOverlay = new Sprite();
+			thumbEraseOverlay.blendMode = BlendMode.ERASE;
+			SpriteVisualElement(thumb).addChild(thumbEraseOverlay);
+			thumbContent = new Sprite();
+			SpriteVisualElement(thumb).addChild(thumbContent);
+			
+			// Content clipping mask
+			var contentMask:Sprite = new SpriteVisualElement();
+			contents.mask = contentMask;
+			contents.addChild(contentMask);
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Methods
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  Draw the sliding content background
+		 *  SlidingContent's x origin matches the thumb's x origin, meaning some of
+		 *  the background is drawn to the left, and some to the right.
+		 */
+		private function drawSlidingContent(skinWidth:Number, skinHeight:Number):void 
+		{
+			slidingContentBackground.graphics.clear();
+			
+			// selected side of the sliding content
+			slidingContentBackground.graphics.beginFill(getStyle("accentColor"));
+			slidingContentBackground.graphics.drawRect(layoutThumbWidth - skinWidth, 0, skinWidth - layoutThumbWidth / 2, 
+				layoutThumbHeight);
+			slidingContentBackground.graphics.endFill();
+			
+			// unselected side of the sliding content
+			slidingContentBackground.graphics.beginFill(ColorUtil.adjustBrightness2(getStyle("chromeColor"), -25));
+			slidingContentBackground.graphics.drawRect(layoutThumbWidth / 2, 0, skinWidth - layoutThumbWidth / 2, 
+				layoutThumbHeight);
+			slidingContentBackground.graphics.endFill();
+		}
+		
+		/**
+		 *  Lay out SlidingContent and its children. Because we only need the x,y
+		 *  coordinate of SlidingContent, we can ignore its size.
+		 *  The origin of SlidingContent overlaps the origin of the thumb, and the
+		 *  positioning is handled by thumbPositionChanged_handler.
+		 */
+		private function layoutSlidingContent(skinWidth:Number, skinHeight:Number):void 
+		{
+			var visibleTrackWidth:Number = skinWidth - layoutThumbWidth;
+			var labelWidth:Number = visibleTrackWidth - layoutInnerPadding - layoutOuterPadding;
+			
+			setElementSize(selectedLabelDisplay, labelWidth, layoutThumbHeight);
+			setElementPosition(selectedLabelDisplay, -visibleTrackWidth + layoutOuterPadding, 0);
+			
+			setElementSize(unselectedLabelDisplay, labelWidth, layoutThumbHeight);
+			setElementPosition(unselectedLabelDisplay, layoutThumbWidth + layoutInnerPadding, 0);
+			
+			setElementSize(slidingContentOverlay, skinWidth, layoutThumbHeight);
+			setElementPosition(slidingContentOverlay, 0, (skinHeight - layoutThumbHeight) / 2);
+			
+			moveSlidingContent();
+		}
+		
+		/**
+		 *  Draw the track and its shadow
+		 */
+		private function drawTrack(skinWidth:Number, skinHeight:Number):void 
+		{
+			var graphics:Graphics = SpriteVisualElement(track).graphics;
+			graphics.clear();
+			graphics.lineStyle(layoutStrokeWeight, 0, .3);
+			graphics.drawRoundRect(layoutStrokeWeight / 2, layoutStrokeWeight / 2, 
+				skinWidth - layoutStrokeWeight, 
+				(layoutThumbHeight - layoutStrokeWeight), (layoutCornerEllipseSize - layoutStrokeWeight / 2));
+			graphics.lineStyle();
+		}
+		
+		/**
+		 * Resize and reposition the track
+		 */
+		private function layoutTrack(skinWidth:Number, skinHeight:Number):void 
+		{
+			setElementSize(track, skinWidth, layoutThumbHeight);
+			setElementPosition(track, 0, (skinHeight - layoutThumbHeight) / 2);
+		}
+		
+		/**
+		 * Draw the thumb. The thumb has an outer border, inner gradient, and
+		 * inner highlight stroke.
+		 */
+		private function drawThumb(skinWidth:Number, skinHeight:Number):void 
+		{
+			var graphics:Graphics = thumbContent.graphics;
+			var colors:Array = [];
+			var alphas:Array = [];
+			var ratios:Array = [];
+			var baseColor:Number = getStyle("chromeColor");
+			
+			if (currentState && currentState.indexOf("down") >= 0)
+				baseColor = ColorUtil.adjustBrightness(baseColor, -60);
+			
+			graphics.clear();
+			
+			// Thumb outline
+			colors[0] = ColorUtil.adjustBrightness2(baseColor, -70);
+			colors[1] = ColorUtil.adjustBrightness2(baseColor, -55);
+			
+			alphas[0] = 1;
+			alphas[1] = 1;
+			
+			ratios[0] = 0;
+			ratios[1] = 255;
+			
+			colorMatrix.createGradientBox(layoutThumbWidth, layoutThumbHeight, Math.PI / 2);
+			graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, colorMatrix);
+			graphics.drawRoundRect(0, 0, layoutThumbWidth, layoutThumbHeight, layoutCornerEllipseSize);
+			graphics.endFill();
+			
+			// Base gradient fill, one stroke weight inside outline
+			colors[0] = ColorUtil.adjustBrightness2(baseColor, -30);
+			colors[1] = baseColor;
+			colors[2] = ColorUtil.adjustBrightness2(baseColor, 20);
+			
+			alphas[2] = 1;
+			
+			ratios[0] = 0;
+			ratios[1] = .7 * 255;
+			ratios[2] = 255;
+			
+			colorMatrix.createGradientBox(layoutThumbWidth - layoutStrokeWeight * 2, 
+				layoutThumbHeight - layoutStrokeWeight * 2, Math.PI / 2);
+			graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, ratios, colorMatrix);
+			graphics.drawRoundRect(layoutStrokeWeight, layoutStrokeWeight, 
+				layoutThumbWidth - layoutStrokeWeight * 2, 
+				layoutThumbHeight - layoutStrokeWeight * 2, layoutCornerEllipseSize - layoutStrokeWeight * 2);
+			graphics.endFill();
+			
+			// Thumb highlight, one stroke weight inside outline
+			colors[0] = 0xffffff;
+			colors[1] = 0xffffff;
+			colors[2] = 0x0;
+			
+			alphas[0] = .9;
+			alphas[1] = 0;
+			alphas[2] = .2;
+			
+			ratios[0] = .33 * 255;
+			ratios[1] = .5 * 255;
+			ratios[2] = 255;
+			
+			colorMatrix.createGradientBox(layoutThumbWidth - layoutStrokeWeight * 3, 
+				layoutThumbHeight - layoutStrokeWeight * 3, Math.PI / 2);
+			graphics.lineStyle(layoutStrokeWeight);
+			graphics.lineGradientStyle(GradientType.LINEAR, colors, alphas, ratios, colorMatrix);
+			graphics.drawRoundRect(layoutStrokeWeight * 1.5, layoutStrokeWeight * 1.5, 
+				layoutThumbWidth - layoutStrokeWeight * 3, layoutThumbHeight - layoutStrokeWeight * 3, 
+				layoutCornerEllipseSize - layoutStrokeWeight * 3);
+			graphics.lineStyle();
+			
+			// Redraw the erase overlay as a silhouette of the thumb
+			thumbEraseOverlay.graphics.clear();
+			thumbEraseOverlay.graphics.beginFill(0);
+			thumbEraseOverlay.graphics.drawRoundRect(0, 0, layoutThumbWidth, layoutThumbHeight, layoutCornerEllipseSize);
+			thumbEraseOverlay.graphics.endFill();
+		}
+		
+		/**
+		 *  Resize the thumb. Its position is handled by the component.
+		 */
+		private function layoutThumb(skinWidth:Number, skinHeight:Number):void 
+		{
+			setElementSize(thumb, layoutThumbWidth, layoutThumbHeight);
+		}
+		
+		/**
+		 *  Draw the clipping mask for the component. This is roughly the
+		 *  same as the track area.
+		 */
+		private function drawMask(skinWidth:Number, skinHeight:Number):void 
+		{
+			var graphics:Graphics = SpriteVisualElement(contents.mask).graphics;
+			graphics.clear();
+			graphics.beginFill(0x0);
+			graphics.drawRoundRect(0, 0, skinWidth, layoutThumbHeight, layoutCornerEllipseSize);
+			graphics.endFill();
+		}
+		
+		/**
+		 *  Resize and reposition the clipping mask
+		 */
+		private function layoutMask(skinWidth:Number, skinHeight:Number):void 
+		{
+			setElementSize(contents.mask, skinWidth, layoutThumbHeight);
+			setElementPosition(contents.mask, 0, (skinHeight - layoutThumbHeight) / 2);
+		}
+		
+		/**
+		 *  Move the sliding content to line up with thumbPosition.
+		 *  This version assumes the thumb and track share the same coordinate system.
+		 */
+		private function moveSlidingContent():void 
+		{
+			if (!hostComponent)
+				return;
+			var x:Number = (track.getLayoutBoundsWidth() - thumb.getLayoutBoundsWidth()) * 
+				hostComponent.thumbPosition + track.getLayoutBoundsX();
+			var y:Number = thumb.getLayoutBoundsY();
+			setElementPosition(slidingContentBackground, x, y);
+			setElementPosition(slidingContentForeground, x, y);
+		}
+		
+		//----------------------------------------------------------------------------------------------
+		//
+		//  Event handlers
+		//
+		//----------------------------------------------------------------------------------------------
+		
+		/**
+		 *  When the thumb position changes, reposition the sliding content. 
+		 */
+		private function thumbPositionChanged_handler(event:Event):void 
+		{
+			moveSlidingContent();
+		}
+	}
+}
+

Propchange: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Library/src/org/apache/skins/ToggleSwitchSkin.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/ReadMe.txt
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/ReadMe.txt?rev=1337407&view=auto
==============================================================================
--- incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/ReadMe.txt (added)
+++ incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/ReadMe.txt Fri May 11 23:03:56 2012
@@ -0,0 +1,66 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+Component contributed by Jeffry Houser (jhouser@apache.org)
+Date: 5/11/2012
+
+
+What is This:
+
+This is an "extended" approach to the ToggleSwitch component.  The primary purpose is 
+to make it easy to change the text for the selected label and the unselected label. 
+In the intiial rendition from Adobe Flex; a new skin had to be created to change 
+these two properties. 
+
+There are two properties added to the ToggleSwitch to help this happen:
+
+selectedLabel
+unselectedLabel
+
+The modified ToggleSwitch also exposes two new skin parts:
+
+selectedLabelDisplay
+unselectedLabelDisplay
+
+These components were already in the default ToggleSwitchSkin, but not exposed as SkinParts. 
+The components use a custom class LabelDisplayComponent which was originally defined in the ToggleSkin, 
+but is now separated out into a custom class for use outside of the skin.
+
+The Code/Projects:
+
+The contents contains library code and a sample application.  The sample application specifies the 
+same default styles for our extended ToggleSwitch that are specified in the mobile theme for the default
+ToggleSwitch.  
+
+
+How to move into Main Branch:
+
+If the Apache Flex team wanted to merge this into the main SDK, I percieve these are the things needed to be 
+done:
+
+Merge "extended" ToggleSwitch code into ToggleSwitch of main branch
+* Move new Skin PArts
+* Move PartAdded Method
+* Move new properties
+* move commitProperties method
+
+Add LabelDisplayComponent class to the main branch
+
+Merge "extended" ToggleSwitchSkin code into the ToggleSwitchSkin code of main branch:
+* I think this is just the removal of the LabelDisplayComponent

Propchange: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/ReadMe.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample-app.xml
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample-app.xml?rev=1337407&view=auto
==============================================================================
--- incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample-app.xml (added)
+++ incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample-app.xml Fri May 11 23:03:56 2012
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<application xmlns="http://ns.adobe.com/air/application/3.1">
+
+<!-- Adobe AIR Application Descriptor File Template.
+
+	Specifies parameters for identifying, installing, and launching AIR applications.
+
+	xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/3.1
+			The last segment of the namespace specifies the version 
+			of the AIR runtime required for this application to run.
+			
+	minimumPatchLevel - The minimum patch level of the AIR runtime required to run 
+			the application. Optional.
+-->
+
+	<!-- A universally unique application identifier. Must be unique across all AIR applications.
+	Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
+	<id>ToggleSwitchAlternateSample.debug</id>
+
+	<!-- Used as the filename for the application. Required. -->
+	<filename>ToggleSwitchAlternateSample</filename>
+
+	<!-- The name that is displayed in the AIR application installer. 
+	May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<name>ToggleSwitchAlternateSample-debug</name>
+	
+	<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade. 
+	Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
+	An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
+	<versionNumber>0.0.0</versionNumber>
+		         
+	<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
+	<!-- <versionLabel></versionLabel> -->
+
+	<!-- Description, displayed in the AIR application installer.
+	May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<!-- <description></description> -->
+
+	<!-- Copyright information. Optional -->
+	<!-- <copyright></copyright> -->
+
+	<!-- Publisher ID. Used if you're updating an application created prior to 1.5.3 -->
+	<!-- <publisherID></publisherID> -->
+
+	<!-- Settings for the application's initial window. Required. -->
+	<initialWindow>
+		<!-- The main SWF or HTML file of the application. Required. -->
+		<!-- Note: In Flash Builder, the SWF reference is set automatically. -->
+		<content>ToggleSwitchAlternateSample.swf</content>
+		
+		<!-- The title of the main window. Optional. -->
+		<!-- <title></title> -->
+
+		<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
+		<!-- <systemChrome></systemChrome> -->
+
+		<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
+		<!-- <transparent></transparent> -->
+
+		<!-- Whether the window is initially visible. Optional. Default false. -->
+		<!-- <visible></visible> -->
+
+		<!-- Whether the user can minimize the window. Optional. Default true. -->
+		<!-- <minimizable></minimizable> -->
+
+		<!-- Whether the user can maximize the window. Optional. Default true. -->
+		<!-- <maximizable></maximizable> -->
+
+		<!-- Whether the user can resize the window. Optional. Default true. -->
+		<!-- <resizable></resizable> -->
+
+		<!-- The window's initial width in pixels. Optional. -->
+		<!-- <width></width> -->
+
+		<!-- The window's initial height in pixels. Optional. -->
+		<!-- <height></height> -->
+
+		<!-- The window's initial x position. Optional. -->
+		<!-- <x></x> -->
+
+		<!-- The window's initial y position. Optional. -->
+		<!-- <y></y> -->
+
+		<!-- The window's minimum size, specified as a width/height pair in pixels, such as "400 200". Optional. -->
+		<!-- <minSize></minSize> -->
+
+		<!-- The window's initial maximum size, specified as a width/height pair in pixels, such as "1600 1200". Optional. -->
+		<!-- <maxSize></maxSize> -->
+
+        <!-- The initial aspect ratio of the app when launched (either "portrait" or "landscape"). Optional. Mobile only. Default is the natural orientation of the device -->
+
+        <!-- <aspectRatio></aspectRatio> -->
+
+        <!-- Whether the app will begin auto-orienting on launch. Optional. Mobile only. Default false -->
+
+        <!-- <autoOrients></autoOrients> -->
+
+        <!-- Whether the app launches in full screen. Optional. Mobile only. Default false -->
+
+        <!-- <fullScreen></fullScreen> -->
+
+        <!-- The render mode for the app (either auto, cpu, gpu, or direct). Optional. Default auto -->
+
+        <!-- <renderMode></renderMode> -->
+
+		<!-- Whether or not to pan when a soft keyboard is raised or lowered (either "pan" or "none").  Optional.  Defaults "pan." -->
+		<!-- <softKeyboardBehavior></softKeyboardBehavior> -->
+	<autoOrients>true</autoOrients>
+        <fullScreen>false</fullScreen>
+        <visible>true</visible>
+        <softKeyboardBehavior>none</softKeyboardBehavior>
+    </initialWindow>
+
+	<!-- We recommend omitting the supportedProfiles element, -->
+	<!-- which in turn permits your application to be deployed to all -->
+	<!-- devices supported by AIR. If you wish to restrict deployment -->
+	<!-- (i.e., to only mobile devices) then add this element and list -->
+	<!-- only the profiles which your application does support. -->
+	<!-- <supportedProfiles>desktop extendedDesktop mobileDevice extendedMobileDevice</supportedProfiles> -->
+
+	<!-- The subpath of the standard default installation location to use. Optional. -->
+	<!-- <installFolder></installFolder> -->
+
+	<!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
+	<!-- <programMenuFolder></programMenuFolder> -->
+
+	<!-- The icon the system uses for the application. For at least one resolution,
+	specify the path to a PNG file included in the AIR package. Optional. -->
+	<!-- <icon>
+		<image16x16></image16x16>
+		<image32x32></image32x32>
+		<image36x36></image36x36>
+		<image48x48></image48x48>
+		<image57x57></image57x57>
+		<image72x72></image72x72>
+		<image114x114></image114x114>
+		<image128x128></image128x128>
+	</icon> -->
+
+	<!-- Whether the application handles the update when a user double-clicks an update version
+	of the AIR file (true), or the default AIR application installer handles the update (false).
+	Optional. Default false. -->
+	<!-- <customUpdateUI></customUpdateUI> -->
+	
+	<!-- Whether the application can be launched when the user clicks a link in a web browser.
+	Optional. Default false. -->
+	<!-- <allowBrowserInvocation></allowBrowserInvocation> -->
+
+	<!-- Listing of file types for which the application can register. Optional. -->
+	<!-- <fileTypes> -->
+
+		<!-- Defines one file type. Optional. -->
+		<!-- <fileType> -->
+
+			<!-- The name that the system displays for the registered file type. Required. -->
+			<!-- <name></name> -->
+
+			<!-- The extension to register. Required. -->
+			<!-- <extension></extension> -->
+			
+			<!-- The description of the file type. Optional. -->
+			<!-- <description></description> -->
+			
+			<!-- The MIME content type. -->
+			<!-- <contentType></contentType> -->
+			
+			<!-- The icon to display for the file type. Optional. -->
+			<!-- <icon>
+				<image16x16></image16x16>
+				<image32x32></image32x32>
+				<image48x48></image48x48>
+				<image128x128></image128x128>
+			</icon> -->
+			
+		<!-- </fileType> -->
+	<!-- </fileTypes> -->
+
+    <!-- iOS specific capabilities -->
+	<!-- <iPhone> -->
+		<!-- A list of plist key/value pairs to be added to the application Info.plist -->
+		<!-- <InfoAdditions>
+            <![CDATA[
+                <key>UIDeviceFamily</key>
+                <array>
+                    <string>1</string>
+                    <string>2</string>
+                </array>
+                <key>UIStatusBarStyle</key>
+                <string>UIStatusBarStyleBlackOpaque</string>
+                <key>UIRequiresPersistentWiFi</key>
+                <string>YES</string>
+            ]]>
+        </InfoAdditions> -->
+        <!-- A list of plist key/value pairs to be added to the application Entitlements.plist -->
+		<!-- <Entitlements>
+            <![CDATA[
+                <key>keychain-access-groups</key>
+                <array>
+                    <string></string>
+                    <string></string>
+                </array>
+            ]]>
+        </Entitlements> -->
+	<!-- Display Resolution for the app (either "standard" or "high"). Optional. Default "standard" -->
+	<!-- <requestedDisplayResolution></requestedDisplayResolution> -->
+	<!-- </iPhone> -->
+
+	<!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->
+    <!--<android> -->
+    <!--	<manifestAdditions>
+		<![CDATA[
+			<manifest android:installLocation="auto">
+				<uses-permission android:name="android.permission.INTERNET"/>
+				<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+				<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+				<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
+				<application android:enabled="true">
+					<activity android:excludeFromRecents="false">
+						<intent-filter>
+							<action android:name="android.intent.action.MAIN"/>
+							<category android:name="android.intent.category.LAUNCHER"/>
+						</intent-filter>
+					</activity>
+				</application>
+            </manifest>
+		]]>
+        </manifestAdditions> -->
+	    <!-- Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit before namespace 3.0, 32bit after -->
+        <!-- <colorDepth></colorDepth> -->
+    <!-- </android> -->
+	<!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->
+
+<android>
+        <colorDepth>16bit</colorDepth>
+        <manifestAdditions><![CDATA[
+			<manifest android:installLocation="auto">
+			    <!--See the Adobe AIR documentation for more information about setting Google Android permissions-->
+			    <!--Removing the permission android.permission.INTERNET will have the side effect
+		of preventing you from debugging your application on your device-->
+			    <uses-permission android:name="android.permission.INTERNET"/>
+			    <!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
+			    <!--<uses-permission android:name="android.permission.READ_PHONE_STATE"/>-->
+			    <!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>-->
+			    <!--The DISABLE_KEYGUARD and WAKE_LOCK permissions should be toggled together
+		in order to access AIR's SystemIdleMode APIs-->
+			    <!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
+			    <!--<uses-permission android:name="android.permission.WAKE_LOCK"/>-->
+			    <!--<uses-permission android:name="android.permission.CAMERA"/>-->
+			    <!--<uses-permission android:name="android.permission.RECORD_AUDIO"/>-->
+			    <!--The ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE permissions should be toggled
+		together in order to use AIR's NetworkInfo APIs-->
+			    <!--<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>-->
+			    <!--<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>-->
+			</manifest>
+			
+		]]></manifestAdditions>
+    </android>
+    <iPhone>
+        <InfoAdditions><![CDATA[
+			<key>UIDeviceFamily</key>
+			<array>
+				<string>1</string>
+				<string>2</string>
+			</array>
+		]]></InfoAdditions>
+        <requestedDisplayResolution>high</requestedDisplayResolution>
+    </iPhone>
+</application>

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.apk
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.apk?rev=1337407&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.apk
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.swf
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.swf?rev=1337407&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/flex/whiteboard/jhouser/ToggleSwitchAlternate/Sample/bin/ToggleSwitchAlternateSample.swf
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream