开发者

webos background image updating problem

开发者 https://www.devze.com 2022-12-18 18:49 出处:网络
My application has a preference screen which has a feature for changing the background color or theme. For that, I am using png images with different colors.When I go to the main screen, I am using so

My application has a preference screen which has a feature for changing the background color or theme. For that, I am using png images with different colors. When I go to the main screen, I am using some other image depending on the image selected in the preferences. To do that, I am changing the background image with CSS in the deactivate() method of the preference scre开发者_如何学Pythonen. In the emulator, it works fine. When I install the app on the device and check the same case, it shows blank, then it changed the main screen image.

How can I avoid the moment of blank background in the transition from preference screen to main screen?


It sounds like the image is taking a second to load. You can sprite the images together so they are always held in memory, or you can create a new image in JS and only run the scene transition when the image is loaded.

var img = new Image();
img.onload = function() { /* Run scene transition */ };
img.src = "path/to/the/background";
0

精彩评论

暂无评论...
验证码 换一张
取 消