A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Help with array and text.

  1. #1
    Junior Member
    Join Date
    Apr 2005
    Posts
    11

    Help with array and text.

    Hi, I'm new to flash mx 2004 and I'm trying to get a simple program to work where you press a button, and the name of the month changes to the next month, but I can't seem to get the code working.

    months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','S ep','Oct','Nov','Dec'];
    i=0;
    B3.onRelease=function(){
    if(i>10){
    i=0;
    }else{
    i++;
    }
    trace(i);
    trace(months[i]);
    }

    When I test the movie, I get an output on the output screen but it doesn't change the text in the dynamic text box. I'm sure the names are labled correctly, and I made the text box dynamic, why won't months show up in the text box?

  2. #2
    magnetologicus Magnetos_II's Avatar
    Join Date
    Jan 2004
    Location
    real date May 2001
    Posts
    572
    your code works fine just add a dynamic textfield which in this case i call it msg

    Code:
    months=['Jan','Feb','Mar','Apr','May','Jun','Jul',
    'Aug','Sep','Oct','Nov','Dec'];
    i=0;
    B3.onRelease=function(){
    if(i>10){
    i=0;
    }else{
    i++;
    }
    
    msg=months[i];
    }

  3. #3
    Junior Member
    Join Date
    Apr 2005
    Posts
    11
    I still can't get it to work, it's displaying the months in the output box but it's not changing the text in the dynamic text box at all.

  4. #4
    magnetologicus Magnetos_II's Avatar
    Join Date
    Jan 2004
    Location
    real date May 2001
    Posts
    572
    ok its because you have to name your textfield
    or else flash dont know where to output it


    here is how you name your dybamic textfield


    select the text tool and make a the textbox
    then open the properties panel
    on the right next to "var" there is a white space enter (type) a variable name i used msg

    that ought work

  5. #5
    Junior Member
    Join Date
    Apr 2005
    Posts
    11
    Yay! It's working! Thank you for the help.

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