You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by scott matheson <sc...@matheson.it> on 2016/09/04 20:50:22 UTC
dragEnabled on a button
Hi
i am making my own draggable switch, I was expectin g to set the dragEnabled on the Button
id=“indicatorButton” but this does not seem to be a propriety
can you Drag buttons ?
Scott
<fx:Script><![CDATA[
private var _switch:Boolean = true; // true == locked
private var _ep:Event;
public var locked:String;
public var unlocked:String;
private function buttonClicked():void {
if (_switch) {
_switch = false;
this.setCurrentState("offState");
_ep = new Event("unlocked", true); // the name of the event is the same as the Event = define above
this.dispatchEvent(_ep);
} else {
_switch = true;
this.setCurrentState("onState");
_ep = new Event("locked", true); // the name of the event is the same as the Event = define above
this.dispatchEvent(_ep);
}
}
]]></fx:Script>
<s:states>
<s:State name="onState" />
<s:State name="offState" />
</s:states>
<s:BorderContainer width="110" backgroundColor="0xc0c0c0" cornerRadius="4" borderColor="0x515151" dragComplete="buttonClicked()">
<s:Label text="{unlocked}" fontSize="12" y="8" left="2" color="0xf4f4f4" />
<s:Label text="{locked}" fontSize="12" right="2" y="8" color="0xf4f4f4" />
<s:Button id="indicatorButton" width="50" height="99%" label="| | |" color="black" fontSize="18" click="buttonClicked()"
left.onState="1" right.offState="1" cornerRadius="4" />
</s:BorderContainer>
Re: dragEnabled on a button
Posted by Alex Harui <ah...@adobe.com>.
Are you looking for the ToggleSwitch component?
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/co
mponents/ToggleSwitch.html
-Alex
On 9/4/16, 1:50 PM, "scott matheson" <sc...@matheson.it> wrote:
>Hi
> i am making my own draggable switch, I was expectin g to set the
>dragEnabled on the Button
>
> id=“indicatorButton” but this does not seem to be a propriety
>
>
>
>can you Drag buttons ?
>
>Scott
>
>
>
>
><fx:Script><![CDATA[
> private var _switch:Boolean = true; // true == locked
> private var _ep:Event;
>
> public var locked:String;
> public var unlocked:String;
>
> private function buttonClicked():void {
>
> if (_switch) {
> _switch = false;
> this.setCurrentState("offState");
> _ep = new Event("unlocked", true); // the name of the event
>is the same as the Event = define above
> this.dispatchEvent(_ep);
> } else {
>
> _switch = true;
> this.setCurrentState("onState");
> _ep = new Event("locked", true); // the name of the event is
>the same as the Event = define above
> this.dispatchEvent(_ep);
> }
>
> }
> ]]></fx:Script>
>
>
><s:states>
> <s:State name="onState" />
> <s:State name="offState" />
>
></s:states>
>
>
><s:BorderContainer width="110" backgroundColor="0xc0c0c0"
>cornerRadius="4" borderColor="0x515151" dragComplete="buttonClicked()">
>
> <s:Label text="{unlocked}" fontSize="12" y="8" left="2"
>color="0xf4f4f4" />
> <s:Label text="{locked}" fontSize="12" right="2" y="8"
>color="0xf4f4f4" />
> <s:Button id="indicatorButton" width="50" height="99%" label="| | |"
>color="black" fontSize="18" click="buttonClicked()"
> left.onState="1" right.offState="1" cornerRadius="4" />
>
></s:BorderContainer>
>
Re: dragEnabled on a button
Posted by Kyle McKnight <ka...@gmail.com>.
I believe dragEnabled is defined on list based controls. You will probably
have to use DragManager to do something like dragging a button
On Sep 4, 2016 4:50 PM, "scott matheson" <sc...@matheson.it> wrote:
> Hi
> i am making my own draggable switch, I was expectin g to set the
> dragEnabled on the Button
>
> id=“indicatorButton” but this does not seem to be a propriety
>
>
>
> can you Drag buttons ?
>
> Scott
>
>
>
>
> <fx:Script><![CDATA[
> private var _switch:Boolean = true; // true == locked
> private var _ep:Event;
>
> public var locked:String;
> public var unlocked:String;
>
> private function buttonClicked():void {
>
> if (_switch) {
> _switch = false;
> this.setCurrentState("offState");
> _ep = new Event("unlocked", true); // the name of the event
> is the same as the Event = define above
> this.dispatchEvent(_ep);
> } else {
>
> _switch = true;
> this.setCurrentState("onState");
> _ep = new Event("locked", true); // the name of the event is
> the same as the Event = define above
> this.dispatchEvent(_ep);
> }
>
> }
> ]]></fx:Script>
>
>
> <s:states>
> <s:State name="onState" />
> <s:State name="offState" />
>
> </s:states>
>
>
> <s:BorderContainer width="110" backgroundColor="0xc0c0c0"
> cornerRadius="4" borderColor="0x515151" dragComplete="buttonClicked()">
>
> <s:Label text="{unlocked}" fontSize="12" y="8" left="2"
> color="0xf4f4f4" />
> <s:Label text="{locked}" fontSize="12" right="2" y="8"
> color="0xf4f4f4" />
> <s:Button id="indicatorButton" width="50" height="99%" label="| | |"
> color="black" fontSize="18" click="buttonClicked()"
> left.onState="1" right.offState="1" cornerRadius="4" />
>
> </s:BorderContainer>
>
>