roscoman
07-18-2006, 10:26 AM
OK
I have made a MovieClip called fred with a dynamic text field in it, the text field is called myText.
I have made a class like this:
class FredClass extends MovieClip
{
public function FredClass() {}
public function changeText(newText)
{
myTextField.text = newText;
}
public function changeFrame(newFrameNumber)
{
gotoAndStop(newFrameNumber);
}
}
Then I update the appropriate linkage properties of the fred symbol to link it to the class. Then I place an instance of fred on the main stage and call it aFredInstance. I can tell that all this works because I can successfully call the changeFrame() function and that works.
However, if I try to change the text in the text field using:
_root.aFredInstance.changeText("some new text");
I get the following error:
There is no property with the name 'myTextField'.
this.myTextField.text = newText;
What am I doing wrong? How do I access objects within the symbol and change their properties?
Many thanks
Ross
I have made a MovieClip called fred with a dynamic text field in it, the text field is called myText.
I have made a class like this:
class FredClass extends MovieClip
{
public function FredClass() {}
public function changeText(newText)
{
myTextField.text = newText;
}
public function changeFrame(newFrameNumber)
{
gotoAndStop(newFrameNumber);
}
}
Then I update the appropriate linkage properties of the fred symbol to link it to the class. Then I place an instance of fred on the main stage and call it aFredInstance. I can tell that all this works because I can successfully call the changeFrame() function and that works.
However, if I try to change the text in the text field using:
_root.aFredInstance.changeText("some new text");
I get the following error:
There is no property with the name 'myTextField'.
this.myTextField.text = newText;
What am I doing wrong? How do I access objects within the symbol and change their properties?
Many thanks
Ross