I've been pushing data b/t Flash and Flex lately.  I have a Flash 9 file
being loaded into a Flex SWFLoader.  The flash file detect the parent, and
calls a public method named getTMI() w/in its parent.  So far so good.
 
The function returns a pointer to an object (my TMI singleton) that I am
using as a service to facilitate communication b/t the two apps.
 
Here is where it gets wierd.
 
Everything works fine in the debug player.  When I use the regular player, I
can see the parent, and call getTMI().  However, when the function returns
the pointer, I get a TypeError (1009) w/no message.  I can't do a stacktrace
b/c that only works in the debug player, where the app works anyway.
 
After a bit more investigation, I have turned up the following: the function
only "misfires" when I am calling it during the AddedToStage or Added event
handler.  If I wait a bit (e.g. EnterFrame), everything is fine.  
 
Is this a legit bug or is there something more subtle that I am missing
surrounding AddedToStage?
 
Code below:
 
public function UI_New() 
  {
   super();
   
   this.addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
   this.addEventListener(Event.ADDED, addedToStageHandler);
   this.addEventListener(Event.ENTER_FRAME, addedToStageHandler);
  }
  
  /**
   * Register Interface event handlers
   */
  protected function addedToStageHandler( event:Event ):void
  {
   //this.removeEventListener(Event.ENTER_FRAME, addedToStageHandler);
   
   Logger.debug("in addedToStageHandler " + event.type);
   
   var castParent:IDisplayViewContainer = this.parent as
IDisplayViewContainer;
   Logger.debug("castParent.getTMI()");
   Logger.debug("castParent: " + castParent);
   Logger.debug("castParent: " + castParent.getTMI);
   
   try {
    var o:Object = castParent.getTMI();
    Logger.fatal( o );
   } 
   catch (e:Error)
   {
    for ( var key:String in e ) {
     Logger.fatal( e + " : " + e[key] );
     Logger.fatal( e.message );
     Logger.fatal( e.getStackTrace() );
     Logger.fatal( e.getStackTrace() );
    }
   }
  }



-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to