A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    31

    Flash MX 2004 Button and text changing.

    Hi All:
    I have created a MC to use as button. In the MC is a textfield set to dynamic. I want to be able to change the text on the button but can't find the path. I've tried target and that gives me this.myButton I need to get further down than that I think. I've just got into Flash coming from Director/VB/C. Once I get the syntax it'll be good. As usual none of the books I've read have an example. Button is one layer, actions is another that's all in the IDE.
    Help greatly appreciated,
    Thank you.

  2. #2
    Flashkit Veteran joejoe2288's Avatar
    Join Date
    Apr 2004
    Location
    Hickville, Oregon
    Posts
    2,554
    give the text field a var of textfield and then in the same level as that you can reference it with textfield and say like
    code:

    this.onEnterFrame = function() {
    textfield = random(100);
    };


    also if you want to put the actions on a higher level that the text field you can reference it like this make the instance name of the mc buttonmc and then on the same level as the mc you could say
    code:

    this.onEnterFrame = function() {
    buttonmc.textfield = random(100);
    };

    So tired of all the fighting....

    http://joejoe2288.kawanda.net

  3. #3
    Member
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    31

    Ok got that bit more help needed

    Thanks JoeJoe2288:

    The code you gave me works in the timeline of the button but does nothing in the timeline of Actions.
    In the program I'm trying to write the buttons are containers for words for the student to recognise and then will be change on a press on a continue button.
    code:

    function displayWord():Void {
    var nRnd:Number = Math.round(Math.random()*2);
    switch (nRnd) {
    case 0 :
    this.txtWord1.text = aWords[aRandomNumber[nCounter]];
    this.txtWord2.text = aDis1[aRandomNumber[nCounter]];
    this.txtWord3.text = aDis2[aRandomNumber[nCounter]];

    break;
    // and so on


    This is the code I have for using just textfields on the stage. It works but a textfield isn't a button. Hope that explains it more clearly.
    Thank you,
    Indoda

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