Reputation: 638
I have some action script in the first layer and it imports a CustomSocket
class from an external .as file. When I receive a command on the socket I want to edit the GUI objects. For example, when I get the command TIME 23
from the server I want to change the dynamic text box timerBox
to the value 23
. I have a method called processCommand(cmd:String)
in the CustomSocket class, but I don't know how to change the text. Usually you can just do timerBox.text = "23";
but this doesn't work in an external class?
Upvotes: 0
Views: 77
Reputation: 729
If 'CustomSocket' is not your document class, then you need to specify some reference for your timeline in your class.
For general example,
While importing a class,
import CustomSocket;
csObj:CustomSocket = new CustomSocket(this);
then, inside class, in constructor
public function LibraryS(_ref:Object):void
{
timelineRef = _ref;
}
then in your class you can say,
timelineRef.timeBox.text = "23";
Upvotes: 1