2 Replies Latest reply on Oct 21, 2009 1:54 AM by Prat_flex

    ArgumentError: Error #2004: One of the parameters is invalid - Any solution?

    Prat_flex

      I am using Flex 3.2 and am getting following errors (not always) in my application.

       

      ArgumentError: Error #2004: One of the parameters is invalid.
          at flash.display::Graphics/drawRoundRect()
          at mx.skins.halo::HaloFocusRect/updateDisplayList()
          at mx.skins::ProgrammaticSkin/validateDisplayList()
          at mx.skins::ProgrammaticSkin/validateNow()
          at mx.core::UIComponent/adjustFocusRect()
          at mx.core::UIComponent/drawFocus()
          at mx.core::UIComponent/focusInHandler()
          at mx.controls::DataGrid/focusInHandler()
          at flash.display::Stage/set focus()
          at mx.core::UIComponent/setFocusLater()
         
      ArgumentError: Error #2004: One of the parameters is invalid.
          at flash.display::Graphics/drawRoundRect()
          at mx.skins.halo::HaloFocusRect/updateDisplayList()
          at mx.skins::ProgrammaticSkin/validateDisplayList()
          at mx.managers::LayoutManager/validateDisplayList()
          at mx.managers::LayoutManager/doPhasedInstantiation()
          at Function/http://adobe.com/AS3/2006/builtin::apply()
          at mx.core::UIComponent/callLaterDispatcher2()
          at mx.core::UIComponent/callLaterDispatcher()

       


      On debugging , I found out the cause to be cornerRadius's value (NaN)

       

      I added "corner-radius : 4;" entry in global section of CSS file to ensure that each component has corner-radius style set to a valid number.

       

      But, I am still getting the error.
         
         
      Also, I think that there might be a bug in HaloFocusRect.as code (Line 220). Routine handles 'Nan' case for one instance and not for other

       

      The present version is :

       

          // outer ring
          g.beginFill(rectColor, focusAlpha);
          ellipseSize = (cornerRadius > 0 ? cornerRadius + focusThickness : 0) * 2;
          g.drawRoundRect(0, 0, w, h, ellipseSize, ellipseSize);
          ellipseSize = cornerRadius * 2;
          g.drawRoundRect(focusThickness, focusThickness,
                  w - 2 * focusThickness, h - 2 * focusThickness,
                  ellipseSize, ellipseSize);
          g.endFill();
                 
                 
                 
      Shouldn't it be

       


          cornerRadius = cornerRadius > 0 ? cornerRadius : 0;
          g.beginFill(rectColor, focusAlpha);
          ellipseSize = cornerRadius * 2;
          g.drawRoundRect(0, 0, w, h, ellipseSize, ellipseSize);
          ellipseSize = cornerRadius * 2;
          g.drawRoundRect(focusThickness, focusThickness,
                  w - 2 * focusThickness, h - 2 * focusThickness,
                  ellipseSize, ellipseSize);
          g.endFill();

       

       

      Any thoughts/pointers?

       

      Thanks in advance