Search code examples
actionscript-3mobileairflex4blackberry-playbook

Mobile Mutitouch Buttons in Adobe Air


I have three buttons with sound effects in a mobile adobe air device (PlayBook in this case - supports up to 4 points of multitouch).

<fx:Declarations>
    <mx:SoundEffect id="Sound1" source="@Embed(source='assets/Sound1.mp3')" />
    <mx:SoundEffect id="Sound2" source="@Embed(source='assets/Sound2.mp3')" />
    <mx:SoundEffect id="Sound3" source="@Embed(source='assets/Sound3.mp3')" />

</fx:Declarations>

<s:Button interactionMode="touch" x="14" y="60" width="295" height="145" label="Button1" mouseDownEffect="{Sound1}"/>
<s:Button interactionMode="touch" x="362" y="60" width="295" height="145" label="Button2" mouseDownEffect="{Sound2}"/>
<s:Button interactionMode="touch" x="713" y="60" width="295" height="145" label="Button3" mouseDownEffect="{Sound3}"/>

All the buttons work but how do I let the user press all three at once? Is there another way to do this?

Thanks,


Solution

  • Ran on creationComplete:

            protected function init():void
            {
                Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
    
            }
    

    Then used an image for a button since buttons work but only one button shows animation for some reason:

    <s:Image id="ui_btnLowTom" source="{imageOut.source}" 
             x="14" y="60" width="295" height="145" touchBegin="ui_btnLowTom.source = imageOver.source; LowTomPlay(event)"
             touchEnd="ui_btnLowTom.source = imageOut.source" />
    

    And the actual handler:

            protected function LowTomPlay(event:TouchEvent):void
            {
                lowTomSndChannel=lowTomSnd.play();              
            }
    

    So yes - flex does support multi-touch....