14 Replies Latest reply on Aug 11, 2009 3:21 PM by Flex harUI

    Old Flex App suddenly has an error?

    Developer504

      We have several custom Dashboards we wrote in Flex 3 several months ago which are deployed with various customers around the country.  Haven't done anything in Flex for about six months, until recently when I was tasked to customize another one of these Dashboards for a new customer.

       

      Much to my surprise I found that when I ran my Dashboard from Flex Developer I get an error, apparently due to a drawing method drawRect().  Luckily for me this error only appears when I run from Flex Developer, when I compile the App it runs fine.

       

      I now need to determine the source / cause of this error, which apparently is being caused by one of the Components we use in the Application, some Degrafa stuff and a Treemap component to which we don't have all of the source code.  I may have to find the answer in some other site (where we found the components) but I'd like some insight into what is happening here.

       

      I would also very much like someone more skilled than I am with Flex (I am a beginner Flex programmer myself) to explain to me why an Application which worked fine for almost a year would suddenly develop a problem in the code which did not exist before?   This kind of thing would not happen with the other software development tools we use.

       

      This is the error I got.

       

       

      ArgumentError: Error #2004: One of the parameters is invalid.
      at flash.display::Graphics/drawRect()
      at mx.skins::ProgrammaticSkin/drawRoundRect()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\skins\ProgrammaticSkin.as:739]
      at mx.skins.halo::TabSkin/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\skins\halo\TabSkin.as:397]
      at mx.skins::ProgrammaticSkin/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\skins\ProgrammaticSkin.as:421]
      at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:622]
      at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:677]
      at Function/http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
      at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]

       

      Any help would be veyr appreciated.

       

      Jean

        • 1. Re: Old Flex App suddenly has an error?
          Gregory Lafrance Level 6

          Was the app built in an earlier version of the SDK? Can you post the code that is throwing this error?

          • 2. Re: Old Flex App suddenly has an error?
            Flex harUI Adobe Employee

            Smells like a timing or configuration change.  Some folks using SWFObject had things like this happen when IE8 came out.  It messed up the initialize sizing of the app causing things to have invalid values.  It could also be something where some code that determines the size of the TabNavigator is dependent on a server fetch that is delayed or some other dependency like that.

             

            Alex Harui

            Flex SDK Developer

            Adobe Systems Inc.

            Blog: http://blogs.adobe.com/aharui

            1 person found this helpful
            • 3. Re: Old Flex App suddenly has an error?
              Developer504 Level 1

              This was developed in Flex 3, though I'm not sure which precise sub-version.

               

              I could post the code but it's fairly large (534 lines), and like I said I think the error is buried in one of the components, probably the Treemap Component.  I guess I wanted to gain some general insight into how this could happen?  Is this sort of thing common?

               

              D

              • 4. Re: Old Flex App suddenly has an error?
                Developer504 Level 1

                Alex wrote:

                  Smells like a timing or configuration change.  Some folks using SWFObject had things like this happen when IE8 came out.  It messed up the initialize sizing of the app causing things to have invalid values.  It could also be something where some code that determines the size of the TabNavigator is dependent on a server fetch that is delayed or some other dependency like that.

                 

                Somebody else suggested this might be a problem with the Tab Navigator, the error does refer to a Tab skin and it's interesting that you brought it up as well.  I don't see anything in my code that looks like it is related, couldthis be something inside the TabNavigator itself?  If this was the case can you think of any quick way to fix it?

                 

                D..

                • 5. Re: Old Flex App suddenly has an error?
                  Developer504 Level 1

                  This is my TabNavigator statement:

                   

                   

                  <mx:TabNavigator

                   

                   

                  x="50" y="15" width="94%" height="90%" backgroundColor="#FFFFFF" horizontalAlign="center

                  "

                  tabWidth="

                   

                  {this.width * 0.32}" creationPolicy="all">

                   

                   

                  Is the tabWidth a problem now possibly due to some change in IE 8?

                   

                  D

                  • 6. Re: Old Flex App suddenly has an error?
                    Flex harUI Adobe Employee

                    The issue is binding timing.  tabWidth="{this.width * 0.32}" can send invalid numbers for tabWidth and cause that error.  This.width may be invalid (it starts out as NaN I think)

                     

                    Maybe try:

                    tabWidth="{isNaN(this.width) ? 0 : this.width * 0.32}"

                     

                    Alex Harui

                    Flex SDK Developer

                    Adobe Systems Inc.

                    Blog: http://blogs.adobe.com/aharui

                    1 person found this helpful
                    • 7. Re: Old Flex App suddenly has an error?
                      Developer504 Level 1

                      this.width seems to be failing in all my Apps, now that I'm looking at it.  I am using this.width to size my columns, my tab, and various other components based on the size of the users screen.  Apparently the timing no longer works initially for this in IE 8 or due to some change in the Flex engine.  So for example all my columns in my dataGrid now come up very small when I load my .SWF, if I hit refresh they look correct.  I'm sure it's the same problem with the TabNavigator.

                       

                      So Is there a preferred / better way to size the visual elements of my Applications?  Apparently I have to change this now.

                       

                      By the way your alternative version gives me the same error on my Tab Navigator, but if I take out this.width it compiles just fine.

                       

                      D.

                      • 8. Re: Old Flex App suddenly has an error?
                        Flex harUI Adobe Employee

                        The recommend practice is to use %.  However you can't use that for tabWidth and some other things.   I've never tried to associate tabWidth with some % of the screen.  Maybe try systemManager.stage.stageWidth

                         

                        Alex Harui

                        Flex SDK Developer

                        Adobe Systems Inc.

                        Blog: http://blogs.adobe.com/aharui

                        • 9. Re: Old Flex App suddenly has an error?
                          Developer504 Level 1

                          What about for the width of my datagrid columns?  I can't believe that A) this suddenly breaks now after working for nearly a year, and B) there isn't a simple way to size the elements of your apps to fit your clients screens?  I don't get this?  Does Flex assume that everyone has the same screen size?  I'm already done with these projects, we've already billed for them, now I'm apparently going to have to go and rewrite something like ten Applications in order for them to continue to work properly.

                           

                          This is really frustrating!

                           

                          D.

                          • 10. Re: Old Flex App suddenly has an error?
                            Flex harUI Adobe Employee

                            Did you upgrade SDKs?  The default value of width may have changed or the timing may have changed.

                             

                            Depending on your DataGrid's horizontalScrollPolicy, the columns will either all stretch or shrink (default) or will honor the sizes given.

                             

                            Alex Harui

                            Flex SDK Developer

                            Adobe Systems Inc.

                            Blog: http://blogs.adobe.com/aharui

                            • 11. Re: Old Flex App suddenly has an error?
                              Developer504 Level 1

                              No I didn't upgrade, these were written in Flex 3.0 which is what I'm still running.  Like I said they worked fine before, for almost a year.

                               

                              They still compile ok and run, thank god.  But if I run from the developer I get an error.  Even after I removed the TabNavigator "this.width" setting, I'm still getting an error report at compile time, but Flex doesn't tell me what (or where) the errror is. I assume it's due to "this.width" statements inside my DataGrids.

                               

                              D

                              • 12. Re: Old Flex App suddenly has an error?
                                Flex harUI Adobe Employee

                                What version of the Flash Player are you running?  Note that the release players don't put up the error dialog so most customers might just fly by that without problem. 

                                 

                                Alex Harui

                                Flex SDK Developer

                                Adobe Systems Inc.

                                Blog: http://blogs.adobe.com/aharui

                                • 13. Re: Old Flex App suddenly has an error?
                                  Developer504 Level 1

                                  Using flash player 9 (9,0,124,0 to be precise).

                                   

                                  The Clients aren't seeing any error messages, if they were it would be a major problem I'd be up all night tonight trying to fix it. 

                                   

                                  D.

                                  • 14. Re: Old Flex App suddenly has an error?
                                    Flex harUI Adobe Employee

                                    The stack trace you posted indicates you are compiling against 3.2, not 3.0, and there could in fact be differences that affect you like that between those two point-releases.

                                     

                                    You might have to debug into TabSkin to see what values it is sending to drawRect.  I figured it would be NaN, but maybe not.

                                     

                                    Alex Harui

                                    Flex SDK Developer

                                    Adobe Systems Inc.

                                    Blog: http://blogs.adobe.com/aharui