Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
sujachristy
Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900
My Carrier: Vodafone-in
Accepted Solution

Load an image over another on click..??

Am trying to load an image on another on click..(to bring the effect of click..) Anyone have any idea.. Thanks in advance...

_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Please use plain text.
Developer
pyth
Posts: 489
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Load an image over another on click..??

if you want a simple solution, just have both images on top of each other

 

example: 'Volume On', above of 'Volume Off'

MouseEvent.CLICK event listener on the 'Volume On'- Button (or MouseEvent.MOUSE_DOWN, depending on your needs)

and then something like

 

 

private var clicked:Boolean

 

function eventHandler(e:Event):void {

   clicked = !clicked

   VolumeOn.alpha = clicked? 0.0 : 1.0;

}

 

-----------------------------------------------------

 

If you don't want to do that, add a listener for MouseEvent.MOUSE_DOWN, in which the image of your button is set, and another listener for MouseEvent.MOUSE_UP, where you set the image back to the original

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Load an image over another on click..??

Best to set the visibility and not the alpha value, since the object will still be rendered.
Please use plain text.
Developer
pyth
Posts: 489
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Load an image over another on click..??

actually, it's deliberate that the alpha is set, so you still get the mouse event. I don't know if the event is still fired when the visibility is set to false

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Load an image over another on click..??

That is true, it would not be fired if it was invisible.
Please use plain text.
Developer
sujachristy
Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900
My Carrier: Vodafone-in

Re: Load an image over another on click..??

setting the alpha value did well. Thanks mate.
_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Please use plain text.