1 Reply Latest reply on May 19, 2011 12:37 PM by Flex harUI

    How can I ensure all classes are available to an app at run time?

    Dominic Thwaites Level 1

      This is a general query relating to ongoing issues I have when a flex application fails due to some class not being found.


      I cannot give a specific example of the issue, as they always differ in details at the time. It always takes considerable time to resolve one way or the other and in the process I've understood quite a bit about how the compiler and the run-time deals with libraries. But clearly not enough!


      Generally, flex compiles by including only those classes in its referenced libraries that it actually uses. You can choose to specifically exclude classes and libraries and you can choose to specifically include classes and libraries even if they are not referenced.


      So far as my classes are concerned, I have no issues. I use all these features. For example, If I instantiate classes dynamically in my code, then I know I have to instruct the compiler to include those classes specifically.


      Trouble is, it is clear that the flex libraries do this also - dynamically creating classes that can not be detected by the compiler. When statically binding the flex libraries this can cause issues (as it only statically binds [merges]) those it knows about. Default skins is one example - they are not found by the compiler. In 4.5 the compiler generously provides a warning that the run-time might fail due to default skin classes missing. Trouble is, the suggested solution is to not merge in the libraries but to have them as RSLs. But I have a situation where this is not an acceptable "solution". So how do I know what those missing skin classes are and then tell the compiler to include them?


      The issue also seems to rear its ugly head with CSS SWFs. I have a situation now that, no matter how "big" (i.e. try and get it to include as much as possible) I make the CSS SWF, it fails on load because it cannot find some interface classes (IModule, IUIComponent etc). How do I know which classes its missing? I even try declaring these classes in the host application (forcing the compiler to include them), but it still fails. How can I make sure a CSS SWF has all the classes it needs?


      There just seems a horrible lack of transparency on how and what classes are compiled in vs what are actually needed due to the extensive run-time class instantiation. Am I missing something, or is this understood to be an issue?


      Thanks for any feedback