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
Developer
Posts: 73
Registered: ‎04-08-2014
My Device: Z10
My Carrier: XL
Accepted Solution

Image Change in 1 page

Hi..

is there any sample code to do this?? (see picture below)

Untitled-1.jpg

if i click that small image, it will show the bigger one on the left and so on.

thanks

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Image Change in 1 page

just create a large image and several imagebuttons https://developer.blackberry.com/native/reference/cascades/bb__cascades__imagebutton.html
then, add a handler to onClicked(), which sets the image of the large image to button.defaultImage
-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Highlighted
Developer
Posts: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Image Change in 1 page

[ Edited ]

do you have a set list of images or will they be changing? If you just need to replicate thee image above do as pyth said. Create one container with two containers inside with a lefttoright sticky orientation: one for the large imageView and another for the three imagebuttons.

and set the onClicked for the image buttons to change the imagview's image source to the relevant image asset.

 

Or you could do the same thing by replacing imagebuttons with imagviews and have a command for onTouch when a user touches the images on the right.  Depends on which looks more aesthetically pleasing to you.