Package examples.common
Class public  class MobileButtonExample01
Inheritance MobileButtonExample01 Inheritance View

A sample of the Button#longClick event.

Tips: Author:

Michael Schmalle
Copyright:

Teoti Graphix, LLC
Images:

160DPI



Public Variables
    Variable Defined by
     
button : MobileButton
Holding down the button for 2 seconds will dispatch the ButtonEvent.LONG_CLICK event.
MobileButtonExample01
     
statusLabel : Label
MobileButtonExample01
Protected Methods
    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
Public Variable detail
button variable  
public var button : MobileButton

Holding down the button for 2 seconds will dispatch the ButtonEvent.LONG_CLICK event.

statusLabel variable  
public var statusLabel : Label

Protected Method detail
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.

Source Code:
<?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>
Mobile UI Toolkit1 v1.0.x Documentation - Thu Dec 15 10:21:33 EST 2011