I’m using Flash CS3 and ActionScript 2. I have a MovieClip symbol (identified as ‘MySymbol’) that contains a dynamic text block with the identifier ‘innerText’. The symbol is marked as ‘Export for ActionScript’ using the following ‘MySymbol.as’ file:
class MySymbol extends MovieClip { function SetText(text) { innerText.text = text; } }
In the frame actions, I tried doing the following:
var symInst = _root.attachMovie('MySymbol', 'MySymbol' + _root.getNextHighestDepth(), _root.getNextHighestDepth()); symInst.SetText('hi'); // Fails symInst.innerText.text = 'hi'; // Works
I get the compile error:
There is no property with the name 'innerText'.
Why is it that I can access the innerText from the frame actions, but not reference it within the .as file itself?
You are getting a compiler error because ‘innerText’ is not available to the class at compile time (i.e. it’s available at runtime).
A quick fix is to use
instead of