HTML5 Canvas: Load MC from Library - Assign Instance Name?
This code does load either object from the library, but fails to assign the loaded object the specified Instance Name:
function ChinaPD(e)
{
window.PDisplay = stage.addChild(new lib.PDisp_CH());
this.PDisplay.x = 1629.15;
this.PDisplay.y = 96.65;
}
function NotChina(e)
{
window.PDisplay = stage.addChild(new lib.PDisp());
this.PDisplay.x = 1629.15;
this.PDisplay.y = 96.65;
}When referred to after either object is loaded (it's always one or the other, never both), the MC does not respond to commands, only producing the error:
- Uncaught TypeError: Cannot read properties of undefined (reading 'gotoAndStop')
- exportRoot.PDisplay.gotoAndStop("CO2"); is the culprit...
Shouldn't this work? Any insight as to why it doesn't?
Thanks.
