【问题标题】:How to import a custom class into mxml file in Flex? (Actionscript 3)如何将自定义类导入 Flex 中的 mxml 文件? (动作脚本 3)
【发布时间】:2012-11-06 03:13:31
【问题描述】:

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

<!--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>
-->

【问题讨论】:

    标签: class actionscript import


    【解决方案1】:

    你需要

    import com.yournamespace.NetConn;
    

    而不是

    include "NetConn.as"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-09
      • 1970-01-01
      • 2011-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-02
      相关资源
      最近更新 更多