2012-11-17 44 views
3

我需要将我自己的类导入到mxml文件中,但总是会出现类不能嵌套的错误。我不知道如何使用我的类(例如:NetConn.as)。你可以帮我吗?如何在Flex中将自定义类导入到mxml文件中? (Actionscript 3)

<!--language:actionscript3> 
<?xml version="1.0" encoding="utf-8"?> 
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.eazyRadioHomeView"> 
    <fx:Style source="eazyRadio.css"/> 
    <fx:Script> 
     <![CDATA[ 

      include "NetConn.as"; 

      import myNetConn; 
      var easy=new NetConnectionEx(); 
     ]]> 
    </fx:Script> 

    <fx:Declarations> 
     <!-- Platzieren Sie nichtvisuelle Elemente (z. B. Dienste, Wertobjekte) hier --> 

    </fx:Declarations> 
</s:ViewNavigatorApplication> 
--> 

回答

1

你需要

import com.yournamespace.NetConn; 

,而不是

include "NetConn.as" 
相关问题