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.

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

How to set an image in bb10..?

i am getting URl not found when i wrote



my image iS in a folder named "image" the name of image is "Penguins.jpg" 

Help is available everywhere but you have to look at the correct place.
By Me :-)
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to set an image in bb10..?

You have to load external resources with URLLoader and then set the image when the load is "complete". You also have to make certain you package the file with the BAR file.

Make certain the loader is expecting binary data.

Lastly, Unix paths are forward slashes (/). Windows is the only one that does a back splash. AIR might convert that for you, it is just more of a convention.
Posts: 23
Registered: ‎05-04-2012
My Device: Playbook, 9670, 9800, 9350
My Carrier: Telus

Re: How to set an image in bb10..?


For general pathing issues which I truely believe this may be, you need to determine where the path 'image/' really is. In the case of AIR development (and any application development vs web development) application development must use URI rather than URL type references. Relative paths such as the one you note below are not easily resolved. 


This path is relative to the application, so 'image/Penguin.jpg' would be relative to the application folder. If you are referring to the users image folder, then you may have more success using File.userDirectory to locate the image and load it from there using 


var fl:flash.filesystem.File = flash.filesystem.File.userDirectory.resolvePath('image/Penguin.jpg');
var fs:FileStream = new FileStream();
fs.open(fl, FileMode.READ);


and then taking the resulting binary data and importing it into a static Loader object in memory.


var ba:ByteArray = new ByteArray();


var loader:Loader = new Loader();



If you question is more related to general Image request management:


To reference supported file formats you can use a few options:



For the first one, that's the traditional display list element that is attached directly to a movie clip. There's no assumed functionality from the OS.


The second one is the BB OS version which includes a lot more native functionality in the class, related to BB specific methods such as minWidth etc that allows you to create an interactive control as opposed to what is considered a more static element that appears as part of the display list in AIR.


The third you may use for managing raw binary data to load into a Loader object.


So, to replicate what you have in the most simplified way:


var loader:Loader = new Loader();

var urlrequest:URLRequest = new URLRequest("image/Penguins.jpg");





function imageloaded(e:Event):void {

      // when image is loaded you may choose to change it's parameters at this point -- images which are not loaded are considered null until the data is received and this event is fired. For example to capture the image width use e.currentTarget.width at this point.



Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900
My Carrier: Vodafone-in

Re: How to set an image in bb10..?

Thank a lot.The forward slah was the issue..

Help is available everywhere but you have to look at the correct place.
By Me :-)