5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:
性别:秘密
最后登录:2010-03-02
http://wyongedu.5d.cn/
Love is like a butterfly. It goes where it pleases and it pleases where it goes
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/10/31 | Actionscript 3 - First Steps X
类别(失落的学习)
|
评论
(2)
|
阅读(44)
|
发表于 09:30
This post is not about actionscript, but more about the publishing process. I couldn't find the dialog to specify the size of the resulting swf. It was my thinking, that i can specify the size in dialog similar to the flash publishing dialog, but to no avail.
After searching the docs for a while, i found the list of options for the mxmlc, the mxml compiler. The option -default-size width height looked good to me. And indeed, after specifying the option in the additional compiler arguments field, inside the project's/properties/Actionscript compiler dialog, the correct size is created now.
Great stuff. Some of the other options might come in handy too, but i haven't tried them yet.
Actionscript 3 - First Steps IX
The new integrated delegation probably needs some more attention than in Step VII. The next example shows, that this has nothing to do with the event system, which is part of the flash api, but is a feature of the language itself. We create a simple second class Test2, containing a method, that runs a function given as parameter.
package {
import flash.util.trace;
import flash.display.MovieClip;
public class Test
extends MovieClip
{
public function Test() {
var t2:Test2 = new Test2();
// use a member method as parameter
t2.run( onCompleteT2);
//use a anonymous function as parameter
var ref:Test = this;
t2.run( function(){
trace("Test::anonymous function " + this + ":" + ref);
});
}
public function onCompleteT2(){
trace("Test::onCompleteT2 " + this);
}
}
private class Test2
{
public function run( onComplete:Function){
trace("Test2::run");
onComplete();
}
}
}
As you can see from the second trace, the scope of onCompleteT2 is implicitely set to the instance of Test. No longer we need to use Delegate.create or local variables to provide a reference to the scope. Still this method works though, as you can see from the last trace.
Also note, that anonymous functions are no longer automatically scoped to _root but to global, as you can see from the last trace too
0
评论
Comments
日志分类
首页
[192]
失落的感情
[27]
失落的学习
[30]
失落的时间
[5]
失落的网络
[85]
失落的自己
[42]
失落的朋友
[3]