:: Forum >> Version 1 >>

images in grid (II)

Hi,
Is there a way to get two different images in two different columns in the same row?. Thanks
Alejandro Iglesias
Wednesday, January 7, 2004
Yes, sure.

There are several steps in adding images:

1. create CSS file, which translates image code-name to the image file path:

.active-image-name1 {background: url(path1)}
.active-image-name2 {background: url(path2)}
...

you can put several images into one file and use background-position
(see example at /source/styles/classic/images.css)

2. create data array for images, similar to text array:

var myImages = [
["name1", "name2", ... ],
["name3", "name4", ... ]
];

(for columns without images put "none" as an image name)

3. use Active.Templates.Image cell template instead of default one:

obj.setTemplate("cell", new Active.Templates.Image, 0);

4. link your data text and images:

obj.setProperty("data/text", function(i, j){return myData[i][j]});
obj.setProperty("data/image", function(i, j){return myImages[i][j]});


I'll try to write a tutorial section about images with more details.
Alex (ActiveWidgets)
Wednesday, January 7, 2004
Can you paste some code I'm lost...
Sergio
Monday, September 6, 2004
php. Java, or html

var myImages = [
["name1", "name2", ... ],
["name3", "name4", ... ]
];

WTF how can I use this in case of 20 Gif images who I want to show one by one, every visitor another random image...

Help??
Friday, September 16, 2005
Make an array with image names and fill the data with a random function for example.
John Ophof http://open-modeling.sourceforge.net
Friday, September 16, 2005



This topic is archived.

Back to support forum

Forum search