flex loaderInfo为null在creationComplete事件中

原文:
http://yunzhongxia.iteye.com/blog/1152670

 

 

  Flex4中application变为FlexGlobals.topLevelApplication,很多时候需要在Application的 creationComplete事件中处理一些全局的事情,例如获得swf的url地址来跟后端进行交互,但是我们发现在 creationComplete事件中,FlexGlobals.topLevelApplication的loaderInfo为null。

       经过搜索发现,需要监听applicationComplete才可以获得loaderInfo信息。

注意下面的 applicationComplete 而不是creationComplete。
 

 

<?xml version= "1.0" encoding= "utf-8"?>   
<mx:Application xmlns:mx= "http://www.adobe.com/2006/mxml" layout= "absolute" <span style= "color: #ff0000;">applicationComplete< /span>="init()">   
    <mx:Script>   
    <![CDATA[   
         public  function init(): void {   
            txtName.text =  this.loaderInfo.toString();   
        }   
    ]]>   
    < /mx:Script>   
    <mx:TextInput x= "50" y= "10" id= "txtName"/>   
< /mx:Application> 

你可能感兴趣的:(loader)