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
Contributor
durvasa
Posts: 14
Registered: ‎12-18-2010
My Device: Not Specified

Re: Display image

JRab,

 

thanks for all of your help!!

 

here's the code I'm using (its almost exactly like the code above, so thank you to those people who wrote it):

 

I created a folder called "images" inside of the src folder and placed a image called blackberry.bmp inside.

 

 

package 
{
	import flash.display.Sprite;
	import qnx.ui.display.Image;
		
	[SWF(width="1024", height="600", backgroundColor="#cccccc", frameRate="30")]
	public class AirHelloWorld extends Sprite
	{
		public function AirHelloWorld()
		{
			var topHeaderImage:Image = new Image();
			topHeaderImage = new Image;
			topHeaderImage.setImage('images/blackberry.bmp');
			topHeaderImage.setPosition(10,10);
			topHeaderImage.setSize(90,90);
			topHeaderImage.visible = true;
			addChild(topHeaderImage);
						
			stage.nativeWindow.visible = true;
		}
			
	}
}

 

 

 

 

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: Display image

I had to specify the folder in the blackberry-airpackager command right after the path for my application icon.

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Display image

hey durvasa,

 

i dont see any problems with your code except maybe this line:

 

 

topHeaderImage = new Image;

 

 

try changing it to:

 

 

topHeaderImage = new Image();

 

Sometimes i get weird errors when i miss the parenthesis. if that doesnt work my next theory is the format of the image you are trying to display. try using a .jpg or a .png file and see if you get similar results. 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
Please use plain text.
Contributor
durvasa
Posts: 14
Registered: ‎12-18-2010
My Device: Not Specified

Re: Display image

JRab,

 

I got rid of that extra line of code

 

topHeaderImage = new Image;

 

 

In the end, the issue was the picture format.  Something (either emulator or the compiler) wasnt accepting the bmp file I was using.  But once I used a jpg file, the emulator show the image just fine.

 

thanks again !

 

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: Display image

You can also embed the image and bypass the simulator reading the file by:

 

[Embed(source='assets/gauge.png')]       private var gauge_icon  : Class;

 

And:

my_image.setImage( new gauge_icon() );

 

Please use plain text.