编译as3时如何区分debug和Release版本

ContractedBlock.gif ExpandedBlockStart.gif 测试代码
 
   
1 package {
2 import flash.display.Sprite;
3 public class TestBuild extends Sprite
4 {
5 CONFIG::debug
6 public function TestBuild()
7 {
8 graphics.beginFill( 0xff0000 , 1 );
9 graphics.drawRect( 0 , 0 , 100 , 100 );
10 }
11
12 CONFIG::release
13 public function TestBuild()
14 {
15 graphics.beginFill( 0x0000ff , 1 );
16 graphics.drawRect( 0 , 0 , 100 , 100 );
17 }
18 }
19 }
20
21  

 

使用mxmlc命令行对这段代码进行debug编译

mxmlc src/TestBuild.as -define=CONFIG::debug,true -define=CONFIG::release,false -output bin-release/TestBuild.swf

然后改一下编译参数,进行release编译

mxmlc src/TestBuild.as -define=CONFIG::debug,false -define=CONFIG::release,true -output bin-release/TestBuild.swf

 

以上代码从小S吧转来,原帖地址:http://www.xiaos8.com/article.asp?id=556

例子很清晰地说明了如何使用条件编译来完成区分编译Debug版本和Release版本

因为我一直使用fd来编写as3代码,fd和vs一样都是用c#写的,而vs在编写c#项目时,coder可以自由选择Debug版本还是Release版本的发布。fd也一样。

如果将以上代码放在fd里编译,将会出现Syntax error。在fd中应该也是有如何使用条件编译两个版本的方法,暂时还未发现。。。发现了再帖上来。

转载于:https://www.cnblogs.com/blueheart104/archive/2010/04/26/1720938.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值