A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [help] var problem

  1. #1
    Member
    Join Date
    Jul 2006
    Posts
    43

    [help] var problem

    var B = 1;
    var A? = 123;
    trace(A1);

    Is it possible to change the ? to variable B so the name of the var should be A1? If not can u give me an sugiestion of another code that will work the same as the code im trying to do? im making a blackjack game do i need an current card var :S

  2. #2
    Member
    Join Date
    Aug 2006
    Posts
    56
    Not exacty sure what's goin' on, here, but I think what you want is

    code:
    set ("A" + B, 123);


  3. #3
    Member
    Join Date
    Jul 2006
    Posts
    43
    thx mate that worked

  4. #4
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    Sorry to be all pendatic, but the set command has been deprecated for around 5 years now.

    The format is

    this["A"+B]=123;

    Squize.

  5. #5
    Member
    Join Date
    Aug 2006
    Posts
    56
    Well, excuuuuse me, princess.

    Honestly, I've just been using set() because I found it whilst combing through the built-in ActionScript index. ...Now I know what all those people who use tellTarget feel like.

    Thanks for the update. I'll use that format from now on, if I can remember it.

  6. #6
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,928
    Yeah sorry, wasn't highlighting the error of your ways or anything ( Well, actually I was ), but I figure it's better to show the right way to do things, as so many of the newer guys read each thread and pick up bad habits.

    As to tellTarget, it's only last year I finally let that go ( And I still won't use with{ } to replace it )

    Squize.

  7. #7
    Member
    Join Date
    Jul 2006
    Posts
    43
    yeah i think that was a little easier

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