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

Web and WebWorks Development

Reply
Developer
Posts: 37
Registered: ‎03-12-2009
My Device: Not Specified

Re: Loading an image from outside of a widget... Display caption/text until loaded?

[ Edited ]

Hi, Tim

 

Thanks for your answer.

 

But I don't understand very well the concept of "white list the location of the file" for a widget.

 

Does it mean we need to add the following line to the config.xml ?

 

<access subdomains="true" uri="file:///store/samples/pictures/"/>

 

Regards.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Loading an image from outside of a widget... Display caption/text until loaded?

Yes you have it correct... You will just need to replace my sample location to the file location you wish to bring into your application

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 37
Registered: ‎03-12-2009
My Device: Not Specified

Re: Loading an image from outside of a widget... Display caption/text until loaded?

Ok Tim,

 

It run now.

 

Thanks.

Developer
Posts: 37
Registered: ‎03-12-2009
My Device: Not Specified

Re: Loading an image from outside of a widget... Display caption/text until loaded?

Tim,

 

It run very well on a simulator but not on a real device (storm 2 - 9520 v5.0.0.306 device not upgraded).

 

in fact the "request.open" seems to not executed (a TCP/IP frame capture show that the request is never sent),but the "request.onreadystatechange" is called and save an empty image.

Very strange.

 

Is it related to the version of the OS (simulator 9550 is in v5.0.0.469)

 

Regards.

------

 

source code :

 

var request = google.gears.factory.create('beta.httprequest');
request.open('GET','http://www.myserver.com/img/image.png');

 

request.onreadystatechange = function() {
   if (request.readyState == 4) {
     var __res = request.responseBlob;
     var filePath = "file:///store/home/user/Tmp/myimg.png";
     blackberry.io.file.saveFile(filePath, __res);

   }

};

Highlighted
New Contributor
Posts: 4
Registered: ‎12-21-2010
My Device: Torch 9800
My Carrier: Claro Dominicana

Re: Loading an image from outside of a widget... Display caption/text until loaded?