Ok so I have game data parser that creates a game out of data file basically, it is using extensively getDefinitionByName which has one problem if the class is not loading somewhere else it throw variable not defined error information=ReferenceError: Error #1065: Variable {MyClass} is not defined. to workaround it I am using a class that holds all the list of components and instantiate it to make these classes available to the compiler. Ok the question part is there any more efficient way to do that or playing with compiler argument or something ? Is there something like export in first frame in flash professional as a compiler argument ?
1
votes
1 Answers
1
votes
I think what you want is to have a library project with all those "callable" classes, and then reference that library project in your game.
In flash builder, for a library project, you can check which classes are compiled (and so available to getDefinitionByName). (info here)
myClass;
. Simply as that. Do not instantiate it, but just write it's name and the compiler will know that it should be compiled for usage. – Andrey PopovgetDefinitionByName
targets. For me it was[Gem01,Gem02,...]
array, and then I was using "Gem" and two digits to get the required gem image. In short, you need to have a hard reference somewhere in the compiled area forgetDefinitionByName
to return something. – Vesper