Results 1 to 3 of 3
Thread: Control TextField
December 22nd, 2009, 03:49 PM #13Registered User
I have been hammering at this for some time now, and it is getting a little frustrating.
1. I have a document class that adds a TextField.
2. The Doc class then adds another custom class (MovieClip).
3. Inside that custom class (MovieClip) is a button with an addEventListener that needs to update the TextField on the main stage (or root).
I have tried so many possible solutions that I am not going to list them here, I am sure I must be doing something fundamentally wrong...
December 22nd, 2009, 07:01 PM #220Registered User
if you post your code that would be clearer, one of the methods to call the function from a helper class is sending the function name as a parameter to the helper class
say you have a class constructor function
public function MenuClass(str:String='menu.xml', __btnMoveSpeed:Number = 3 , __func:Function = null )
__func paramater sends the function to the externall class so you could simply call it from the class
hope this helps
December 23rd, 2009, 08:40 AM #33Registered User
public class DocClass extends MovieClip
public var TF:TextField = new TextField();
public var Holder:MovieClip = new MovieClip();
public var CM:CustomMC = new CustomMC();
TF.text = "cup"
addChild(Holder); //Blank MC used for resizing//
public class CustomMC extends MovieClip;
public var Page:MovieClip = new MovieClip();
public var Cancel:TextField = new TextField();
root.TF.text = "coffee"; //Option One - No Joy//
stage.TF.text = "coffee"; //Option Two - No Joy//
trace(Cancel.parent.parent.parent); // No Joy //
MovieClip(root).TF.text = "coffee"; // No Joy //
This is the basic structure, that hopefully clears up the question. I am not sure if I am missing something simple, or if you just can access an absolute path of the entire movie.
I pulled this off the top off my head, so if there are small obvious issues, please ignore them, as they are likely a typo, and please focus on the structure and the means of communication between the custom class and the root (absolute path).
Thanks in advance.