JavaScript - switching from ActionScript
I design graphics and animations for computer based learning, and we are preparing to make a leap to an HTML5 based lessons vs. SWF in HTML. So some of my assets are panels and gauges of an aircraft cockpit, so the panels have toggle switches, knobs and lights. If a student clicks on switch it may turn a light on for instance. Sometimes the panel is just static with all its components set in certain states i.e. a light off and toggle switch in the off position. These assets are code controlled, very simple code when it is static.
My actionScript:
//toggles are down center up
testPanel_mc.oxyToggle_mc.gotoAndStop("down");
testPanel_mc.probeToggle_mc.gotoAndStop("down");
testPanel_mc.epuToggle_mc.gotoAndStop("up");
testPanel_mc.testToggle_mc.gotoAndStop("up");
In JavaScript will I need to have this code in a function vs. what did in ActionScript?
What is good source to learn some basics using Animate HTML5/JavaScript?
Is there a official API for JavaScript?
Thank you in advanced.