Skip to main content
Participant
January 31, 2013
Answered

Array of Class Names

  • January 31, 2013
  • 1 reply
  • 338 views



I've got several movieclips in my FLA library with classnames applied.  In my AS package file, I've got an array of those classnames.  What I'd like to do is display the movieclips on stage as follows:

  • Upon SWF load, Array[0] displays
  • When NEXT button is clicked, add 1 to array, then display
  • When PREV button is clicked, subtract 1 from array, then display

Total n00b question, I'm sure.  I understand the basics, but calling the classnames has me confused.  Any help would be appreciated!

This topic has been closed for replies.
Correct answer Ned Murphy

To add class instances dynamically you can use the following, where className is a String representation of the class name...

var ClassRef:Class = Class(getDefinitionByName("className"));

var classInstance:* = new ClassRef();

addChild(classInstance);

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
January 31, 2013

To add class instances dynamically you can use the following, where className is a String representation of the class name...

var ClassRef:Class = Class(getDefinitionByName("className"));

var classInstance:* = new ClassRef();

addChild(classInstance);