A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] declaring sound variable from exported as3 name, but using int variable

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Location
    Argentina
    Posts
    130

    resolved [RESOLVED] declaring sound variable from exported as3 name, but using int variable

    Hey guys,
    I have a simple question...

    I want to create a sound variable depending on the numeric value of another int variable...
    meaning: automatize the currentSnd variable depending of the soundValue
    example:

    Code:
    var soundValue:int;
    soundValue = 3;
    var currentSnd:Sound = new this["snd" + soundValue] (); //<--- not working, but something like this
    //instead of the working code:
    // var currentSnd:Sound = new snd3 ();
    (snd1, snd2, snd3, etc...are already exported to actionscript with those names...)

    Thanks a lot in advance!
    Cheers,

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Location
    Argentina
    Posts
    130
    Got help from another forum, here's the solution:

    Code:
    var currentSnd:Sound = new public::["snd" + soundValue]
    Thanks anyway!

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