15 Replies Latest reply on Jan 23, 2012 7:24 AM by Meijuan Yin

    flex 4.5 weird issue

    agile116@hotmail.com Level 1

      Hi All,

       

      I have encountered a weird issue after I migrated my application from flex 3.5 to flex 4.5.

      In our application, we have 3 kind of views, View, ChartView and StackedView, the later extends the former one, let's say, in ChartView we have

      <local:View...>....</local:View>, in StackedView we start with <local:ChartView>. We config the view type in the database as View.swf, ChartView.swf and StackedView.swf. The problem here is for example, if I load a view with StackedView.swf and change to a view with ChartView.swf, some of the components will not initialized, we get runtime exception like

      ArgumentError: Error #2004: One of the parameters is invalid.

          at flash.display::Graphics/drawRect()

          at mx.controls::VRule/updateDisplayList()[E:\dev\4.5.1\frameworks\projec ts\mx\src\mx\controls\VRule.as:256]

          at mx.core::UIComponent/validateDisplayList()[E:\dev\4.5.1\frameworks\pr ojects\framework\src\mx\core\UIComponent.as:8989]

          at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.5.1\framewo rks\projects\framework\src\mx\managers\LayoutManager.as:736]

          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.5.1\frame works\projects\framework\src\mx\managers\LayoutManager.as:801]

          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.5 .1\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180 ]

      We debugged into the code, and found that the exception occoured before the parent component is initialized. Actually the parent(or the parent's parent) component's height or width is NaN.

      By the way, if we load ChartView.swf directly, everything works perfectly.

      And I just solved the problem by spliting the 3 type of views, say, keep the View.swf, comibine the code from View.swf with ChartView.swf to a new ChartView.swf, the same to StackedView.swf, which now combines 3 type of views' code.

      Though the problem is solved, but everyone can see it's not an elegent way, and the maintenence cost is high.

      I suspect it is something related to load module or unload module, seperating the 3 type of views just make sure they didn't share something.

      Can any expert help me figure this out? Many thanks.