Do I understand that you have a different class for every question? That sounds like a bad idea. I am sure import is a compile time only action, and you can't do it at run-time, so you need to find a different approach.
Tracy _____ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Wally Kolcz Sent: Sunday, March 08, 2009 1:08 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] importing and dynamically creating objects I am trying to create a quizzer when the questions are in components. I want to import the component and add it to the stage based on the question that next and the quiz they are taking. If they load test 1 i need it to: import com.ipexpert.test.1.question1; var currentQuestion:question1 = new question1; questionArea.addChild(currentQuestion); I have the varible for the test loaded: testID and the current question: questionNum I am trying to build it on the fly with something like: import com.ipexpert.tests. + testID + "." + "question" + questionNum; var currentQuestion:question + questionNum = new question + questionNum; questionArea.addChild(currentQuestion); Needless to say it is wrong and I am getting an errors: 1084: Syntax error: expecting identifier before plus. for the first line (imprt com.ipexperts...) and 1086: Syntax error: expecting semicolon before plus. for the second line (var currentQuestion...) Any better ideas or how can I write this right?