因为Robotlegs framework 1.02中不包含Swiftsuspends 1.5beta2,所以其Injector不支持树形结构。
下载了Robotlegs源码后将Swiftsuspends1.5beta2包含到编译包中,就可以了。
附上编译后的Robotlegs库。
点击下载此文件

1、ApplicationFacade
initializeController()//初始化控制器
registerCommand() //注册控制器
registerProxy() //注册模型
registerMedatior() //注册视图介子
一般情况下:
registerProxy()、registerMedator()由StartupCommand来完成
2、Mediator
a)与Proxy、Command之间主要方法
override public function listNotificationInterests():Array
//通过这个方法声明视图介子对什么样的消息感兴趣
override public function handleNotification( note:Inotification ):void
//处理Facade发送来的自己感兴趣的消息,一般处理视图的数据和视图效果,通常通过note.getName()判断消息类型,通过note.getBody()获取传递的数据。
b)与Component之间主要是通过侦听Component的EVENT事件再通过Facade.sendNotification发Proxy、Command发送消息
3、Command
可以将他看作控制器,其是无状态的,当Facade有相关消息时自动创建并调用
Command实例的override public function execute( notification:INotification ):void方法,主要是用来处理业务逻辑。通常调用facade.retrieveProxy方法来获取Proxy实例,操作数据。
4、Proxy
主要是用来进行数据逻辑层面的操作,一般拥有ValueObject。如果是采用RemoteObject、HttpService、WebService等方法进行远程数据交换时,通常是封装在Proxy中。当有数据更新完成时通过Facade.sendNotification发送相关消息给其他订阅者。
Samuel Asher Rivello在adobe 网站发布An introduction to PureMVCfor adobe Flash and flex 讲得比较清楚,有两个图清晰介绍了PureMVC。


If you’re developing adobe AIR applications you might use the AIR install badge on your site to allow easy downloading of your application. So how can you integrate google Analytics to track how many times your application has been downloaded? It’s easier than you think…
These steps presume you’re already familiar with creating an adobe AIR install badge and google Analytics is already installed on your site.
Integrate google Analytics into your AIR install badge:
import flash.external.ExternalInterface;
// GoogleAnalytics script // change the gaLogAction value to the name you want to appear in the Analytics logs var gaLogAction:String = "/airbadge/"+action; var gaJS:String = "pageTracker._trackPageview"; ExternalInterface.call(gaJS, gaLogAction);
…that’s all there is to it
If you want to see it in action, please check the ReviewR download page. It uses the same kind of patched install badge.
Some notes however:
Dear Community,
I’m pleased to announce that the Spring ActionScript 0.8 release is now available.
Download | API Documentation | HTML Docs | PDF Docs | Changelog
This release includes the Spring ActionScript framework, the Cairngorm extensions and the PureMVC extensions.
All libraries are available for download at the following Maven repository: http://projects.yoolab.org/maven/content/repositories/
From now on, we will regularly publish new snapshots of the libraries there.
Direct links to the libraries:
- Spring ActionScript 0.8
- Spring ActionScript Cairngorm 0.8
- Spring ActionScript PureMVC 0.8
Dependencies:
- AS3Commons Lang
- AS3Commons Logging
- AS3Commons Reflect
Note: AS3Commons Lang is a snapshot of 1.0. We will work with a release for the following releases of Spring ActionScript
Besides a series of bugfixes, optimizations and improvements, some of the major changes and enhancements include:
Autowiring support
Using autowiring allows you to inject objects managed by the container into view components and other objects. To autowire a property, annotate it with the [Autowired] metadata tag. The support we build in is pretty enhanced and allows you to customize the autowire behavior in many different ways. Within the Autowired metadata tag you can specify the object name and you can also configure the container to filter autowire candidates using your own filter specifications. Please see the documentation on autowiring for more info.
Custom Namespaces
The XML configuration now supports namespaces and allows you to create custom namespaces yourself. A few namespaces have been added to simplify the configuration of common objects for RMI and Messaging. More info on available namespaces and schemas and creating custom ones can be found in the documentation. The XSD schemas are available http://www.springactionscript.org/schema/
MXML Configuration
We now also support configuration through MXML. The markup is very similar to the regular XML config, but with some slight differences. Please see the documentation on MXML Configuration
AS3Commons
As a side project, we have started the AS3Commons project that offers reusable ActionScript 3.0 libraries. Most of the libraries currently available in AS3Commons are build using code from the Spring ActionScript framework. This means that a lot of code has been removed from Spring ActionScript and is now available for use in projects not using Spring ActionScript. Please note that you might have to update quite some import statements to refer to AS3Commons instead of Spring ActionScript. We apologize for any inconvenience this might cause, but this is only a one-time process.
We hope you find the AS3Commons libraries useful. All libraries (releases and snapshots) can also be found at the Maven repository.
Documentation
The documentation has been tremendously improved in this version. Next to the API documentation, we now provide a reference guide in HTML and PDF format. General info can be found at the project website: www.springactionscript.org
Last Words
If you feel like helping us out, we could certainly use your help. This project is entirely created on a volunteer basis and in our spare (and limited) free time so needless to say that the more people, the faster we can deliver new releases and guarantee the quality of the framework. So if you think you have someting to offer, be it as a developer, tester, documentation writer, sample creator, … please contact me (christophe [DOT] herreman [AT] gmail [DOT] com) or leave something in the comments. All help is more than welcome.
Enjoy this release and have fun coding!
Note: The Spring ActionScript framework was formerly known as the Prana framework and has now been moved under the Spring umbrella as a Spring Extensions project.
Spring ActionScript is an Inversion of Control (IoC) Container for ActionScript 3.0, and more specifically the flex framework. It enables you to configure objects and components in a non-intrusive way by describing them in an external xml document and having them loaded at runtime.
At its core is a Spring-ish application context and IoC container. The xml dialect for the application context is aimed to be Spring compliant.
Further, the framework also contains utility classes for configuring and extending Cairngorm and PureMVC applications, an MVCS base architecture and general utilities. In the future we’ll be looking into adding AOP support, and we’re always open for suggestions.
Current Release
The current release is Spring ActionScript 0.7. (see the announcement)
Links
Download: https://sourceforge.net/project/showfiles.php?group_id=194107&package_id=306949
Changelog: http://www.pranaframework.org/docs/0.7/changelog.txt
API Docs: http://www.pranaframework.org/docs/0.7/api
Forum: http://forum.springframework.org/forumdisplay.php?f=60
Maven site: http://www.pranaframework.org/springactionscript
SVN: https://src.springframework.org/svn/se-springactionscript-as
FishEye: https://fisheye.springframework.org/browse/se-springactionscript-as
JIRA: http://jira.springframework.org/browse/SESPRINGACTIONSCRIPTAS
Sothink SWF Decompiler is a professional tool to convert SWF to FLA and extract elements from SWF into variable formats. Compatible with all Flash versions including Flash 6, Flash 7, Flash 8 and Flash CS3 (9.0). Supports both ActionScript 2.0 and 3.0. After the converting, you can get the completed FLA file including linkages, components, *.as, etc. With SWF Decompiler, you can extract any element of the Flash movie such as shapes, morph shapes, images, sounds, videos, frames, fonts, texts, buttons, sprites and ActionScripts. E.g. you can extract ActionScript as *.as or *.bin file, get sounds as mp3 or wav, images as jpeg, bmp or png, videos as flv, shapes as gls, etc. Both standard SWF and EXE (Flash project) files are supported.

Sothink SWF Decompiler provides a user-friendly interface (Office 2007 Style). A built-in player enables you to preview the movie and every element before exporting. A thumbnail view enables you to pick element easily. And the interface layout can be customized to meet your needs. To make SWF Decompiler more appealing, SWF Catcher is offered. It is a free tool that can capture Flash movies online from Internet Explorer or Firefox.
Main Features
* Supports Flash 9 and ActionScript 3.0 completely.
* Converts SWF to FLA stably.
* Full supports Flash 6, Flash 7, Flash 8 and Flash CS3 (9.0).
* Compatible with both ActionScript 2 and ActionScript 3.
* Supports exporting FLA file with ActionScript 3.
* Supports exporting ActionScript in .as format.
* Supports Flash components.
* Decompiles the ActionScript code and generates neat and readable code.
* Shows the script code neatly within the program and exports the ActionScript while converting the swf to FLA.
* Can extract the shapes, sounds, images, sprites, fonts, texts and ActionScript from a Flash movie.
* Can extract the video file from a Flash movie and export it in *.flv format.
* Support scanning the cache of IE and listing all Flash files you have viewed.
* Enable to browse and preview any resource before exporting.
* Show detail properties of elements in Flash movies.
* Can be invoked from Windows Explorer.
* User-friendly Explorer-like interface.
* Supplies SWF Catcher for Firefox and SWF Catcher for IE.
源文出处:http://www.bit-101.com/blog/?p=946
[Note, although this post is right now over a year and a half old, it continues to be one of the most visited pages on my site. If you are just showing up here now, you should note that the data here is a bit dated and may not work exactly as described in the current version of the flex SDK. In fact, I am pretty sure it DOESN'T work as described anymore. Feel free to read through this for some overall info, but check all the comments as well, which may have more info or links to more up-to-date data. I haven't had to deal with this situation since I first wrote this, so don't have the current method for making AS3 preloaders to hand.]
It’s an age old problem. Let’s go back to AS2: You have a relatively large SWF, consisting of exported movie clips in the library, and/or a good deal of code contained in classes. All classes and exported assets load in prior to frame one being displayed, so the viewer sees nothing while it is all loading in.
Solution: Turn off "export first frame" on your exported assets, and place an instance on some frame in the timeline to force them to be compiled into the SWF. For classes, set classes to export to some later frame. Then put your preloader on frame one, stop the timeline, loop until everything is loaded, then jump to an initialization frame.
Now jump to AS3 with mxmlc. There is no timeline. Embedded assets and all classes load in prior to frame one as in a default IDE-created SWF. So, how do you create a preloader?
Well, if you are using flex, it’s all programmed in there for you, and while I don’t know the specifics, I know you can specify a custom preloader in flex, and there is obviously a default preloader in a Flex app. Since the Flex framework is all written in AS3, I knew there must be some way to do this in an AS3 only project, but it wasn’t very clear. In fact, you might say it was rather hidden. My first idea was to check the compiler arguments. These two seemed interesting:
frames.frame label class name [...]
Specifies a SWF file frame label with a sequence of class names that are linked onto the frame.
This is an advanced option.
generate-frame-loader=true|false
Toggles the generation of an IFlexBootstrap-derived loader class.
This is an advanced option.
But that is the entire extent of the documentation on the subject, and doing a web search didn’t turn up a whole lot more.
Then, last Thursday, Ted Patrick happened to be in Boston, and stopped by for a tour of Brightcove. We were sitting there talking to Brian Deitte, who was also part of the Flex team til a few months ago and it occurred to me that one of these guys must have the answer. They pointed me to the [Frame] metadata tag, and said to check out the source for mx.core.Application. Sure enough, I see the following:
/**
* The frameworks must be initialized by SystemManager.
* This factoryClass will be automatically subclassed by any
* MXML applications that don’t explicitly specify a different
* factoryClass.
*/
[Frame(factoryClass="mx.managers.SystemManager")]
And, checking out SystemManager, I see a few interesting tidbits:
// NOTE: Minimize the non-Flash classes you import here.
// Any dependencies of SystemManager have to load in frame 1,
// before the preloader, or anything else, can be displayed.
and
* The SystemManager is the first display class created within an application.
* It is responsible for creating an mx.preloaders.Preloader that displays and
* mx.preloaders.DownloadProgressBar while the application finishes loading,
* then creates the mx.core.Application instance.
And finally, the create() method, which is basically called when the movie is fully loaded in:
A bit more searching around led me to this post by Roger Gonzalez, which explains it a bit more, though highly oriented towards Flex. Even he describes the Frame tag as "semi-secret and bizarre". He also mentions that it is basically an inline alias for the "frames" compiler configuration option. So, with a bit more work I could probably figure out how to do it that way, but the metadata way seems easier so far.
This was enough for me to start testing in AS3 only. Here’s the deal:
First you create your main class as usual, and point the compiler to that as the class to compile.
You then use the [Frame] metadata tag, passing in another class as the factoryClass, like so:
[Frame(factoryClass="MyFactoryClass")]
This is where the magic happens. Basically, the Frame tag forces the compiler to create a two-frame SWF. All of your embedded assets, your main class and any classes that are used by the main class are forced into frame two. The only thing that goes into frame one is your specified factory class and any classes or embedded assets that it uses. Hence the above warning to include minimal other classes in this class.
So, this factory class is where you create your preloader. Generally, you want to stop the timeline, and then set up an enterFrame listener, or a timer to check currentFrame against totalFrames. When they are equal, it means that the rest of your classes and assets are loaded in and ready to go. You then want to call nextFrame() to move to frame two so those classes and assets will be available. At that point, you can instantiate your main class, using getDefinitionByName(). This allows your factory class to create a new instance of the main class without compiling a reference to that class into it – which would force the main class and everything else to load in frame one and defeat your preloader.
The slightly weird thing about this setup is that you are usually used to your main class being the "document class". That is, the main class represents the main timeline of the SWF. In this setup though, the factory class actually becomes the document class. This has a few ramifications:
OK, let’s look at an example. First we have the main class, which we will target with mxmlc:
This doesn’t do much other than embed a large jpeg image, which makes the SWF come in at over 3 MB. If you were to compile this normally, the end viewer would see a blank screen until that jpeg fully loaded in. But the addition of the line:
[Frame(factoryClass="com.bit101.MyFactory")]
causes the main class, along with the embedded jpeg, to go into frame two. Note that in this case it is safe for the the constructor to call the init function directly. But, as mentioned earlier, you might want to delay that until the instance is actually added to the display list, to avoid null stage references, etc.
Now let’s look at the factory class:
Actionscript:
Note that it extends MovieClip. It immediately stops the timeline and adds an enterFrame listener. In that handler, it checks to see if framesLoaded == totalFrames. If so, it calls nextFrame() to make the main class available, and then calls init, which gets a reference to the main class, instantiates it, and adds it to the display list.
While second frame is still loading, it simply draws a progress bar on the stage, using root.loaderInfo.bytesLoaded and root.loaderInfo.bytesTotal to access the percent loaded.
This is a pretty simple example, but shows you how it works. I’m pretty sure it’s the only documentation out there on how to do this in AS3, so feel free to share it around.
原文翻译大致如下:
在介绍这个 Tag 之前,先说说 Flash SWF 档案 Streaming 与 Preloading
很早之前 Flash 為了要做到一边下载一边拨放的功能
把资料分别散佈到主时间轴的影格内
只要该影格所需的资料下载完毕,该影格便可进行拨放
我记得以前是号称 SWF Streaming,不过现在与 RTMP Streaming 相比
恐怕只能称作 SWF 渐进式下载 (Progressive Download) 而已了
最有代表性的应该就是 Flash Test Movie 时候,上面哪个长条图了
结果渐进式下载常常会发生停顿的现象
要另外写 Preloading 程式…
结果大多数情况下又回到了,全部下载完才能拨放的情况~~
只是可以看到下载进度而已….
要 Preloading 程式能够正常执行
便需要能够让 Preloading 程式在主时间轴影格 1 输出
其它的内容放在后面的影格
让 Preloading 程式儘量小可以快速被下载完毕
好执行它的工作
在 Flash 开发工具内有好用的时间轴面板
很容易把 Preloading 程式与其它内容用影格分开来
但是在 Flex Builder 裡面并没有时间轴面板啊
连怎样作出多影格的 SWF 都不知道
那要怎样管理 Preloading 呢?
答案就是标题 Flex Metadata Tag – Frame FactoryClass
先看一个简单的使用例子:
Main.as package { import flash.display.*; [Frame(factoryClass="Factory")] public class Main extends MovieClip { public function Main():*{ } } } Factory.as
package { import flash.display.*; public class Factory1 extends MovieClip { public function Factory():*{ } } }
Frame FactoryClass 标籤只对 Application Class (Document Class) 有作用
功能是用指定的 Class 取代作為 Application Class
并且在指定的 Class 增加影格数量
从上面的例子来看 Factory Class 便成為新的 Application Class
且具有两个影格,影格标籤分别為 ["Factory", "Main"]
同时也兼具 Preloading、初始化 Main Insatnce 的任务
接下来,利用 FactoryClass 作一个完整的 Preloading
Main.as package { import flash.display.*; [Frame(factoryClass="Factory")] public class Main extends MovieClip { // 随便嵌入一张大图,以突显 Preloading 作用 [Embed(source="assets/1600.jpg")] public var img:Class; public function Main():*{ this.addChild(new img()); } } } Factory.as
package{ import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.*; public class Factory extends MovieClip { public var percentTxt:TextField; public function Factory():*{ init(); } private function init():*{ stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; percentTxt = new TextField(); percentTxt.width = 100; percentTxt.height = 20; percentTxt.x = (stage.stageWidth – 100) / 2; percentTxt.y = (stage.stageHeight – 20) / 2; percentTxt.border = true; var tf:TextFormat = percentTxt.getTextFormat(); tf.align = TextFormatAlign.CENTER; percentTxt.defaultTextFormat = tf; this.addChild(percentTxt); this.addEventListener(Event.ENTER_FRAME, doEnterFrame); doEnterFrame(); stop(); } public function doEnterFrame(event:Event = null):void{ var percent:Number = Math.round(loaderInfo.bytesLoaded / loaderInfo.bytesTotal * 100); percentTxt.text = percent + "%"; if (loaderInfo.bytesLoaded == loaderInfo.bytesTotal) { this.removeEventListener(Event.ENTER_FRAME, doEnterFrame); this.removeChildAt(0); this.gotoAndStop(2); // Main Class 初始化 var main:Class = Class(getDefinitionByName("Main")); this.addChild(new main()); } } } }
※FactoryClass 使用要点:
1. 不可以在 Factory Class 内明确引用其它非 Preloading 期间需要用到的 Class,
否则会造成引用的 Class 在影格 1 输出,失去 Preloading 作用;
应该待读取完毕后,使用反射 (Reflection) flash.utils.getDefinitionByName 方式取得 Class。
2. SWF 载入完毕后,仍要让拨放头 (playhead) 前进,Main Class 才可以被使用。
ApplicationDomain 类的用途是存储 ActionScript 3.0 定义表。SWF 文件中的所有代码被定义为存在于应用程序域中。可以使用应用程序域划分位于同一个安全域中的类。这允许同一个类存在多个定义,并且还允许子级重用父级定义。
在使用 Loader 类 API 加载用 ActionScript 3.0 编写的外部 SWF 文件时,可以使用应用程序域。(请注意,在加载图像或用 ActionScript 1.0 或 ActionScript 2.0 编写的 SWF 文件时不能使用应用程序域。)包含在已加载类中的所有 ActionScript 3.0 定义都存储在应用程序域中。加载 SWF 文件时,通过将 LoaderContext 对象的 applicationDomain 参数设置为 ApplicationDomain.currentDomain, 可以指定文件包含在 Loader 对象所在的相同应用程序域中。通过将加载的 SWF 文件放在同一个应用程序域中,可以直接访问它的类。如果加载的 SWF 文件包含嵌入的媒体(可通过其关联的类名称访问),或者您要访问加载的 SWF 文件的方法,则这种方式会很有用,如下面的示例所示:
使用应用程序域时,还要记住以下几点:
SWF 文件中的所有代码被定义为存在于应用程序域中。主应用程序在“当前域”中运行。“系统域”中包含所有应用程序域(包括当前域),也就是包含所有 Flash Player 类。
所有应用程序域(除系统域外)都有关联的父域。主应用程序的应用程序域的父域是系统域。已加载的类仅在其父级中没有相关定义时才进行定义。不能用较新的定义覆盖已加载类的定义。
下图显示了某个应用程序在单个域 (domain1.com) 中加载多个 SWF 文件的内容。根据加载内容的不同,可以使用不同的应用程序域。紧跟的文本说明用于为应用程序中的每个 SWF 文件设置适当应用程序域的逻辑。

主应用程序文件为 application1.swf。它包含从其它 SWF 文件加载内容的 Loader 对象。在此方案下,当前域为 Application domain 1。用法 A、用法 B 和用法 C 说明了为应用程序中的每个 SWF 文件设置适当应用程序域的不同方法。
此方法的一个用处是使旧版应用程序能够动态加载相同应用程序的更新版本,而不会发生冲突。之所以不发生冲突,是因为尽管使用的是同样的类名称,但它们划分到不同的应用程序域中。
下面的代码创建作为系统域子级的一个应用程序域,并使用该应用程序域开始加载一个 SWF:
下面的代码加载一个 SWF,同时将其应用程序域设置为当前域:
此方法使加载的模块可以共享加载者的 singleton 对象和静态类成员。
下面的代码创建当前域的一个新子域,并使用该应用程序域开始加载一个 SWF:
收藏自adobehelp.adobe.com/zh_CN/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e07.html

转发:http://eidiot.net/2007/06/03/applicationdomain/
当程序越来越大,我们需要把它拆分成多个swf,在需要的时候动态加载。拆分时应该尽量把不同的类编译进唯一的swf,避免因swf文件增多而使整个程序的文件尺寸增大。按此原则可以拆分出以下两种swf,借助 ApplicationDomain 共享其代码和资源。
ApplicationDomain 是存放AS3定义(包括类、方法、接口等)的容器。使用Loader类加载swf时可以通过指定 ApplicationDomain 参数将swf加载到不同的域(Domain):
ApplicationDomain使用类似于显示列表(DisplayList)的树形结构。 相对于舞台(Stage) ,可以认为 ApplicationDomain 最根部的是系统域(system domain),包含 Flash Player 核心类定义。主程序所在的域(以下简称主域)就是它唯一的子域,类似于Stage下的文档类(Document Class)。
一个fla文档类里代码:
运行后的显示列表:

ApplicationDomain 的类似结构:

模块加载到同域不是一样可以吗?为何要加载到子域呢?好处就在于,卸载一个加载到子域的模块时,只要确保清除所有到该模块的引用,模块的所有类定义将被垃圾回收(Garbage Collection)。
有两种方式可以访问 ApplicationDomain :
ApplicationDomain 的 hasDefinition() 方法判断某定义是否存在,getDefinition() 方法获取指定的定义。下面以一个 例子 来介绍 ApplicationDomain 的具体用法和应用程序的拆分。
本例 有四个swf,shell.swf是主程序,lib.swf是共享库,login.swf和result.swf分别是“登录”和“结果”模块,所有的视 图元件都在共享库中。实际开发时可能有很多库,比如“位图库”、“音效库”、“模型通用库”等。“通用库”里存放多个模块共用的资源,比如此例中的背景元 素。而各个模块独有的资源还是放在各自的swf中。
主程序首先将共享库加载到同域,完成后将“登录模块”加载到子域。主程序可以像操作普通的视觉对象(DisplayObject)一样操作加载的模 块:监听事件、调用方法。因为编译器不会识别未定义的类,为使用强类型,建议为主类和模型定义相应的接口,使用少量的重复代码协助编程。
模块“继承”了主程序和共享库的所有类和资源,可以通过 ApplicationDomain.currentDomain.getDefinition() 来获取相应的类。注意获取不存在的类会抛出一个 ReferenceError。
登录模块获取库中的界面元素,并在点击按钮后抛出事件。Event类不允许带参数,必须使用继承Event的自定义事件抛出参数。主程序可以把 模块的自定义事件也编译进去(这样就增大了整个程序的文件尺寸),或者让监听模块事件的函数接受一个Objcet参数,以获取其动态属性。
主程序收到事件之后卸载注册模块,加载“结果模块”到子域,并将登录模块传出的”userName”参数传给结果模块。
注意initUi()方法分别使用了共享库中Libaray类的静态属性BG_NAME和静态方法getResult()。但是直接调用此静态方法会报错,可以先用 resultFunc 变量取出此方法。详细内容请参考 源代码。
转载来自http://weblogs.thekeunster.com/
In actionscript 3, you may find a set of functions in the “flash.utils” package that provides some facilities for reflection. Do not confuse this with the type of reflection you may get when applied as a visual effect, but the type of reflection that does the following basic things:
You can make use of the functions like “describeType”, which returns an XML object that describes the ActionScript object named as the parameter of the method. Some example uses of this are as followed:
If we wanted to go to the next step and create objects dynamically by name at runtime, we could manage by using the method “getDefinitionByName()”.
So, Even though these may seem like nifty functions, there are some limitations when it comes to reflection in the flash player, because of the absence of dynamic source compilation at runtime. The above works absolutely great for objects and classes that are already available internally at runtime such as the “Sprite” class. However, for custom class objects, we run into trouble if we do something like the following:
Even with the import statement on “com.customtypes.string”, the method call to “getDefinitionByName” will break without an internal reference to the class. The reason for this is because as stated before, runtime compilation of source is NOT allowable at the current time. Maybe in the future it might, but not now. To get around this, you have to have atleast one instantiation of the class type in your code for the above to work. So in your class definition you might want to declare a variable of the custom type you want to use:
So for the idea of dynamically creating a set of views in flex 2 using these methods in conjuction with an xml file that may hold the names of the views you want to use, in order for that to work, you will have to instantiate a variable of each type of view that you want to utilize.

如题,这些天看 flex-sdk很有收获,不过新的疑问也产生了。
在一个as文件想定义多个public类是可用package来括起来。
in s.as
在flex中定义全局函数的方法如下: