So after playing with my buddies iPhone the other day I realized i had the animation all wrong. So I’ve corrected that and also tried to size it closer to a normal flex button.

My current strategy for implementing the iPhoneToggle is to just use it as a skin of a normal checkbox component using the following code in the flex style declaration:

1
2
3
4
5
6
7
<mx:Style>
 
    CheckBox {
    	skin: ClassReference("iPhoneToggleControl");
    }
 
</mx:Style>

Seems to be a decent approach and it has some advantages, but I’d like to be able to allow for changing colors and on/off labels through the component properties. So if I can figure out how to just extend the checkbox while using the skins exported from flash I would switch to that.

Here is my latest progress.

edit: i’ve added an over state with some texture on the switch button. for some reason i can’t get it to not show up for the selectedUp state.

edit: i just added transparent icon to substitute for the icon to get rid of it, not great looking code.