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: 166
Registered: ‎03-04-2011
My Device: Playbook

Loading images dynamically in a WebWorkds PlayBook app

I'm very new in WebWorks development.

 

I have 33 images in assets/images folder.

 

I want to load dynamically those images using its name (1.png, 2,png, 3.png, ..., 33.png) but I don't know how.

 

How can I assign an image to a IMG tag using Javascript?

Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB

Re: Loading images dynamically in a WebWorkds PlayBook app

tagelement.src="http://some.site.com/someimage.png";

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App

Developer
Posts: 166
Registered: ‎03-04-2011
My Device: Playbook

Re: Loading images dynamically in a WebWorkds PlayBook app

Thanks but my images are locally, inside my app.
Developer
Posts: 669
Registered: ‎02-19-2011
My Device: BlackBerry PlayBook 32GB

Re: Loading images dynamically in a WebWorkds PlayBook app

Doesn't change anything.

 

Say you have them in a folder named 'images/'.

 

imageElement.src='images/myimage.png';

 

 

Staff UI Prototyper (read: full-time hacker)


My BB10 apps: Screamager | Scientific RPN Calculator | The Last Weather App