corefragments
corefragments

Reputation: 23

Making Image Clickable in Flex Mobile Project

I want to make an image clickable/tap , so when the user clicks/taps it a sound can be played.

I,m working on flex SDK version 12 and using s:BitmapImage for images.

Upvotes: 0

Views: 182

Answers (2)

Alexander Farber
Alexander Farber

Reputation: 23018

BitmapImage does not support touch events, but you can put it into a Group:

    <s:Group click="zoomAvatar(event)">
            <s:BitmapImage id="_avatar" 
                           width="{AVATAR_WIDTH}" 
                           height="{AVATAR_HEIGHT}" 
                           scaleMode="letterbox"
                           source="{male_happy}"
                           contentLoader="{AVATAR_CACHE}" />
    </s:Group>

Upvotes: 1

Karmacon
Karmacon

Reputation: 3200

s:BitmapImage is a primitive component that doesn't support interactivity. If you want interactivity, you need to use a component that extends InteractiveObject. Use s:Image instead.

s:Image is also skinnable, giving you a lot more flexibility. Of course the footprint will be heavier than that of s:BitmapImage, so I would recommend still using s:BitmapImage when you don't require the extra functionalty.

Upvotes: 1

Related Questions