1 Reply Latest reply on Aug 12, 2010 12:55 AM by christoferdutz

    Errors when using Spark Buttons in dynamically loaded modules loaded by dynamically loaded modules

    christoferdutz Level 1

      Ok ... I have to admit this issue is rather special ;-)


      I have a flex application that loads a list of modules after the user logs in, depending on the permissions of the user.

      One of these modules contains a component, that allows the user to configure settings for different types of objects.

      For each object type (can be extended) there exists one module swf.

      The strange problem I am having now is that as soon as a Spark Button (or anything derived from one ... CheckBox) inside the settings-module. I get the following error (unfortunately in german ... but I'll try to translate).

      This error happens when using a spark CheckBox (Which is derived from Spark Button):


      ArgumentError: Error #2004: Einer der Parameter ist ungültig.

      at flash.display::Graphics/drawRect()

      at mx.graphics::RectangularDropShadow/drawShadow()[E:\dev\4.x\frameworks\projects\framework\ src\mx\graphics\RectangularDropShadow.as:575]

      at mx.skins.spark::BorderSkin/updateDisplayList()[E:\dev\4.x\frameworks\projects\sparkskins\ src\mx\skins\spark\BorderSkin.mxml:174]

      at mx.core::UIComponent/validateDisplayList()[E:\dev\4.x\frameworks\projects\framework\src\m x\core\UIComponent.as:8709]

      at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.x\frameworks\projects\framework \src\mx\managers\LayoutManager.as:663]

      at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:718]

      at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects \framework\src\mx\managers\LayoutManager.as:1072]


      When having a look at the problem the cause is that width and height are not set (NaN).

      If I use a plain Button I get the same error in "drawRoundRect".

      As soon as I change back to a mx-Button/Checkbox, everything is fine.


      In my current Case I wanted to use a custom TreeItemRenderer to display a CheckBox in the tree. This tree Item renderer is included in a custom Lib that is used by all modules.

      I have one Second Level module using this renderer. I have one Third Level Module thas uses the exact same tree definition. If I use the MX CheckBox I get CheckBoxes in the Second- and Third-Level Module. If I use the Spark-CheckBox I get a CheckBox in my Second Level Module and the above Error in the Third Level Module.


      To make everything even stranger: I have a custom component loading my modules and I use this in the Top Level Module to load the Second Level Modules and in my Second Level Module to load my Third Level Modules (So I would guess If my loader is broken, then the Second Level Modules should not work either).


      Help is greatly appreciated :-)




        • 1. Re: Errors when using Spark Buttons in dynamically loaded modules loaded by dynamically loaded modules
          christoferdutz Level 1

          Ok, I managed to find out what was going wrong and to get my stuff working again. I have to admit that I have no idea why my application / flex was showing this behaviour. The only way I could track this down was by undoing the Subversion checkins one by one. Finding out what was happening using common sense seems to be out of the question with this issue.


          My application is built up of a main application swf that loads module swfs and a library swc that contains common stuff and is used in the main application and the modules.

          I now had some custom TreeItemRenderers in my modules. The problem was caused by moving a custom TreeItemRenderer from one module to the library-swc. I could successfully reproduce this. If I add only one class extending TreeItemRenderer to my library (I don't even have to use it), the entire flex system goes haywire. As soon as I remove that class, everything is ok. I checked, if there might be a problem with third party libs containing flex core classes which might be used instead of the sdk ones, but after looking at the catalogs of the third party swcs I couldn't find a reference to TreeItemRenderer.


          Any Ideas? I sort of dislike the idea of being able to run into such strange problems. Is there a tool that allows me to check for class compatibility issues?