Packageorg.as3commons.bytecode.emit
Interfacepublic interface IAbcBuilder extends flash.events.IEventDispatcher
Implementors AbcBuilder

Describes an object capable of creating a valid AbcFile, ready to be loaded into the AVM.



Public Methods
 MethodDefined By
  
build(applicationDomain:ApplicationDomain = null):AbcFile
Builds an AbcFile using the previously defined IPackageBuilder instances.
IAbcBuilder
  
buildAndExport(applicationDomain:ApplicationDomain = null):ByteArray
Builds, serializes and wraps the AbcFile in a SWF, the resulting ByteArray can be saved to disk as a .swf file for later use.
IAbcBuilder
  
buildAndLoad(applicationDomain:ApplicationDomain = null, newApplicationDomain:ApplicationDomain = null):AbcFile
Builds the AbcFile and immediately loads it into the AVM.
IAbcBuilder
  
defineClass(fullName:String, superClassName:String = null):IClassBuilder
Creates an IClassBuilder instance for the specified fuly qualified class name and super class name.
IAbcBuilder
  
defineInterface(fullName:String, superInterfaceNames:Array = null):IInterfaceBuilder
Creates an IInterfaceBuilder instance for the specified fully qualified interface name and super interface names.
IAbcBuilder
  
defineNamespace(fullScopeName:String, URI:String):INamespaceBuilder
IAbcBuilder
  
Creates an IPackageBuilder instance for the specified package name.
IAbcBuilder
Events
 Event Summary Defined By
  Dispatched when the class loader has finished loading the SWF/ABC bytecode in the Flash Player/AVM.IAbcBuilder
  Dispatched when the class loader has encountered an IO related error.IAbcBuilder
  Dispatched when the class loader has encountered a SWF verification error.IAbcBuilder
Method Detail
build()method
public function build(applicationDomain:ApplicationDomain = null):AbcFile

Builds an AbcFile using the previously defined IPackageBuilder instances.

Parameters

applicationDomain:ApplicationDomain (default = null) — The applicationDomain that has access to the super classes that are defined for any classes defined in the AbcFile, defaults to ApplicationDomain.currentDomain.

Returns
AbcFile — The created AbcFile.
buildAndExport()method 
public function buildAndExport(applicationDomain:ApplicationDomain = null):ByteArray

Builds, serializes and wraps the AbcFile in a SWF, the resulting ByteArray can be saved to disk as a .swf file for later use.

Parameters

applicationDomain:ApplicationDomain (default = null) — The applicationDomain that has access to the super classes that are defined.

Returns
ByteArray — The ByteArray containing the serialized AbcFile wrapped inside a SWF.
buildAndLoad()method 
public function buildAndLoad(applicationDomain:ApplicationDomain = null, newApplicationDomain:ApplicationDomain = null):AbcFile

Builds the AbcFile and immediately loads it into the AVM.

This behaviour is asynchronous, so be sure to listen for the Event.COMPLETE, IOErrorEvent.IO_ERROR and IOErrorEvent.VERIFY_ERROR on the current IAbcBuilder.

Once the Event.COMPLETE event has been fired it will be possible to retrieve a reference to the generated classes through the specified application domain, like this:

var cls:Class = applicationDomain.getDefinition("com.myclasses.MyGeneratedClass") as Class

Parameters

applicationDomain:ApplicationDomain (default = null) — The applicationDomain that has access to the super classes that are defined for any classes defined in the AbcFile, defaults to ApplicationDomain.currentDomain.
 
newApplicationDomain:ApplicationDomain (default = null) — The ApplicationDomain in which the newly created AbcFile will be loaded, defaults to ApplicationDomain.currentDomain.

Returns
AbcFile — The created AbcFile.
defineClass()method 
public function defineClass(fullName:String, superClassName:String = null):IClassBuilder

Creates an IClassBuilder instance for the specified fuly qualified class name and super class name.

Parameters

fullName:String — The fully qualified name of the new class. I.e. com.myclasses.MyGeneratedClass.
 
superClassName:String (default = null) — The fully qualified super class name. I.e. mx.events.FlexEvent, defaults to Object.

Returns
IClassBuilder — The specified IClassBuilder instance.
defineInterface()method 
public function defineInterface(fullName:String, superInterfaceNames:Array = null):IInterfaceBuilder

Creates an IInterfaceBuilder instance for the specified fully qualified interface name and super interface names.

Parameters

fullName:String — The fully qualified name of the new interface. I.e. com.myinterfaces.IMyGeneratedInterface.
 
superInterfaceNames:Array (default = null) — The fully qualified super interface names. I.e. mx.styles.IStyleClient.

Returns
IInterfaceBuilder — The specified IInterfaceBuilder instance.
defineNamespace()method 
public function defineNamespace(fullScopeName:String, URI:String):INamespaceBuilder

Parameters

fullScopeName:String
 
URI:String

Returns
INamespaceBuilder
definePackage()method 
public function definePackage(name:String):IPackageBuilder

Creates an IPackageBuilder instance for the specified package name.

An example of a package name: com.myclasses.test

Parameters

name:String — The specified package name

Returns
IPackageBuilder — The specified IPackageBuilder instance.
Event Detail
complete Event
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

Dispatched when the class loader has finished loading the SWF/ABC bytecode in the Flash Player/AVM.

ioError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.IO_ERROR

Dispatched when the class loader has encountered an IO related error.

verifyError Event  
Event Object Type: flash.events.IOErrorEvent
IOErrorEvent.type property = flash.events.IOErrorEvent.VERIFY_ERROR

Dispatched when the class loader has encountered a SWF verification error.