package flater.blogsamples.degrafabutton.skins
{
import flash.net.URLVariables;
import flash.utils.describeType;
/**
* A singleton data model for the dynamic skin data
*/
[Bindable] public class ButtonDynamicPersistentSkinData
{
/**
* @private
* The var holding the singleton instance of Model.
*/
private static var instance : ButtonDynamicPersistentSkinData = null;
/**
* Returns the singleton instance of Model
*/
public static function getInstance() : ButtonDynamicPersistentSkinData
{
if ( instance == null )
{
instance = new ButtonDynamicPersistentSkinData( new SingletonBlocker() );
}
return instance;
}
/**
* Constructor.
*/
public function ButtonDynamicPersistentSkinData( singletonBlocker : SingletonBlocker ) : void
{
super();
}
public var upFillColor : uint = 0x951717;
public var overFillColor : uint = 0x951717;
public var downFillColor : uint = 0x954040;
public var upFillAlpha : Number = 1;
public var overFillAlpha : Number = .6
public var downFillAlpha : Number = .6;
public var upCornerRadius : int = 8;
public var overCornerRadius : int = 16;
public var downCornerRadius : int = 32;
/**
* Converts the model to URLVariables
*/
public function toUrlVariables() : URLVariables
{
var urlVars : URLVariables = new URLVariables();
var typeDescript : XML = describeType( this );
for each ( var propNode : XML in typeDescript.accessor )
{
urlVars[ propNode.@name ] = this[ propNode.@name ];
}
return urlVars;
}
/**
* Sets the values of the model based on urlVariables
*/
public function setValues( urlVariables : URLVariables ) : void
{
var typeDescript : XML = describeType( this );
for each ( var propNode : XML in typeDescript.accessor )
{
if ( urlVariables.hasOwnProperty( propNode.@name ) )
{
this[ propNode.@name ] = urlVariables[ propNode.@name ];
}
}
}
} }
internal class SingletonBlocker {}