Announcement Announcement Module
Collapse
No announcement yet.
Another way to force your class to be linked by the flex compiler Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Another way to force your class to be linked by the flex compiler

    While spelunking through the compiler generated code and some blog posts about the bootstrapping that a Flex application performs I stumbled upon another way to force your class to be linked.
    There's an undocumented metadata tag called [Frame] which you can use like this:

    Code:
    package com.myclasses
    {
        [Frame(extraClass="com.myclasses.SomeOtherClass")]
        public class MyClass
        {
        }
    }
    What you can do is add one dummy class to your class library and just add a whole list of those [Frame(extraClass=""] tags above it.
    That way you only have to import one class in your application to include a whole list of them.

    So, this means you STILL need to add extra code to for the forced linkage, so this is just another way of getting the same results...

    Anyways, maybe somebody was interested in reading about this

    Cheers,

    Roland

    P.S. And of course, this tag is undocumented, so it might be subjected to change in future versions of Flex, so watch your step.
    Last edited by 666shooter; Jan 16th, 2009, 02:34 PM.

  • #2
    Interesting, thanks!

    Note, Adobe should just address this nasty sticking point and give us an option in the compiler to include all classes in a project even if not directly referenced. They must understand that people are using containers now and doing a bit more complexly architected front-ends that require this.

    Comment


    • #3
      Hey borf,

      you have a point, maybe there's even already tickets in the flex Jira asking for this, I'll have a look when I find the time.

      cheers,

      Roland

      Comment


      • #4
        If you are building by mxmlc or via ANT you can use the include-library directive which forces all the code in a swc to be included in the swf.

        Another option is to have most of your code in a seperate lib project and link via RSL. That will force all the code to be available. Both approaches are lame if you're developing in FlexBuilder, but should at least "work"

        Comment


        • #5
          Nice trick, thanks.

          Comment

          Working...
          X