Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AS3 string to class

How can I convert a string to a class without getDefinitionByName because that class is not linked to a library item and getDefinitionByName only works with classes that are linked to library or allready initialized! Is there a way? Or I have to initialize every class I want to use?! That would be soooo stupid of Adobe!

like image 276
Alex Avatar asked Dec 28 '25 21:12

Alex


1 Answers

getDefinitionByName() will work with any class name, linked to library or not. Your problem is likely that since you're not mentioning the class name in the code, it's not in your swf at all. You will have to make sure the class is used at atleast one place in your code, if not it will not be compiled in.

This can be as simple as just putting them on a line in your Main-class:

public class Main {

    public function Main(){
        ClassYouWant;
        AnotherClass;

        codeThatDoesStuff();
    }

}
like image 58
grapefrukt Avatar answered Dec 30 '25 23:12

grapefrukt