Pay for Hesitation: library

Pages

顯示具有 library 標籤的文章。 顯示所有文章
顯示具有 library 標籤的文章。 顯示所有文章

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

2010年12月2日 星期四

CJ Signals

可以參考一下

http://cjcat.blogspot.com/2010/07/cjsignals-my-new-observer-framework.html

Dispatch Custom Values via DeluxeSignal

http://groups.google.com/group/as3-signals/msg/474cc2ec4e122be1?pli=1

Yes ,that works. 
Thank you Robert for a fast response. 
On Sep 17, 1:50 am, Robert Penner  wrote: 
> Try new DeluxeSignal(this, IEvent, String,int); 
> Sorry this isn't well-documented. 
> Robert 
> On Sep 16, 4:17 pm, iki_xx  wrote: 
> > How can I dispatch custom values via DeluxeSignal? 
> > Meaning: 
> > new DeluxeSignal = new DeluxeSignal(this,String,int); 
> > deluxeInstance.dispatch(new GenericEvent(),'"foo",999); 
> > it doesnt work , I get runtime errors : Value object <[object 
> > GenericEvent]> is not an instance of <[class String]>. 
> > how can I dispatch/catch those parameters ? 
> > Do I have to extend the GenericEvent class, and add those parameters 
> > to the subclass of the GenericEvent class? 
> > Thanks 

2008年3月13日 星期四

Visual Graph Library

晨型人早~

不小心看到一個最新(2/24才出來的@@)的Flex的visualization library,在Google code上面
flexvizgraphlib - Flex Visual Graph Library
看了這個demo, 整個驚豔了 ....
Visual Graph Explorer

The actionscript-based library enables users to create complex data visualization interfaces for the analysis of relational data sets such as social networks, organization trees, navigation systems, taxonomies, db schemas, and other link-based phenomena. The library is purposely extendable and provides for separation of base, interface, and layout code. Additional layout algorithms can be readily integrated as an extended class containing only the mathematical calculations and controls needed specifically for the layout.

2008年3月10日 星期一

Flex Component Libraries

超多已經寫好的mxml介面,是opensource,而且一直有在新增維護。
Flex Interface Component Library

Yahoo!發表的一個Flash/Flex component library,也是opensource,也挺酷的。
ASTRA: ActionScript Toolkit for Rich Applications
Yahoo!的Flash計畫以及相關library。
Yahoo! Flash Developer Center

只要輸入一個swf的url,就可以判斷這個flash檔是不是flex寫出來的。
Is it flex?