Targeting Flash Player 10 Beta with Flex SDK 3.0.x)
第四步, 编写你的flash10应用程序:
你可以使用文本编辑器,Flash cs3,FlashDevelop等编写flash10应用程序, 以下是我写的一个简单的应用程序源码,你可以拷贝以下的源码,并用任何文本编辑器保存成 HelloFlash10.as , 例如我保存到c:flash_player10_testHelloFlash10.as
package
{
import flash.display.Sprite;
import flash.text.*;
import flash.events.*;
//SWF Metadata 设置swf文件的基本参数
[SWF(width = "300", height = "200", backgroundColor = "#FFFFFF", framerate = "30")]
/**
* ...
* @author jimbob#blueidea.com
*/
public class HelloFlash10 extends Sprite
{
private var tf:TextField;
public function HelloFlash10():void
{
tf = new TextField();
tf.autoSize = "left";
tf.text = "Hello, Welcome to Flash10!";
tf.x = 150;
tf.y = 100;
this.addChild(tf);
this.addEventListener("enterFrame", run);
}
private function run(e:Event):void
//根据flash10内置三维属性,将文本围绕Y轴进行旋转
{
tf.rotationY = 5;
}
}
}
第五步, 使用Flex3 SDK的命令行编译器,将你的程序代码编译成swf文件:
首先进入windos命令行窗口(运行->cmd) ,然后进入你的Flex3 SDK的bin文件夹所在目录: (如我的是cd c:flex_sdk_3bin), 然后运用编译指令 mxmlc *HelloFlash10.as (如我的是 mxmlc c:flash_player10_testHelloFlash10.as) , 编译中发生的错误会显示在命令行窗口中,如果没有错误,则该编译指令会在 HelloFlash10.as 同目录下生成最终文件 HelloFlash10.swf。
第六步, 使用浏览器或者flash10独立播放器打开生成的swf来查看结果.
附: 本例子中程序代码效果如下,你可以修改tf.rotationY 为 tf.rotationX或 tf.rotationZ 来体验flash内置真实3D属性. 如你无法看到3D效果,请参考本文章第一步所述, 在浏览器中安装flash10插件.










