////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package mx.modules
{
import flash.events.IEventDispatcher;
import flash.system.ApplicationDomain;
import flash.system.SecurityDomain;
import flash.utils.ByteArray;
import mx.core.IFlexModuleFactory;
//--------------------------------------
// Events
//--------------------------------------
/**
* Dispatched by the backing ModuleInfo if there was an error during
* module loading.
*
* @eventType mx.events.ModuleEvent.ERROR
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Event(name="error", type="mx.events.ModuleEvent")]
/**
* Dispatched by the backing ModuleInfo at regular intervals
* while the module is being loaded.
*
* @eventType mx.events.ModuleEvent.PROGRESS
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Event(name="progress", type="mx.events.ModuleEvent")]
/**
* Dispatched by the backing ModuleInfo once the module is sufficiently
* loaded to call the IModuleInfo.factory()
method and the
* IFlexModuleFactory.create()
method.
*
* @eventType mx.events.ModuleEvent.READY
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Event(name="ready", type="mx.events.ModuleEvent")]
/**
* Dispatched by the backing ModuleInfo once the module is sufficiently
* loaded to call the IModuleInfo.factory()
method and
* the IFlexModuleFactory.info()
method.
*
* @eventType mx.events.ModuleEvent.SETUP
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Event(name="setup", type="mx.events.ModuleEvent")]
/**
* Dispatched by the backing ModuleInfo when the module data is unloaded.
*
* @eventType mx.events.ModuleEvent.UNLOAD
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
[Event(name="unload", type="mx.events.ModuleEvent")]
/**
* An interface that acts as a handle for a particular module.
* From this interface, the module status can be queried,
* its inner factory can be obtained, and it can be loaded or unloaded.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
public interface IModuleInfo extends IEventDispatcher
{
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
//----------------------------------
// data
//----------------------------------
/**
* User data that can be associated with the singleton IModuleInfo
* for a given URL.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get data():Object;
/**
* @private
*/
function set data(value:Object):void;
//----------------------------------
// error
//----------------------------------
/**
* A flag that is true
if there was an error
* during module loading.
*
*
This flag is true
when the ModuleManager dispatches the
* ModuleEvent.ERROR
event.
null
after the
* ModuleEvent.SETUP
event has been dispatched
* (or the IModuleInfo.setup()
method returns true
).
* At this point, the IFlexModuleFactory.info()
method can be called.
* Once a ModuleEvent.READY
event is dispatched
* (or the IModuleInfo.ready()
method returns true
),
* it is possible to call the IFlexModuleFactory.create()
method.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get factory():IFlexModuleFactory;
//----------------------------------
// loaded
//----------------------------------
/**
* A flag that is true
if the load()
* method has been called on this module.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function get loaded():Boolean;
//----------------------------------
// ready
//----------------------------------
/**
* A flag that is true
if the module is sufficiently loaded
* to get a handle to its associated IFlexModuleFactory implementation
* and call its create()
method.
*
* This flag is true
when the ModuleManager dispatches the
* ModuleEvent.READY
event.
true
if the module is sufficiently loaded
* to get a handle to its associated IFlexModuleFactory implementation
* and call its info()
method.
*
* This flag is true
when the ModuleManager dispatches the
* ModuleEvent.SETUP
event.
progress
events as loading proceeds.
*
* @param applicationDomain The current application domain in which your code is executing.
*
* @param securityDomain The current security "sandbox".
*
* @param bytes A ByteArray object. The ByteArray is expected to contain
* the bytes of a SWF file that represents a compiled Module. The ByteArray
* object can be obtained by using the URLLoader class. If this parameter
* is specified the module will be loaded from the ByteArray. If this
* parameter is null the module will be loaded from the url specified in
* the url property.
*
* @param moduleFactory The moduleFactory of the caller. One use of the
* moduleFactory is to determine the parent style manager of the loaded
* module.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function load(applicationDomain:ApplicationDomain = null,
securityDomain:SecurityDomain = null,
bytes:ByteArray = null,
moduleFactory:IFlexModuleFactory = null):void;
/**
* Releases the current reference to the module.
* This does not unload the module unless there are no other
* open references to it and the ModuleManager is set up
* to have only a limited number of loaded modules.
*
* @see mx.modules.ModuleManager
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function release():void;
/**
* Unloads the module.
* Flash Player and AIR will not fully unload and garbage collect this module if
* there are any outstanding references to definitions inside the
* module.
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function unload():void;
/**
* Publishes an interface to the ModuleManager. This allows late (or decoupled)
* subscriptions to factories with a String handle. Use a URL that starts with
* publish://
to reference factories that are published in this manner.
*
* @param factory The class that implements the module's IFlexModuleFactory interface.
*
* @see mx.modules.ModuleManager
*
* @langversion 3.0
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
*/
function publish(factory:IFlexModuleFactory):void;
}
}