Looks great, will test things out and report back.
I am not sure if you are already doing this but I found it helps create screens faster and even more reduces resources.
You can get the current objects on the stage with typeof
and Object_Name in _root
So you could grab all of the objects and there names and automaticaly create functions for them. You can also store up what was there before they moved to another frame and remove the "watch" function. This is important because since we are watching from the root they are always there and active even when you may not need them. This can cause a LED to fire off a function even if the code isnt on that frame.
This is what I do, and if you have a special function just put an indicator in the objects name.
///Create buttons and LED's Function
LED_Watch_function = function () {;
//remove any watch functions;
for (var w:Number = 0; w<_root.Stored_watch.length; w++) {;
_root.unwatch(_root.Stored_watch[w]);
};
///declare;
_root.Stored_watch = Array();
i = 0;
///Loop and find all objects named LED*********X EX:(LED_800);
for (var Object_Name in _root) {;
///Is it a movie object to nerrow it down;
if (typeof (this[Object_Name]) == "movieclip") {;
//-------------------------------------------------------------------------;
///does it have LED in the name;
if (Object_Name.indexOf("LED") == 0) {;
//What is the LED number;
LED_OEM_num = Object_Name.substr(3, Number(Object_Name.length-7));
//check current state of the LED;
if (_root["LED"+LED_OEM_num] == 1) {;
_root[Object_Name].gotoAndStop("on");
} else {;
_root[Object_Name].gotoAndStop("off");
};
///This function is create for each object with LED for its name<<<<<<<<<<<<<<<;
_root["LED"+LED_OEM_num+"_function"] = function (varName, oldVal, newVal) {;
//Call function (optinal);
_root[varName+"sub"](newVal);
//check cuurent state of the LED;
if (newVal == 1) {;
_root[varName+"_mov"].gotoAndStop("on");
} else {;
_root[varName+"_mov"].gotoAndStop("off");
};
return newVal;
};
//Watch the LED;
_root.watch("LED"+LED_OEM_num,_root["LED"+LED_OEM_num+"_function"]);
//Store it to remove later<<<<<<<<<<<<<<<<<<<<<<<<<;
_root.Stored_watch[i] = "LED"+LED_OEM_num;
i++;
};
};
};
};
//end function;