This content has been marked as final. Show 6 replies
I don't know the 'correct' way to do this in as3, but in as2 I think all that is required is
It doesn't create an instance.
e.g. if I did this, and nothing else
Then the swf compiles with the as2 VideoPlayer class included.
Perhaps you can do something similar with as3
good idea but the trouble is i'm not actually declaring variables to typecast on. And there are dozens of classes i'd like to have included which won't be tied to indiviual variables.
Well I'm not sure if I have a good handle on how you want to do it ... is it not possible to create one class that just uses something like the above approach for all the classes you want to include?
e.g. (again this works in as2)
Neither approach ties them to variables. In fact the variables are undefined. It just forces the compiler to include the class.
i'm doing a sort of modifed version of that at the moment
new Enemy3() etc etc
then remove them
Its just its a bit of a ball ache having to write out all the references to dozens of
i could do
private var enemy1:Enemy1
private var enemy2:Enemy2
etc etc but then these variables are declared and hanging around taking up memory and cpu time is needed to declare them.
All the instatiation is done on the fly using strings from XML then referenced to class definitions with "getDefinitionByName"
I'm sure there must be a way to say
force include import Game.Enemies.*
force include import Game.Weapons.*
I understand what you're looking for and yes... it would be very useful to have that approach.
I don't think it was there for as2. I don't know if it exists for as3. Let's hope someone else knows...