Welcome, Guest
  • Author Topic: concatenate variables  (Read 15997 times)

    corneliu munteanu

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    concatenate variables
    « on: 02/11/07, 11:55 »
    hi everybody, I am beginner with AS, sorry
    maybe someone can help me.
    my problem is:
    I have a number of checkboxes, which are keys with the following code :
    key1.onRelease = function() { myVar1 = "1"};
    key2.onRelease = function() { myVar2 = "16"}
    key3.onRelease = function() { myVar1 = "24"};...etc
    I want to display in a dynamic textfield all these values in order, that means
    the return must be : 11624....
    I have tryed with :
    myCode = myVar1+myVar2+myVar3+...., myCode is the var name of the dynamic textfield, but the result is NaN. where is the mistake, or how must I proceed? thank you in advance.

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: concatenate variables
    « Reply #1 on: 02/11/07, 12:31 »
    make sure myCode is a string.

    var myCode:String;

    ....

    then the concatination
    happy flashing
    8)
    Ronald

    corneliu munteanu

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re: concatenate variables
    « Reply #2 on: 02/11/07, 14:51 »
    Thanks, but even I declare myCode as a String, it doesn't work

    Andresss

    • Systems Administrator
    • *****
    • Posts: 738
    • check me out at www.asb-labs.com/blog
      • View Profile
      • asb-labs
      • Email
    Re: concatenate variables
    « Reply #3 on: 02/11/07, 23:57 »
    hello corneliu munteanu!!! well in that case you need to add something like:

    1) use a split for example:myVar1+"|"+myVar2+"|"+myVar3

    2)if not(in case you do not want to use a split) then use something like:myVar1+""+myVar2+""+myVar3

    cheers!!!
    halemos de flash en espaņol!....wondering about crazy flash experiments?

    corneliu munteanu

    • Server what's that
    • *
    • Posts: 7
      • View Profile
      • Email
    Re: concatenate variables
    « Reply #4 on: 02/12/07, 04:21 »
    tks. I am at the office now. Iwill try at home this evening.

    ronu008

    • Server what's that
    • *
    • Posts: 1
      • View Profile
      • Email
    Re: concatenate variables
    « Reply #5 on: 01/15/09, 05:09 »
    Hello,
    I'm making one Calc using Flash MX 2004.I'm begginer.Ther Problem I Find is tha I can't add two numbers.My code is

    on(keyPress "+")
    {
       x="";
    }
    on(release)
    {
       var temp1,temp2;
       temp1=x;
       x="";
       
       temp2=x;
       x="";
       
       x=Number(temp1)+Number(temp2);
       //temp=x;
    }

    How can I Scan two numbers that user enters?Plz help me...Post required code on ADD Button.
    -Thanx...