Something like this
CODE
var my_images = {}; //Main object to hold "Images"
//Do whatever you are doing to grab the image locations
//Please note this is only a way to cache and store images
//First Call
var display_image = new KONtx.element.Image({src: 'src_url'});
this.controls.display_img = display_image;
my_images['image_id'] = this.controsl.display_img;
my_images['image_id'].appendTo(this);
//Calling the image for re-display
this.controsl.display_img = my_images['image_id'];
/*
Important Considerations
- There is limited Memory in the devices and it would make sense to only cache a small number of files.
- The resolution does not get any better than 540 or 1080
- Is there a reason to not preform a server side image reduction before sourcing the file?
- You can also use the Async LoadingSrc to display a loading image while the file comes down.
*/
Thanks very much for your prompt reply.
I have followed your instructions, and it works. I can indeed store images in an array and use them.
However I am now facing another issue.
I can get the first image. But there is no second image. And there is no errors in the console. Can this issue be caused by an improper use of the function "appendTo(this)" ?
I might have not appended the image into "this" correctly. I have tried to use the method "this.getView()" like the following code shows, but it doesn't work (it says that "this.getView is not a function").
You will find below my code example:
CODE
var my_images = {}; //set as global so that I can use wherever
//operations to store images
//I want to display 2 images in a view. The first appears directly, and the second appears after 4 seconds.
createView: function() {
my_images[0].element.width = 480;
my_images[0].element.height = 360;
my_images[0].element.vOffset = 90;
my_images[0].appendTo(this);
var myTimer = KONtx.utility.timer.setTimeout(
function(){
//var self = this.getView();
my_images[1].element.width = 480;
my_images[1].element.height = 360;
my_images[1].element.vOffset = 90;
my_images[1].element.hOffset = 480;
my_images[1].appendTo(this); //appendTo(self);
},
4000 );
}
Please advise.
Many thanks in advance.