Page 1 of 1

Setting an image's source inside a timer function

Posted: Tue Feb 18, 2014 5:52 pm
by Andy Parker

I have a function that is started by itself when it ends every 100ms.

As part of an event in that timer, when something happens it changes the image that is displayed on the screen using the following code:

Code: Select all

Appery("titleimage").attr('src',backgroundimage); 
         Appery("titleimage").css("width",'100%'); 
         Appery("titleimage").refresh(); 

Now, this works on the PC browser, but the image is not changed when using the Appery tester, am I missing something?


Setting an image's source inside a timer function

Posted: Tue Feb 18, 2014 6:29 pm
by Maryna Brodina

Hello!
What is your backgroundimage path from first line of code? Perhaps there is incorrect path to image?


Setting an image's source inside a timer function

Posted: Wed Feb 19, 2014 10:47 am
by Andy Parker

Hi Maryna,

I found the problem.

I had used CSS to fix the position of the image, set its 'top' position and width/height.

On the PC's web browser test, all looked fine, however, on the Android test app, the image never changed.
I then rotated the device and saw the image to the right of the original image, very odd behaviour.

I ended up adding the CSS 'left' setting to ensure the image always gets placed exactly where I want it, the problem is now solved.

regards

Andy.


Setting an image's source inside a timer function

Posted: Wed Feb 19, 2014 10:57 am
by Kateryna Grynko

Hi Andy,

Thank you for the update! Glad it's solved.