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
New Contributor
Chris_S
Posts: 3
Registered: ‎04-03-2012
My Device: Bold 9700
Accepted Solution

Application Path Example?

I have been trying to load an image, and I keep getting URL Not Found error.

 

I am using background.setImage("image.png");

 

I have the image under the project folder, and under the src folder.

 

Is there something I am missing?

 

Thanks,

Chris S

Please use plain text.
Developer
UberschallSamsara
Posts: 1,029
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: Application Path Example?

Can you post a code snippet, if your code is not so proprietary as to preclude publically posting it?

For loading an image file from a local app directory using a URLRequest object the typical usage is e.g.:

 

myURLRequest = new URLRequest("app:///<relative path to image file>");

 

Some folks like to segregate their assets into separate dirs so you might have a path like

app:///assets/images/image.png. 

 

You would create a URLRequest object as above and then use the load() method of a Loader object to

load the URL, and once it loaded successfully, access the ContentLoaderInfo.content property of the

Loader object.

 

 

 

 

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

Re: Application Path Example?

You can also embed the image into the app so there is no delay in load time.
Please use plain text.
New Contributor
Chris_S
Posts: 3
Registered: ‎04-03-2012
My Device: Bold 9700

Re: Application Path Example?

While this wasn't the answer to my question, I have deciced to use this method instead.

 

Thanks,

Chris

Please use plain text.