hideto 发表于 2013-1-28 13:18:04

Flex之Hello World

一,到sun网站下载并安装jdk-6-windows-i586.exe并安装
安装完将%JAVA_HOME%\bin加入你的系统path环境变量中去

二,到adobe网站下载flex_sdk_2.zip
解压,然后将%FLEX_HOME%\bin加入path

三,运行%FLEX_HOME%\samples\build-samples.bat
然后可以用%FLEX_HOME%\player\debug\下的FlashPlayer或者IE来参看%FLEX_HOME%\samples\下的几个demo,其中explorer下面的explorer.swf是各个component的示例和MXML代码

四,在任意目录下建立hello.mxml
<?xml version="1.0"?><!-- Simple example to demonstrate the Alert control. --><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">    <mx:Script>      <!]>    </mx:Script>    <mx:Panel title="Hello, flex!" width="100%" horizontalAlign="center">      <mx:Button label="Click Me" click="Alert.show('Hello flex, I am coming!', 'Hello, flex!');"/>    </mx:Panel></mx:Application>
然后cmd切换到当前目录并运行
mxmlc hello.mxml
当前目录就生成了你的hello.swf文件
你可以用FlashPlayer来查看它,也可以写一个html来查看它,如hello.html
<body bgcolor="white"><embed src="hello.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="300" height="120" menu="false" quality="high"></embed></body>
页: [1]
查看完整版本: Flex之Hello World