Skip to main content
May 27, 2009
Answered

How to do this?

  • May 27, 2009
  • 1 reply
  • 663 views

I'm loading an XML document that contains properties about "slides" in a presentation. When the XML loads each slide builds as an object with it's params. Everything works perfect except now I need to add graphics, instead of just text, to the stage based on the slide object params. I have an object in the library being exported as "StateMap". In my xml params of the slide it's name is StateMap. How can I convert the string StateMap into a display object and then add it to the stage?

So if Slide 1B has 4 lines of text and an image from the library, I want to build the 4 lines on the stage and then place the image on the stage. The image is exported for actionscript in the library but I cannot get the xml to store a name or reference and figure out how flash converts that to a display object.

Thanks

This topic has been closed for replies.
Correct answer kglad

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

var classInstance:* = new ClassRef();

addChild(classInstance);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 27, 2009

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

var classInstance:* = new ClassRef();

addChild(classInstance);

May 28, 2009

Thanks again, works perfect!

kglad
Community Expert
Community Expert
May 28, 2009

you're welcome.