Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
将原有的Flex project的SDK从3.2改到3.4后,如果你的代码足够多,那么这个问题你很可能会遇到,如下面是我的代码:
_selectionList = new List(); _selectionList.width = 360; _selectionList.dataProvider = _selectionDataProvider; _selectionList.selectedItem = _valueInput; _selectionList.addEventListener(ListEvent.CHANGE, onListSelectionChange);
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
在ActionScript有两种type cast: var c1:ArrayCollection = c as ArrayCollection; var c2:ArrayCollection = ArrayCollection(c); 前者中c可以为null, 而后者要求c不可为null,否则throw Error.
如下代码:
var obj:Object = [1, 2, 3]; trace(Array(obj).length);
运行后输出代码为3还是1?
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
In Flex, you never need two different sources to build your application in browser and in AIR. For example:
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
有些objects是无法确定何时被创建的,给这些自动创建的objects传值有一定的挑战。我们假设自动生成的objects为o1, o2, … 其class为O,另外一组可以非自动生成的objects a1, a2, … 对应class为A。目的:我们需要o2来获取a2的reference. 可以考虑的方法有:
- 我们创建一个hash map, 而且此hash map是Singleton, 将a1, a2 …等都放进去,这样在任何地方,都可以通过HashMap.singleton.getA(“2”)类似的方法获取到a2. 实际上这就是设计模式Service Locator的一种典型应用;设计模式并非是万能药,这里使用它有点用牛刀杀鸡的感觉。这里还有一个问题是,要a2来传递”2“给service locator, 此”2“本身也得被传入,所以没有解决根本问题。
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
如果DataGrid上面的列过多,它会自动收缩列的宽度,这种情况下我们更需要的是scrollbar。解决这个问题很简单:
datagrid.horizontalScrollPolicy = ScrollPolicy.AUTO;
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
The more you use a program, the more bugs you will find in it. This is the case with Eclipse, WTP in particular. If the application server (I use Tomcat) starts and yet the web module is not loaded, you should:
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
This article gives ideas for developing loading screens for Flex applications. The loading sequence for a typical RIA application could be:
[0. Downloading the runtime binary] -> [1. Application initializing] -> [2. Application started]
For Flex/flash application, the preloader will be displayed at step 0. At step 1, application is running and it's up the application to display any loading screen. One of our RIA app needs to load metadata from server thus we do need a loading screen at step 1.
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
Pattern name 模式名: Cancellable Selection Classification 分类: Behavioral
Motivation: 在多对象共享同一个编辑器(editor)或者在任何时间仅允许一个编辑器的情况下, 如果当前对象尚未保存, 界面不应该直接转换到新的对象 - 至少应该给用户警告并提示选择的机会. 例如: 多个tabs, 每个tab页面有可编辑的对象; 一个tree, table或者list上显示所有文件, 旁边为唯一共享的编辑器.
Approach:
将selection明确分成两个阶段 - 一是试图选择的阶段, 此阶段的任务是询问所有listeners是否同意选择; 如果第一阶段一致同意, 第二阶段才是实施真正的选择.
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
try { ...}catch(Exception e){ e.printStackTrace();}
实际上, 这是不足够的. 请看下面的例子:
Source: RIA Shanghai | Adobe上海用户组 blogs by Jack Li
错误原因
默认的情况下, Sun JRE的class loader(类的加载器)只能使用最多64M的内存, 如果有大量的类, 所需内存超过这个数字, 以上错误就产生了.
Note: this is not the official Adobe coding convention spec. In fact, it is our own version.
Download the file in PDF format:
Table of Contents
1 Introduction
1.1 Convention
1.2 Recommendation importance
1.3 Major differences with traditional code conventions
1.4 Major difference with Adobe conventions
2 Naming Conventions
2.1 General naming guidelines
2.2 Package names
2.3 Class names
2.4 Interface names
2.5 Variable/property names
2.6 Function names
2.7 Event names
2.8 Namespace names
3 File Format
3.1 File name
3.2 File content
4 Statements
4.1 Packages and imports
4.2 Declarations
4.3 Control Flows
4.4 Literals
4.5 White spaces
5 Documentation & Commenting
5.1 General rules
5.2 ASDoc
6 ActionScript Best Practices
6.1 General Programming
6.2 Logging
6.3 Testing with FlexUnit
6.4 Updating Flex SDK Regularly
Appendices
ASDoc tag reference
We made a big change to the Adobe Groups homepage today. Now, when you log in, you'll see a list of all groups that you have joined right there on the page.
No more bookmarking groups or having to go to your profile page to see the full list!