reference textfield on timeline
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: reference textfield on timeline

  1. #1
    Join Date
    Jan 2004

    reference textfield on timeline

    In de Flash IDE I create this movieclip 'MC1' and assign class to it.

    On the timeline, I add a textfield 'TF1'.

    Now, in I can change the textfield easily: TF1.text = 'text here'.

    This works perfectly and I should not complain... however;

    Is there a way I can tell my class that there is a TF1 that is a textfield? So I can use codehinting?

    If I add

     var TF1:TextField;
    the reference to the textfield is lost and now NULL. So that does not work.

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Oregon, USA
    You can create a variable for it but you'll hit the code-before-stage problem. Basically your class constructor can be run at "frame -1" so that everything is set up properly before everything is added into the display work around that you need to wait until the display items are all added before you grab the reference to the textfield.

    PHP Code:
    public var TF1:TextField;

    //  constructor
    public function MC1(){
    addEventListener(Event.ADDED_TO_STAGE, function(e:Event):void{
    TF1 TextField(getChildByName('TF1'));

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center