4 Replies Latest reply on Jun 14, 2009 6:10 PM by Yuhjn

    swc problem with flex from my custom fla

      I have an fla which has several library items with a class linkage to a GenericButton.as file. I am exporting this fla as an swc file, and linking that swc into flex.


      My problem is that when flex builds the code for GenericButton it gets undefined property for anything it tries to reference that is part of the library item.




      GenericButton.as does libLabel.text = "something"; where libLabel is a textfield, instantiated in the library clip which is bound to GenericButton in it's class linkage.


      The field exists in the clip, but when I compile in Flex with the swc in there, it cant find it. It says libLabel doesnt exist, undefined property.


      What am I missing here? I want to allow the fla author to bind some of his items to low-level component classes like that, and it's his job to ensure that all the necessary items are part of it. So if he makes a new button, he must just ensure he has a libLabel textfield somewhere in the clip.


      Why cant flex see that the items it's trying to compile have a libLabel in there? Is there a work around?
        • 1. Re: swc problem with flex from my custom fla
          Gregory Lafrance Level 6

          I think in Flash when you create symbols there is a checkbox to export for use in ActionScript. That allows the symbol to be accessed in Flex.

          • 2. Re: swc problem with flex from my custom fla
            Yuhjn Level 1

            Thx for the reply Greg, but no, that's not the problem.  If you re-read my post you'll probably see my problem is a little more involved than that.


            I have symbols exported for actionscript and I can instantiate them in Flex, that's not a problem.  The problem is symbols that are exported for actionscript and bound to a base class that contains custom code.  That custom code, when it uses it to type-check in flex builder (during the swc link stage), causes undefined properties.


            For some reason Flex is not seeing that the exported library item has the things the .as file is looking for.


            Does that make sense?


            I could probalby put together a simple example project but I'd have to find somewhere to upload it so that others could see.


            This problem is hard to describe, you have to read what I'm saying very carefully.

            • 3. Re: swc problem with flex from my custom fla
              Yuhjn Level 1

              I have a attached to this post a very simple flex builder project along with an fla.  The fla is set to export as swc, and the flex project imports it.  The fla contains a movie clip that is exported for actionscript and includes a class binding.  When I instantiate an object of that exported type, the .as class bound to it doesnt complie in flex.


              Attached is this simple project.


              To produce the error just compile it in builder.  From there you can go into the fla if you need to to see my export settings.





              • 4. Re: swc problem with flex from my custom fla
                Yuhjn Level 1

                problem solved:

                Problem was the items that were crashing the compile were defined on the class, not the base class.

                The fix was to define public fields in the base class code that had names that exactly matched the members in the library clips.  The AS3 just took care of them and filled them out for me.