Skip to content

Instantly share code, notes, and snippets.

@k0t0vich k0t0vich/Model.as
Last active Dec 29, 2015

Embed
What would you like to do?
package feathers.examples.mxml.data {
import flash.events.EventDispatcher;
[Bindable]
public class Model extends EventDispatcher {
public var label:String = "Some Value";
public var width:Number = 100;
public var height:Number = 20;
public function Model() {
super();
}
}
}
<feathers:Button xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:feathers="feathers.controls.*"
xmlns:data="feathers.examples.mxml.data.*"
label="{model.label}"
width="{model.width}"
height="{model.height}"
touch="onTouch(event)" >
<fx:Script>
<![CDATA[
import starling.events.Touch;
import starling.events.TouchEvent;
import starling.events.TouchPhase;
protected function onTouch(event:starling.events.TouchEvent):void {
var touch:Touch = event.getTouch(this, TouchPhase.BEGAN)
if(touch){
model.label = "Other Value";
dispatchEventWith("bubbleEvent", true ,"someData");
}
}
]]>
</fx:Script>
<fx:Declarations>
<data:Model id="model" />
</fx:Declarations>
</feathers:Button>
<feathers:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:feathers="feathers.controls.*"
xmlns:screens="feathers.examples.mxml.screens.*" addedToStage="{button.model.label = 'XXXXX'}">
<screens:SampleButton id="button">
</screens:SampleButton>
</feathers:Panel>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.