0 Replies Latest reply on Oct 15, 2007 10:46 AM by jylaxx

    error #2025 when executing swf file directly in flash player 9

    jylaxx Level 1
      Hi,

      The problem can be illustrated with this simple exemple using 3 components :
      1- main application used to load a child application with swfloader component
      2- the child application with two buttons used to popup or dock a component
      3- the component : a simple vbox

      The child application use the vbox component as a popup or as a docked panel. This is done by the two buttons "Popup" and "Dock".

      When this application is executed inside IE or directly in flash player everything is OK.

      If the child application is loaded in the main application with a swfloader component and then "Popup" and "Dock" buttons are clicked then :
      1- the execution is made from IE : no error
      2- direct execution in flash player 9 : error #2025 for each click in the application whatever the underlying object

      I tried with flex builder 2 and 3 the error is the same.

      Any idea ?

      here are the source code :

      debug01.mxml :
      ---------------------------------------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">


      <mx:Script>
      <![CDATA[


      private function loadApp( event : Event ) : void
      {
      appLoader.load( "app01.swf" ) ;
      }

      ]]>
      </mx:Script>

      <mx:VBox height="100%" width="100%">
      <mx:ApplicationControlBar width="100%">
      <mx:Button label="Load" click="loadApp(event);"/>
      </mx:ApplicationControlBar>
      <mx:SWFLoader width="100%" height="100%" id="appLoader"/>
      </mx:VBox>

      </mx:Application>
      ---------------------------------------------------------------------------


      app01.mxml :
      ---------------------------------------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:Script>
      <![CDATA[

      import mx.controls.Alert;
      import mx.managers.*;

      private var popup : appPopup = new appPopup() ;

      private function popupPopup( event : Event ) : void
      {
      if ( popup.isPopUp )
      {
      return ;
      }
      if ( popup.parent == mainBox )
      {
      mainBox.removeChild( popup ) ;
      }
      popup.x = 200 ;
      popup.y = 20 ;
      PopUpManager.addPopUp( popup, mainBox ) ;
      }

      private function dockPopup( event : Event ) : void
      {
      if ( popup.parent == mainBox )
      {
      return ;
      }
      if ( popup.isPopUp )
      {
      PopUpManager.removePopUp( popup ) ;
      }
      mainBox.addChildAt( popup, 0 ) ;
      }


      ]]>
      </mx:Script>


      <mx:HBox width="100%" height="100%" id="mainBox" paddingLeft="10" paddingRight="10">
      <mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle">
      <mx:Label text="HELLO" fontSize="24" fontWeight="bold" fontStyle="italic" color="#EECF64"/>
      <mx:Button label="Popup" click="popupPopup(event);" width="100"/>
      <mx:Button label="Dock" click="dockPopup(event);" width="100"/>
      </mx:VBox>
      </mx:HBox>

      </mx:Application>
      ---------------------------------------------------------------------------

      appPopup.mxml :
      ---------------------------------------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" width="200" height="100%" horizontalAlign="center" verticalAlign="middle" backgroundColor="#E15130" backgroundAlpha="0.5">
      <mx:Button label="Button"/>
      <mx:Button label="Button"/>

      </mx:VBox>
      ---------------------------------------------------------------------------

      and the error message :
      ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
      at flash.display::DisplayObjectContainer/getChildIndex()
      at mx.managers::SystemManager/getChildIndex()
      at mx.managers::SystemManager/private::mouseDownHandler()
      at [mouseEvent]