Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Setting an image's source inside a timer function

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?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Setting an image's source inside a timer function

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

Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

Setting an image's source inside a timer function

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Setting an image's source inside a timer function

Hi Andy,

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

Return to “Issues”