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

Native Development

Reply
Contributor
Posts: 13
Registered: ‎06-18-2010
My Device: Z10
My Carrier: MTN

Play *.png images in sequence in QML.

Like the title says, how would I play images in sequence in an "ImageView".

No I do not want to make a *.gif, as gifs are really bad quality.

 

It's seperate *.png images and not on a sprite sheet. I have searched everywhere and there is no solution for this anywhere to be found.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Play *.png images in sequence in QML.

For a start, you could just use a QTimer to trigger a handler that changes the source image or imageSource (file path) for the ImageView. Not sure what requirements you might have that may not be covered by that approach.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
Posts: 13
Registered: ‎06-18-2010
My Device: Z10
My Carrier: MTN

Re: Play *.png images in sequence in QML.

how would I do that though? I'm really new at this qml stuff. 

I come from Java and Android...

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Play *.png images in sequence in QML.

Well, I'm always more about teaching people to fish than catching their fish for them, so if you'll forgive me not handing you the solution, try this.

First start with a simple app, any of the tutorials or samples, and make sure you've got the basic ability to build and test an app. It's usually a good idea to throw in learning how to output messages to a log and view the log, e.g. using qDebug() in C++ and console.log() or print() in the QML.

Then write a trivial app with an ImageView in it, populated with a simple static image.

Find how to add a QTimer and have it just print stuff to the log, so you can see how to have it fire periodically etc.

Then try to hook them together so that the timer's handler not only logs (so you can be sure it's still running) but also modifies the image's source URL.

Basically build yourself up to that one step at a time. I assume you know how to get to the API documentation for these classes?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!