| Package | examples.common |
| Class | public class MobileButtonExample01 |
| Inheritance |
MobileButtonExample01
View
|
A sample of the Button#longClick event.
Tips:longClickDelay style to adjust how long it takes on
a press to dispatch the Button#longClick event.
160DPI
| Variable | Defined by | |||
|---|---|---|---|---|
|
button
: MobileButton
Holding down the button for 2 seconds will dispatch the
ButtonEvent.LONG_CLICK event.
|
MobileButtonExample01 | |||
|
statusLabel
: Label
|
MobileButtonExample01 | |||
| Method | Defined by | |||
|---|---|---|---|---|
|
button_clickHandler( event:MouseEvent ) : void
Handles the
PopUp.CLICK event and then
uses the Toast.makeText() notification. |
MobileButtonExample01 | |||
|
button_longClickHandler( event:ButtonEvent ) : void
Handles the
ButtonEvent.LONG_CLICK event and then
uses the PopUp.makeText() notification. |
MobileButtonExample01 | |||
| button | variable |
public var button : MobileButtonHolding down the button for 2 seconds will dispatch the
ButtonEvent.LONG_CLICK event.
| statusLabel | variable |
public var statusLabel : Label| button_clickHandler() | method |
protected function button_clickHandler( event:MouseEvent ) : void
Handles the PopUp.CLICK event and then
uses the Toast.makeText() notification.
| button_longClickHandler() | method |
protected function button_longClickHandler( event:ButtonEvent ) : void
Handles the ButtonEvent.LONG_CLICK event and then
uses the PopUp.makeText() notification.
<?xml version="1.0" encoding="utf-8"?>
<!--
@LICENSE@
-->
<!--
MobileButtonExample01.mxml
@PROJECT_BLOCK@
-->
<!---
* A sample of the Button#longClick event.
*
* @tip Use the <code>longClickDelay</code> style to adjust how long it takes on
* a press to dispatch the <code>Button#longClick</code> event.
* @source
* @mobile
* @image assets/examples/common/MobileButtonExample01_160.png
* <strong>160DPI</strong>
* @author Michael Schmalle
* @copyright Teoti Graphix, LLC
* @front
-->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:tg="http://tg.teotigraphix.com/flex4"
title="ButtonEvent.LONG_CLICK Example" >
<fx:Script>
<![CDATA[
import com.teotigraphix.ui.components.PopUp;
import com.teotigraphix.ui.events.ButtonEvent;
/**
* Handles the <code>ButtonEvent.LONG_CLICK</code> event and then
* uses the <code>PopUp.makeText()</code> notification.
*/
protected function button_longClickHandler(event:ButtonEvent):void
{
statusLabel.text = "Long click event!";
PopUp.makeText("Hello longClick event!", PopUp.LENGTH_SHORT).show(navigator);
}
/**
* Handles the <code>PopUp.CLICK</code> event and then
* uses the <code>Toast.makeText()</code> notification.
*/
protected function button_clickHandler(event:MouseEvent):void
{
statusLabel.text = "Click event!";
PopUp.makeText("Hello click event!", PopUp.LENGTH_SHORT).show(navigator);
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
<s:Label text="Hold the button down for 2 seconds to get a longClick event."/>
<!---
Holding down the button for 2 seconds will dispatch the
<code>ButtonEvent.LONG_CLICK</code> event.
-->
<tg:MobileButton id="button"
label="Long Click"
longClickDelay="2000"
click="button_clickHandler(event)"
longClick="button_longClickHandler(event)"
horizontalCenter="0" top="25"/>
<s:Label id="statusLabel"/>
</s:View>