Pay for Hesitation

Pages

2011年5月18日 星期三

[心得] ByteArray.compress 壓縮函數

這篇文章描述了使用 compress 並不會減少實際記憶體使用量

以及解決方法

http://etrex.blogspot.com/2011/05/bytearraycompress.html

2011年5月15日 星期日

Getting the total percent loaded from Bulkloader with AS3

The bad News:
Without knowing the total bytes we can’t calculate a percentage. Each file added to BulkLoader’s queue occupies 1 connection. If there are more files than there are connections, BulkLoader can’t accurately retrieve the sizes of those files waiting for a connection to free up.

This means that the percentLoaded will be 0 almost until all items are loaded, and then it will jump abruptly. Worse, each time a new connection is open, the bytesTotal would jump around (it would add the bytesTotal for the new item). To mitigate this issue, bytesTotal will remain 0 until all file sizes are known.”

Getting the Total Percent Loaded from BulkLoader with Flash ActionScript 3

2011年5月8日 星期日

AS3 Gif Player

http://www.bytearray.org/?p=95
http://code.google.com/p/as3gif/

2011年4月26日 星期二

Import fl components into Flash Builder

Download fl packages
http://apdevblog.com/update-using-flvideo-package-w-eclipse-and-fdt3/

Export fl.* components
http://joshblog.net/2008/02/10/how-to-use-the-flash-cs3-component-set-in-a-flex-builder-actionscript-project/

add above swc to the build path of your flash builder project.

2011年4月24日 星期日

Robotlegs Class Diagram

Flash Display List

2011年4月18日 星期一

Communication with JSON v.s. Flash Remoting?

http://serialseb.blogspot.com/2008/01/comparing-serializations-or-why-flash.html

Passing parameters to ActionScript from HTML query strings

URL String: http://me.com/index.html?name=redbug&bday=0314

Method 1: root.loaderInfo.parameters
1. get query strings in url by javascript
  • window.location.href
  • window.location.search
2. passing parameter to SWF in HTML
3. receive parameter in ActionScript




Method 2: ExternalInterface.call('javascript function name')
receiving parameters in ActionScript




Reference:
Flex程序如何获取html容器传递的URL参数值
ActionScript JavaScript Communication
ActionScript 3.0 Cookbook - Chapter 22 Building Integrated Application

2011年4月13日 星期三

[BulkLoader] Failed to get content with url as type: [class Bitmap]

今天試玩Google image search API, 用bulkloader來載圖,
在flash builder上run的好好的,但放在網路就無法執行。
後來trace bulkloader的ImageItem.as source code



才發現bulkloader在發生cross domain security error時,並不會把err丟出來,反而是把載好圖的loader丟給上層。
回去翻文件,才發現其實文件有寫... XD


SecurityError

BulkLoader can handle SecurityErrorEvents. By listening to BulkLoader.SECURITY_ERROR("securityError"), client code can gracefully handle security error events. Listeners can be added to each LoadingItem subtype or to the entire BulkLoader object. Please note that if you add an event listener for a LoadingItem but not for BulkLoader, in case the event fires, it will bubble up and result in a unhandled security error. In order to make sure the error never goes unhandled, add a securityError handler to the BulkLoader instance.
This mechanism will catch events thrown on
.load operations. Event thrown when trying to access content (such as getBitmapData) is still left to client code to handle.
When using type=image or type=movieclip (which are loaded using a Loader instance), if, when the asset is loaded, accessing it's loader.content throws an error, then BulkLoader will gracefully recover and use a simple Loader instance. This way, you can still add a Loader object to the stage, but won't be able to run code inside of it (for MovieClip instances) or load it as data (transforming to BitmapData instances).
In this case, you can get the Loader instance either using getContent or getDisplayObjecLoader .


所以原本寫的
addChild( imageLoader.getBitmap( key ) );

改寫成
addChild( imageLoader.get( key ).content );

就不會有cross domain security 討人厭的問題了.

Ref:
http://groups.google.com/group/bulkloader-users/browse_thread/thread/31189ad472fb1d90

2011年4月12日 星期二

Removing an SVN location from Eclipse using Subclipse

有時候手殘在subclipse輸入了一些錯誤的,或不再用的repository location,
雖然留在那也沒怎樣,但就是很礙眼。

http://stackoverflow.com/questions/3545926/removing-an-svn-location-from-eclipse-using-subclipse

  • Window -> show view -> Other... -> SVN repositories
  • "SVN repositories" view shows list of locations
  • You can right click on location and select "Discard Location" menu.