goseta
goseta

Reputation: 790

Adobe Flex compiler include classes

I'm trying to create and instance of an object by reference the class object of the class using

getDefinitionByName()

the problem is that if I don't create at least one instance of the class before when try to use getDefinitionByName() it say

ReferenceError: Error #1065: Variable XXXXXX is not defined.

how can I include the class in the binary without using and instance first??, also I had tried to juts leave in the import but still don't include the class, it could be a compiler param I can pass??

I'm using Flex SDK 4.6 thanks!!!!!

Upvotes: 1

Views: 635

Answers (3)

user797257
user797257

Reputation:

There is a bunch of compiler options which allow you to include classes, but they aren't very scalable / require some manual labour. For example, there's -includes option, but you must know what symbols to include. There's -include-libraries, but again, you'd have to compile a SWC library with the classes you need. -include-namespace - you'd need to write the namespace definition, listing all classes that you want to include.

Since I imagine that the task in the end will get automated one way or another, it would make more sense to just generate an AS file of the following format:

package your.app {
   import fully.qualified.class.Name;Name; // it is enough to just mention it
   . . .
}

And then include only this this class.

Upvotes: 2

goseta
goseta

Reputation: 790

Well I think I found the solution, just add to the compiler the argument -includes like thised

-includes com.example.Myclass

that will include the class object in the binary even though u haven't used and after tried to load it with getDefinitionByName()

hopes this help to someone else, also here is a complete list of arguments for the compiler

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a92.html

Upvotes: 0

dvdgsng
dvdgsng

Reputation: 1741

As described in the documentation:

-includes class Links one or more classes to the resulting application SWF file, whether or not those classes are required at compile time

Upvotes: 2

Related Questions