Source code is available under a GPL license, in the public hg repository here: http://open.zoomorama.com/hg/as3.rebase/.
The current official release is 20091220-0.1.
This is meant to be usable with Flex SDK 3.4 or greater.
Has exactly the same signature as the original ExternalInterface, except for the addition of an extra method:
public static function jsThrow( message: String ): void
The main difference with the native class is that you can actually rely on the value of the “available” property.
This has the same signature as the original Capabilities class except that:
public function get BrowserVersion():Number
public function get OperatingSystem():String
public function get Browser(): String
These additional informations will default to “unknown” and 0 if scripting is not possible in your application context.
Technically, these are what you would expect if working in javascript (see the Capabilities.js file for details).
This simple extension to the native Error class makes available the following getters:
public static function get ERROR_NOT_INITIALIZED() : ZMError
public static function get ERROR_ALREADY_INITIALIZED() : ZMError
public static function get ERROR_NOT_IMPLEMENTED() : ZMError
public static function get NOT_FOUND_ERR() : ZMError
public static function get FATAL() : ZMError
If your application has the rights to script, you can be notified that the embedding webpage has been closed or navigated away.
Usage is very simple:
ULoad.instance.enable( m_Dispatcher );
where the signature of enable is:
public function enable( value: IEventDispatcher ):void
Whenever the page quits, an Event.UNLOAD is dispatched onto your IEventDispatcher object.
To have mousewheel support in contexts where the plugin is broken, simply do a:
WackyWheels.instance.enable( m_Dispatcher );
with signature:
public function enable( value: IEventDispatcher ):void
The MimeService embeds a number of the most widely used mimetypes, and provides a couple of methods to manipulate them, namely:
public function getTypeFromExtension( extension : String ): String
public function getPrimaryExtensionFromType( type : String ): String
public function getExtensionsFromType( type : String ): Array
These two simply provide constants shortcuts to the officially defined colors (HTML4 and SVG), nothing more.
The usage of this singleton is straightforward:
public function fromXML( obj: Object, iFace: Class, xmlNode: XMLList ): void
public function fromJSON( obj: Object, iFace: Class, node: Object ): void
Given the object “obj”, the “iFace” interface that it implements will be enumerated, and all readwrite accessors will be populated with an identically named value in the passed “node”.
Please note the following important points:
Using the logger is quite simple.
First, your application should pick a setting for what level of error reporting you desire:
For example, this will report *everything*:
ErrorLogger.instance.level = ErrorLogger.DEBUG | ErrorLogger.ERROR | ErrorLogger.FATAL | ErrorLogger.INFO | ErrorLogger.WARNING;
while this will just report error and fatal conditions:
ErrorLogger.instance.level = ErrorLogger.ERROR | ErrorLogger.FATAL;
Secondly, you need to tell the logger what backend it should use:
ErrorLogger.instance.backends = ErrorLogger.AS_TRACE | ErrorLogger.JS_INLINE;
This above will “trace” AND use an HTML constructed console.
Currently available backends are:
// html built console
public static const JS_INLINE : int = 1;
// usual trace...
public static const AS_TRACE : int = 2;
// terminal dump
public static const JS_DUMP : int = 4;
// javascript "console" call
public static const JS_CONSOLE: int = 8;
// not implemented yet
public static const FLASH_DUMP: int = 16;
public static const SERVER_POST : int = 32;
The global setup being done, you may use any of the following methods wherever in your code:
ErrorLogger.instance.info("some info", "whatever", "thing");
ErrorLogger.instance.warning("some warning", "whatever", "thing");
ErrorLogger.instance.debug("some debug", "whatever", "thing");
ErrorLogger.instance.error("some error", "whatever", "thing");
try{
ErrorLogger.instance.fatal("some fatal error", "whatever", "thing");
}catch(e: Error){
// Fatal conditions call will obviously throw
}
try{
ErrorLogger.instance.assert(boolean, "whatever", "thing");
}catch(e: Error){
// Failing assertions will obviously throw
}
Important notes:
The rebase project makes use of conditional compilation flags, that you should add to your compiler settings, namely:
The “debug” flag should always be false unless you are planning to debug the rebase library itself…
The “errorlogger” flag should be set to true if you expect anything to come out from ErrorLogger calls. It may be turned to false as a mean to reduce the footprint when releasing an application officially, while still letting calls into your code. It's not really recommended if you still plan on obtaining debugging informations from it though (you may rather pay the price for the additional code, and mute it down in production by picking the right backend and/or error level reporting).