Hi everyone. I’m playing with AS3 for a couple of weeks now and i can’t figure out an elegant way to do this. Here’s what i’m trying to do:
I’m writing a parallax class to mimic depth in 2D. I made my graphics in AI, imported them into Flash and exported MovieClips for actionscript. The class accepts the speed of the background and it should accept the name of the background MC class. Here the problem occurs. How can I pass an optional class name of a MovieClip to my parallax class, so i can create instances of it there, without hardcoding the name in it?
I tried evaluating the sent name, it didn’t work. Tried passing a created instance to the class, but at some point i need to duplicate it, tried copying it with ByteArray class, didn’t work either… now i’m running it with hardcoded names of my parallax background movieclip class names in it.
Any tips on how to solve this problem would help a lot! Thank you