3 Replies Latest reply on Aug 2, 2010 3:58 AM by www.marcelvanduijn.com

    Changes in RSL or merged-into-code SWC not updated when running or debugging a Flex project?

    www.marcelvanduijn.com Level 1

      Hi,

       

      Im kind of new to using Flex. Can anyone tell me if its normal that SWC's either linked as RSL or merged-into-code dont update when you make changes to the SWC's? I have 'Build Automatically' checked under 'Project'. When I run or debug my project the updates arent

        • 1. Re: Changes in RSL or merged-into-code SWC not updated when running or debugging a Flex project?
          www.marcelvanduijn.com Level 1

            Sorry, submitted the post by accident. I wasnt ready typing yet.

           

          Im using separate SWC's as asset library and for custom components, linked either as RSL or merged-into-code. But Flex's updating behavior when I made changes to the SWC's is knd of weird. It seems to use some kind of caching or something. Additions to the SWC's are taken into account when I run or debug the main project, but when I remove say an asset from the asset library it is still present and I can use it my code. I have 'Build Automatically' checked under 'Project'.

           

          Example of what happens: say I have an asset library with a 'Circle' asset. The asset library is linked as RSL

           

          1. I use the Circle as background of WindowedApplication: backgroundImage="{Circle}" --> works fine

           

          2. I add a 'Rect' asset to the asset library. Then use Rect as background:  backgroundImage="{Rect}" --> works fine. The RSL is updated

           

          3. I remove 'Rect' from the asset library (and publish the SWC) but leave backgroundImage="{Rect}" in my code --> now the RSL is not updated when I run or debug my project! I can still use the Rect class while it isnt in the asset library anymore (nor anywhere else). This isnt supposed to happen right?

           

          4. Now when I set the background image to Circle again: backgroundImage="{Circle}" --> this works fine, as the Circle class is in the asset library

           

          5. I set the background image to Rect again: backgroundImage="{Rect}" --> only NOW Flex kind find the class

           

          So it appears, to me at least, that Flex is kind of caching class definitions when you keep references to them in your code. Is this supposed to happen?

           

          By the way, the only way Im able to link external SWCs  is by adding the folder where the SWC's recide to the projects' source-path. But that seems to clutter the output root folder with everything in the source-path folder. I dont like that.

           

          What I'd like to know is if this behavior of Flex is normal, or if Im doing something wrong, etc.

           

          Thanks a lot in advance for any information on this behavior.

           

          Marcel

          • 2. Re: Changes in RSL or merged-into-code SWC not updated when running or debugging a Flex project?
            injpix Level 3

            When you have SWCs linked as RSLs, you should be able to introspect whats in them with Flash Builder.  If I recall correctly, in the Project Navigator (or

            Package Explorer) panel it will have your current project open and there should be an item named, Referenced Libraries.  In Referenced Libraries, you can drill down into your asset SWC, you should see what is actually in it.

             

            So when you do this, does it reflect the updated SWC?  Also how are you publishing this SWC of yours?  If you're doing this in Flash Builder, versus Flash IDE, you can publish them by doing a Project Clean or doing a Release, I think.  I have been doing Cleans to simply build my SWCs.

             

            And, if you dont have Flash Builder, a SWC file is an archive file that you can unarchive by changing the file extension to .ZIP.  By doing this you can see what is available by reading the XML that is in it.


            I hope that helps, let us know.

            • 3. Re: Changes in RSL or merged-into-code SWC not updated when running or debugging a Flex project?
              www.marcelvanduijn.com Level 1

              Hi,

               

              thanks for your input. I published the SWC with the Flash IDE. But I dont think that seems to matter. Doing a project clean resolved the issue.

               

              It was a bit confusing as Im new to Flex and expected Flex to use latest versions of SWCs when running or debugging a project (with build automatically checked), at least for dynamically linked RSLs. Im still not sure wheather the behavior is supposed to be like that.

               

              Anyway, for your reference and as a thanks for the fact that you put your time in this problem, I reproduced the situation. After I had changed the RSL SWC and before running a debug of the project I checked what classes were in the SWC (via catalog.xml). This is what I encountered:

               

              1. I published the SWC from Flash IDE. It contained 2 classes, 'Rect' and 'Circle'. The SWC was linked as an RSL in my Flex project

               

              2. I set backgroundImage="{Rect}" for the WindowedApplication and runned a debug. --> works fine

               

              3. I set backgroundImage="{Circle}" for the WindowedApplication and runned a debug. --> works fine

               

              4. I removed 'Circle' from the SWC, checked that it was removed before running a debug (which it was), left backgroundImage="{Circle}" in my WindowedApplication MXML tag and runned a debug --> the RSL wasnt updated. WindowedApplication still had Circle as a background.

               

              5. only when I ran a Project Clean Flex reported that Circle was undefined.

               

              I still think its a bit weird, but am glad to know how to make sure that a latest version of an SWC is used.

               

              Once again thanks, and regards,

               

              Marcel