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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380
My Carrier: Vodafone-IN

Problem in event Listner

Hai,

       I am added  3 images in a container and place the container into a scrollpane but unfortunatly i couldn't add listner to that component anybody have the idea abou that please help me

 

Thanks

Deepu

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Problem in event Listner

Add listener to which component? The images, container or the scrollpane?
Developer
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380
My Carrier: Vodafone-IN

Re: Problem in event Listner

I add listner to the images

Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: Problem in event Listner

How are you adding the images?

I've used the Event.COMPLETE on qnx.ui.display.image

 

var yourImage = new Image();
yourImage.setImage("sweetPic.png");
yourImage.setPosition(100, 100);
yourImage.addEventListener(Event.COMPLETE, yourFunction);
addChild(yourImage);

private function yourFunction(e:MouseEvent):void {
	yourImage.setSize(500, 500);
}

 You might need to adjust this for the new fuse.ui stuff (setActualSize vs. setSize, etc...)

New Contributor
Posts: 5
Registered: ‎05-21-2012
My Device: Curve 9360 and Playbook 16Gb
My Carrier: O2

Re: Problem in event Listner

If you are using mxml for it then the following code will do it :-

 

	<s:Image id="myImage" x="497" y="171" source="assets/myImage.png" click="myImage_clickHandler(event)" />

 obviously change the myPic to what you want and the x and y co-ords.

 

then you need a fuction is AS3 :-

 

protected function myPic_clickHandler(event:MouseEvent):void
	{
		\\ To Do
	}

 

John Herdman

Herdyclan Software
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Problem in event Listner

Not to confuse later readers, in John's post, the function "yourFunction" should have an event type of "Event" and not "MouseEvent", since the event listener is Event.COMPLETE. MouseEvent inherits from Event, so I am going to guess that yourFunction will never trigger or an exception will be thrown.

In the second example, the event will be triggered when the image is clicked, not when the image is loaded like in the case of John's example. The two are different kinds of events.
Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: Problem in event Listner

[ Edited ]

Thanks for catching that jtegen! I missed the reply and the massive mistake in my sample code!

 

Edit: JT, you're a lot taller in person than I imagined, it was great meeting you at Jam!

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Problem in event Listner

It was good to put a face to everyone.
New Contributor
Posts: 5
Registered: ‎05-21-2012
My Device: Curve 9360 and Playbook 16Gb
My Carrier: O2

Re: Problem in event Listner

[ Edited ]

Yeah thats what i thought he wanted, clicking on the image, sorry for the confusion.

John Herdman

Herdyclan Software
Developer
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)
My Carrier: Regional

Re: Problem in event Listner

He might want it for when clicked on the image, the Event.COMPLETE would need to be changed accordingly in my code. Event.COMPLETE will fire when the image is loaded (so if another function changes the image, Event.COMPLETE will fire accordingly, allowing you to resize for instance.