dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Need help with strings...

  1. #1
    Member
    Join Date
    Jul 2002
    Posts
    84

    Need help with strings (dynamic text box)...

    Hi - I'm trying to make a flash movie that will display a new text phrase every 10 seconds in a dynamic text box.

    Here's what I did..

    In the first frame I have a dynamic Text box with the var as "mess". On the actions scripts layer I have this:

    getTimer();
    x=getTimer();
    i=0;
    if (Number(getTimer())<(Number(x)+5000)) {
    mess="hi. How are you.";
    };
    mess1="I'm doing fine.";
    mess2="could you help me with that?";

    The first "if" statement sets up the text box to read "hi how are you".

    In frame 2 I have this code:


    getTimer();
    x=getTimer();
    i++;

    In the 4th frame I have this code:

    if (Number(getTimer())>(Number(x)+10000)) {
    mess = mess+i;
    gotoAndPlay(2);
    } else {
    prevFrame();
    play();
    }

    [b] Here's my problem. since mess is a var on the dynamic text box, whatever is inside the quotation marks gets displayed in the text box.
    But I need to do a string addition so that every time 1 is added to i, the "mess" will become equal to the next "mess" (ie.. mess1,mess2,mess3...) and thus display the next message in line.
    Right now, it will only display "hi how are you1", "hi how are you12", "hi how are you 123", etc, instead of the actual string value of "mess1","mess2",....

    I've attached the fla file in case this gets too confusing.
    Thanks for your help.
    tony
    Attached Files Attached Files
    Last edited by 98blacksnake; 01-29-2004 at 04:46 PM.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Well this is quite a bit different than how I'd do it, but considering you're so close, try changing:

    mess = mess+i;

    to

    mess = mess+this["mess"+i];

  3. #3
    Member
    Join Date
    Jul 2002
    Posts
    84
    rdoyle-
    THANK YOU SOOOO MUCH!!!!

    This worked perfectly: mess = this["mess"+i];

    Sorry for a dumb question but how did this work when mine did not?

    Also - if it is not too much of a pain to explain, how would you have done this better so that I may learn something new?!

    Thanks again
    tony

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