PDA

View Full Version : image based on var value...



kwaugh
May 5th, 2006, 08:09 PM
I'm sure this is very simple to do, but I just can't figure it out.

I have a list of 50 or so images that I'd like to show in response to a variable changing. For example, image1 when the value is 1, image2 when the value is 2 etc.

Since I can only have 1 additional state on a button, I can't figure out how to do this.

If someone could point me in the right direction, I'd much appreciate it...

Thanks,

K

mhwlng
May 5th, 2006, 11:07 PM
various samples related tot this can be found via the url in my sig.

there's basically two ways :

you load a bunch of images from disk into memory and use something like :


NetRemote.SetImageVariable("rainy.Picture","image/png",rainyimgdata[framecounter]);

to replace the image on an IMG button.

or you make your images into a long imagestrip

and you use something like



NetRemote.SetElementPosition(el2,x,y);


to bring the correct 'frame' into view

Marcel

kwaugh
May 6th, 2006, 05:23 AM
Thanks for the quick response!

I'll further expose my ignorance...

Are both options viable on a PPC? If so, how do I load the images to build the array in option 1?

Thanks again!

K

mhwlng
May 6th, 2006, 06:13 AM
both methods work on ppc and examples of both methods are available via the link in my sig...

e.g.

globe
rainy
various samples in marcelutilsdriver
etc.

note that very big filmstrips (method #2) don't work on ppc (not enough memory)

Marcel

kwaugh
May 7th, 2006, 09:06 AM
Took me a little while to figure out how to modify Rain example to directly jump to an image based on a variable vs. loop through them, but it's working like a champ...


Thanks again!

K