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
Posts: 47
Registered: ‎01-26-2011
My Device: Not Specified
Accepted Solution

Lag/graphic delay when changing an image

When I change an image from the normal state to a different image when the user clicks on it, theres a slight, definitely noticable lag before the graphic changes. Is that normal for the simulator? Im sure it wouldn't be in the actual device but the lag makes it difficult to test my app properly. Anyone else having the same problem ?

Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Lag/graphic delay when changing an image

hey DNSalehi,

 

how are you loading the images after the user clicks on it? loading non-embedded images via the setImage method from the Image class will cause a delay because it takes time to load the image on the fly. however, if you were to embed your images, there will be no delay (at least noticable anyway). hope that helps, good luck!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Lag/graphic delay when changing an image

If you need to do someting to the image after it has been loaded, you can listen for a complete event and then perform some operation on the image after the event callback.

Developer
Posts: 47
Registered: ‎01-26-2011
My Device: Not Specified

Re: Lag/graphic delay when changing an image

Oh ok i see, yeah i've been using the setImage method.

probably a noob question, but how would i embed the image?

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

Re: Lag/graphic delay when changing an image

With your attributes:

 

[Embed(source='assets/myimage.png')] private myimage_icon : Class;

private img : Image = new Image();

 

To set it in your code:

 

this.img.setImage( new myimage_icon() );