02-19-2012 10:46 AM - edited 02-19-2012 10:48 AM
Hey guys. It's been a while since I developed an app using the Playbook SDK for Air. In my last projects I used the Image class extensively and it worked like a charm. But seeing that the old Image class is now deprecated (and I assume it's discouraged to use the old classes) I tried the new qnx.fuse.* classes. Unfortunately I can't get the new Image class to work.
My code looks as follows:
var img:Image = new Image(); img.setImage("img/test-img.png"); img.setPosition(50, 20); img.visible = true; addChild(img);
But the image never shows. With the old Image class it worked with the same code. Do I have to make adjustments now? From the API documentation I can't figure out what I have to change.
02-19-2012 12:06 PM
your code seems correct -- chances are it is an issue with the location of the image. verify that the image exists. then use the event listeners for the Image class to see if there is an IOerror and if the image is ever loaded. good luck!
02-19-2012 12:28 PM
I added an IOErrorEvent listener and an Event.COMPLETE listener. It did fire up the complete event but I didn't get an IOError. The same path also works when using the old Image class, so the image is definitely there. I really don't know what else to try.
In the meantime I made my own Image class using the UIComponent as a base class. Although I can continue working now I would love to know why the QNX Image class doesn't seem to work at all. I also hope there won't be any more surprises like this waiting for me in the new classes.
02-19-2012 02:09 PM
I am still using the old Image class in all my projects. I just can't get the fuse variant working properly, it doesn't load the images the old one loaded perfectly fine.
02-19-2012 02:42 PM
Interesting. I was wondering if I'm the only one with the problem. Could this be a bug in the fuse Image class? If not, I'd still like to know how to use the new class.
04-04-2012 12:01 PM
05-28-2012 10:35 AM
Try explicitly setting the width and height of the image. This used to happen automatically for you, but with the new layouts that gets a little tricky. Looking into a fix to make this work like it used to as it is annoying.