I'm trying to change the backgroundImage of a button from script, if I do this fom markup it works but when I try it from script the iHDsim crashes.
Code:
document.getElementById("mybutton").style.backgroundImage="url('images.aca/audioDefault.png') url('images.aca/audioSelected.png')";

Changing backgroundImage From Script
pavel989
Thanks Clinic.
I have no checkd disc, and I find it's a TP bug now.
mracuraintegra
A.F.B
If you follow everything said in this thread, the following code example will describe:
document.MainMenu_Play.style.setProperty("backgroundImage", "url('file:///dvddisc/ADV_OBJ/menu.aca/MM_pause0.png') url('file:///dvddisc/ADV_OBJ/menu.aca/MM_pause1.png') url('file:///dvddisc/ADV_OBJ/menu.aca/MM_pause2.png')");
note that whitespace, apostrophes, parenthesis must be followed to spec. If you mistype anything in the new URL string, then this line of code will do nothing in the Emulator.
Darkside
To get it to work, set your markup like this:
And then change it by script with this code depending on what state you want to be shown:
Obviously change the names and positions as needed.
victu
gooon
inglewoodpete
I would make sure you have the images loaded into the filecache (by including them in the manifest and playlist resource lines).
Another option would be to load the files using the FileIO APIs into the filecache.
If the files are loaded into the filecache, make sure you are not exceeding the pixel buffer.
Yones
Also note that due to some issues on the current player, you cannot set the backgroundImage through script if you do NOT use AACS. The emulator, the simulator, and the Xbox will all work fine (and I assume other software players will, too) but the Toshiba player will not play the disc. This should be rectified in a future update.
As a work-around, I suggest listing all the possible images as the backgroundImage property (possibly inside a style declaration, to avoid further typing) and then animating the backgroundFrame.
ckcampbell
I have tried to change backgroundImage from script, but failed on Toshiba Player.
Who can give a hand Many thanks in advance.
Chicken Leg Willy
Hi, Peter
If I listing all the possible images as the backgroundImage property, with no AACS enable, Can I set the backgroundFrame with script since palyer won't let me set the backgroundImage property from script Or the only way to switch background image is to do so in Markup file if I don't use AACS thanks!
Matt5646
so, are you seeing this fail on a check disc
What is the firmware version of your TP and TE
nonno
wessen
Most likely the issue is that you need to specify the full path to the image when changing from script (ie, file:///dvddisc/ADV_OBJ/foo.png).
When you use URLs in markup, they are resolved relative to xml:base (or wherever the markup file is located if you don't set xml:base). From script, no such information exists so you need the full path.