3 Replies Latest reply on May 27, 2008 6:34 PM by 笑看人生

    How to see the .AS file that .MXML file is translated to before being compiled to SWF?

    笑看人生
      I am trying to dynamically load some other Applications in one Application, use ActionScript but not SWFLoader tag, it looks like:

      <mx:Application>
      <mx:Script>
      <![CDATA[
      private var loader:SWFLoader = new SWFLoader();
      private function loadSWF(url:String):void{
      var baseURL:String = this.url.substr(0, this.url.lastIndexOf("/"));
      var url = baseURL + "/"+ name;
      //even if I did not add any event listener!
      loader.load(url);
      }
      ]]>
      </mx:Script>
      <mx:Button label="B" click="loadSWF('Top_2.swf');" y="10" x="58"/>
      </mx:Application>

      then when me click the button, always occured an error like this:(even if every method I add try...catch... )

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.core::UIComponent/ http://www.adobe.com/2006/flex/mx/internal::updateCallbacks()[E:\dev\3.0.x\frameworks\proj ects\framework\src\mx\core\UIComponent.as:5043
      at mx.core::UIComponent/set nestLevel()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\UIComponent.as:2522]
      at mx.managers::SystemManager/ http://www.adobe.com/2006/flex/mx/internal::addingChild()[E:\dev\3.0.x\frameworks\projects \framework\src\mx\managers\SystemManager.as:1583
      at mx.managers::SystemManager/initializeTopLevelWindow()[E:\dev\3.0.x\frameworks\projects\fr amework\src\mx\managers\SystemManager.as:2481]
      at mx.managers::SystemManager/ http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()[E:\dev\3.0.x\frameworks\proj ects\framework\src\mx\managers\SystemManager.as:2330


      however, if I use <mx:SWFLoader source="Top_2.swf" /> tag, there is no such problem! So I think it must be I didn't init SWFLoader correctly!

      I hope someone can tell me how to crrect this mistake directly, but I more wish someone to tell me how to view the .as file that the .mxml file translated to before being compiled to a SWF( If there is a such step!)

      Thanks!