• 2010年8月26日周四_understanding Flex_MXML and ActionScript_7.2


    /***************************************************************************************/

    //Using MXML and ActionScript

    //2010年8月26日

    //version 2.0

    /**************************************************************************************/

    Flex applications are developed using the MXML and ActionScript languages with the ActionScript class library, which contains components, manager classes, data service classes, and classes for all other features. Read more on the Adobe Flex Developer Center.

    MXML can be likened to HTML (tags that lay out the page), and ActionScript to JavaScript (the coding). In theory, you could write everything as ActionScript code (add a button here, put the map at the bottom of the page, etc.), but this is neither practical nor maintainable.

    ActionScript 3 syntax is similar to other languages like C, C#, C++, and Java. ActionScript is an object-oriented procedural programming language and includes Java object-oriented features, such as extending classes and implementing interfaces.

    There are several different ways to mix(vt.配制;混淆 vi.相混合;交往 n.混合(物)) ActionScript and MXML:

     

    Flex 应用程序是使用MXML和带有ActionScript类库的Actionscript语言进行开发的,这些类库包含组件、管理类、数据服务类和其他要素的类。更多信息阅读Adobe Flex Developer Center.

    MXML类似于HTML,Actionscript类似于JavaScript。从理论上面说你可以写任何的代码作为actionscript代码,但是这既没有实际用处也没有维护。

    Actionscript 3.0语法和其他的语言是很相似的,比如:C,C#,C++,和java。 ActionScript 是一个面向对象程序编程语言,包括 java面向对象features,比如:扩展类和实现接口

    这里有几种方法来混合 ActionScript和MXML。

    • Using ActionScript in MXML event handlers.
    • 在MXML事件处理过程中使用ActionScript

    <esri:map load="Alert.show('map is loaded')">

    • Using ActionScript <mx:Script> or <mx:initialize> blocks in MXML files.
    • 在MXML文件中使用 ActionScript<mx:script>或者<mx:initialize>代码块
    • <mx:Script>
    •     <![CDATA[
    •         import mx.controls.Alert;
    •         private function onMapLoad():void
    •         {
    •             Alert.show('Hola Mundo');
    •         }
    •     ]]>

    </mx:Script>

    • Include external ActionScript files.
    • 引用外部的ActionScript文件

    include "myextracode.as";

    • Import ActionScript classes.

          引用ActionScript类

    Tip

    Multiple steps take place behind the scenes when Flex compiles your application. The application is parsed(从语法上分析) by MXMLC, translated into an ActionScript file, and compiled into a SWF.

    To better understand how Flex converts MXML tags into code, you can view the interim(暂时的,临时的 n.间歇,过渡期间) ActionScript files. These are deleted unless you specify the "--keep-generated-actionscript" option when compiling your application.

    提示:

    当Flex编译你的应用程序的时候,多个步骤在后台发生。 MXMLC在语法上分析应用程序,将它翻译为一个ActionScript文件并编译为一个SWF文件。

    为了更好的理解如Flex 如何将MXML 标签转换为代码,你可以查看临时的ActionScript文件。 这些文件最终都会删除的,除非在编译你的应用程序的时候,明确指定”keep generated actionscript”

     

  • 相关阅读:
    从一个Fragment跳转到另一个Fragment
    网站关键字排名查询
    wordpress添加百度统计
    WordPress:自定义页面模板
    wordpress的系统卡
    Android APK反编译就这么简单 详解(附图)
    关于使用apktool可以反编译无法回编译的解决问题
    移动广告联盟
    android studio 设备 unauthorized 问题解决
    使用Android Studio开发遇到的问题集合
  • 原文地址:https://www.cnblogs.com/xingchen/p/1808815.html
Copyright © 2020-2023  润新知