Be a Supporter!

AS2 to AS3 issues

  • 264 Views
  • 3 Replies
New Topic Respond to this Topic
<deleted>
AS2 to AS3 issues 2010-05-20 20:34:59 Reply

I'm making the effort to rid myself of ASS2. Oh I meant AS2. Damn type-o's. =p

Anyway, In AS2 to access any MC I usually just did:

_root["mc_" + id]

This was very useful for creating say 50 MCs with AS then assigning a script to them. Can this be done in AS3?

meneldil
meneldil
  • Member since: May. 27, 2004
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS2 to AS3 issues 2010-05-20 20:46:54 Reply

Use an array.


Indescriptive topic names have left me in despair!

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to AS2 to AS3 issues 2010-05-20 20:50:56 Reply

Well you can get children by their name, so technically yeah you can do the same thing. But since your objective is to rid yourself of your bad as2 habits, why is your first instinct to find a similar bad habit in as3? :P


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to AS2 to AS3 issues 2010-05-21 03:35:30 Reply

At 5/20/10 08:34 PM, SmartNoob wrote: _root["mc_" + id]

This was very useful for creating say 50 MCs with AS then assigning a script to them. Can this be done in AS3?

Even in AS2 you should have choosen an Array. Because you want to use this like an array, but it's a hash. It works, but it's not good.

There are vectors, too.