wiln / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

Exception in ImageMap:updateDisplayList #241

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Dynamically create a view that contains an ImageMap
2. Call a function to recursively remove all the children in the view
3. sometimes there is an exception in ImageMap.as 

What is the expected output? What do you see instead?
Exception shouldn't be thrown

What version of the product are you using? On what operating system?
Flexlib 2.4, Windows XP

Please provide any additional information below.

I have written a function which given a DisplayObjectContainer recursively 
removes all the children. When I apply that function to a view which has 
ImageMap sometimes I get an exception in ImageMap.as 

ArgumentError: Error #2025: The supplied DisplayObject must be a child of 
the caller.
    at flash.display::DisplayObjectContainer/setChildIndex()
    at mx.core::UIComponent/setChildIndex()
[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:4936
]
    at flexlib.controls::ImageMap/updateDisplayList()
[C:\projects\Flex\ClientFI2\ClientFI\src\flexlib\controls\ImageMap.as:324]
    at mx.core::UIComponent/validateDisplayList()
[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:6214
]
    at mx.managers::LayoutManager/validateDisplayList()
[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.a
s:602]
    at mx.managers::LayoutManager/doPhasedInstantiation()
[E:\dev\3.0.x\frameworks\projects\framework\src\mx\managers\LayoutManager.a
s:657]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()
[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8460
]
    at mx.core::UIComponent/callLaterDispatcher()
[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8403
]

I made a small change in updateDisplayList function to check if ImageMap 
contains areaHolder then setChildIndex:

  if (this.contains(areaHolder)) //New line added, check if child exists
  {
     setChildIndex(areaHolder, numChildren - 1);
  }

Original issue reported on code.google.com by raghu.k...@gmail.com on 18 Aug 2009 at 6:59