I'm making a watch face that I want to have multiple different banners that are user selectable.
To save memory, I want the watch to only load the resource for the one that's selected.
A huge string of IF statements seemed horribly ineffecient so I made an array, and am using the value from the settings list to identify which item in the array to use
The items in the array are the resource IDs.
But I can't figure out how to get the correct ID appended to the end of the resource call (or whatever it is called).
I've tried a few different ways, and it just doesn't like it. Saves fine with no errors, but it won't run in the sim
(13) function initialize() {WatchFace.initialize();}
// Load your resources here
function onLayout(dc) {
var bannerID = App.getApp().getProperty("IM_banner");
Sys.println("banner ID=" + bannerID);
var bannerLabel = ["bannerAIP","bannerWC","bannerMUN","bannerRAC","bannerCHO","bannerLOU"];
Sys.println("bannerLabel=" + bannerLabel[bannerID]);
//banner = Ui.loadResource(Rez.Drawables.bannerWC);
var rez = bannerLabel[bannerID];
Sys.println(rez);
(25) banner = Ui.loadResource("Rez.Drawables." + rez);
}
banner ID=1
bannerLabel=bannerWC
bannerWC
Failed invoking <symbol>
UnexpectedTypeException: Expected Number/Float/Boolean/Long/Double, given String
initialize in C:\Users\N105811\workspace\IMwatch\source\IMwatchView.mc:13
onLayout in C:\Users\N105811\workspace\IMwatch\source\IMwatchView.mc:25
Unhandled Exception