I recently came across a runtime error in my Flex application
(Error#2025) which took a couple of days to narrow down. There seems to
be a bug in the Flash FocusManager Class unless I'm missing
something here.Using a few of the Flash Components and the Flex
PopUpManager Class,when clicking Tab, this runtime error comes up.

To simplify my explanation of the issue, I'm just going to post an
example and code along with the FLA.

 
<http://www.useflashmore.com/blog/error-2025-clash-between-flex-3-beta-2\
-flash-cs3/> Click here for the live example with (view source enabled)
<http://www.useflashmore.com/blog/error-2025-clash-between-flex-3-beta-2\
-flash-cs3/>

Once the application loads, click the button, then immediately click tab
and you'll see the runtime error.

Here is the full runtime error I'm getting after clicking tab when the
popup window first opens:
ArgumentError: Error #2025:
The supplied DisplayObject must be a child of the caller.    at
flash.display::DisplayObjectContainer/getChildIndex()    at
mx.core::Container/getChildIndex()[E:\dev\flex_3_beta3\sdk\frameworks\pr\
ojects\framework\src\mx\core\Container.as:2398]    at
mx.containers::Panel/getChildIndex()[E:\dev\flex_3_beta3\sdk\frameworks\\
projects\framework\src\mx\containers\Panel.as:1027]    at
fl.managers::FocusManager/getChildIndex()    at
fl.managers::FocusManager/sortByDepth()    at Array$/_sort()    at
Array/http://adobe.com/AS3/2006/builtin::sort()    at
fl.managers::FocusManager/sortFocusableObjects()    at
fl.managers::FocusManager/keyDownHandler()

Here is the main application source:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml";
xmlns:local="com.useflexmore.*"
layout="vertical" viewSourceURL="srcview/index.html">

<mx:Script>
<![CDATA[

import mx.managers.PopUpManager;
import mx.core.IFlexDisplayObject;

private function emailThisHandler(event:Event):void
{
var emailPop:IFlexDisplayObject = PopUpManager.createPopUp(this,
EmailTitleWindow, true);
PopUpManager.centerPopUp(emailPop);
}
]]>
</mx:Script>

<mx:Canvas width="400" height="300">
<local:TileListTabBug />
</mx:Canvas>
<mx:Button label="Click to Open Form" click="emailThisHandler(event)"/>

</mx:Application>

Here is the pop window source:
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
title="EMAIL THIS!" width="400" backgroundColor="#CCCCCC">

<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import flash.events.KeyboardEvent;

private function closeHandler(event:Event):void
{
PopUpManager.removePopUp(this);
}

]]>
</mx:Script>

<mx:Model id="contact">
<info>
<yourName>{yourName_txt.text}</yourName>
<yourEmail>{yourEmail_txt.text}</yourEmail>
<theirEmail>{theirEmail_txt.text}</theirEmail>
<message>{message.text}</message>
</info>
</mx:Model>

<mx:StringValidator id="strV" source="{yourName_txt}" property="text"
minLength="3" maxLength="150" trigger="{sendBtn}" triggerEvent="click"
/>
<mx:EmailValidator id="emV1" source="{yourEmail_txt}" property="text"
trigger="{sendBtn}" triggerEvent="click" />
<mx:EmailValidator id="emV2" source="{theirEmail_txt}" property="text"
trigger="{sendBtn}" triggerEvent="click" />

<mx:Form x="0" y="0" width="100%" height="100%">
<mx:FormItem label="YOUR NAME" width="100%" required="true">
<mx:TextInput width="100%" id="yourName_txt" paddingLeft="2"/>
</mx:FormItem>
<mx:FormItem label="YOUR EMAIL" width="100%" required="true">
<mx:TextInput width="100%" id="yourEmail_txt" paddingLeft="2"/>
</mx:FormItem>
<mx:FormItem label="THEIR EMAIL" width="100%" required="true">
<mx:TextInput width="100%" id="theirEmail_txt" paddingLeft="2"/>
</mx:FormItem>
<mx:FormItem label="MESSAGE" width="100%">
<mx:TextArea width="100%" height="100" id="message" paddingLeft="2">
<mx:text><![CDATA[ENTER YOUR MESSAGE HERE. ]]></mx:text>
</mx:TextArea>
</mx:FormItem>
<mx:HBox width="100%" horizontalAlign="right">
<mx:Button label="CANCEL" click="closeHandler(event)" />
<mx:Button id="sendBtn" label="SEND EMAIL"/>
</mx:HBox>
</mx:Form>

</mx:TitleWindow>

Here is the UIComponent Source:
package com.useflexmore
{
import mx.flash.UIMovieClip;

public class TileListTabBug extends UIMovieClip
{
public function TileListTabBug():void
{
super();
}
}

}
The FLA just has one movieclip with the Flash CS3 TileList Component
inside w/ export for actionscript and the path to the above UIComponent
Source. The base class for the MovieClip is flash.display.MovieClip and
export on first frame is selected.

I've also detailed this issue on my blog at
http://www.useflashmore.com/blog <http://www.useflashmore.com/blog>


Reply via email to