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
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380

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

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Problem in event Listner

Add listener to which component? The images, container or the scrollpane?
Please use plain text.
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380

Re: Problem in event Listner

I add listner to the images

Please use plain text.
Developer
JohnPinkerton
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)

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...)

Please use plain text.
New Contributor
johnherdman
Posts: 5
Registered: ‎05-21-2012
My Device: Curve 9360 and Playbook 16Gb

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
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

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.
Please use plain text.
Developer
JohnPinkerton
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)

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!

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Problem in event Listner

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

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
Please use plain text.
Developer
JohnPinkerton
Posts: 350
Registered: ‎01-21-2011
My Device: Curve 8900 (Personal) / Bold 9650 (Work)

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.

Please use plain text.