A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: TextField in a movie clip

  1. #1
    Junior Member
    Join Date
    Dec 2002
    Posts
    7

    TextField in a movie clip

    I have a movie clip called M1. In M1 there is dynamic textfield called T1.

    I want to change the text in T1, how do i access it from the stage?
    is it _root.M1.T1="xxxx"? <---- does not seem to work

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Posts
    405
    If you use the onclipevent you can create variables on the main timeline that can easily be accessed and manipulated in the MC. For example this code is attached to an MC on the main timeline:
    Code:
    onClipEvent (load) {
        total = _root.getBytesTotal();
    }
    onClipEvent (enterFrame) {
        download = _root.getBytesLoaded();
        bytesleft = _root.getBytesTotal()-_root.getBytesLoaded();
        percenttxt = int(_root.getBytesLoaded()/_root.getBytesTotal()*100)+"%";
        percent = int(_root.getBytesLoaded()/_root.getBytesTotal()*100);
    }
    Then in the first frame of tje MC I test the value of 'percent':
    Code:
    if (percent  >= 30) {
        gotoAndPlay ("tween");
    }
    I also display the value of 'percenttxt' in a dynamic textbox within the MC.
    If you attach an onclipevent to M1 similar to this:
    Code:
    onClipEvent (enterFrame) {
        if (!T1) {
            T1 = initvalue;
        } else {
            T1 = othervalue;
        }
    }
    Then just create 'othervalue' and go back to the first frame where M1 is.
    hope that helps....

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