﻿
/// <reference path="../../../../jQuery/1.3.2/jquery-1.3.2-vsdoc.js" />
 
/**
 *
 * SwfExternalDataHost
 *
 * =========================================
 * THIS CLASS IS DESIGNED TO BE SUBCLASSED
 * =========================================
 *
 * Contains a swf instance, managing and encapsulating the 2-way communication between swf and itself.
 * 
 * The swf registers a series of common externally callable methods including:
 *		- triggerDataLoad()
 *
 * - Writes the flash element into the page replacing a specified page element, storing an internal reference to the object to facilitate communication
 *
 * - Provides core interface methods called by the swf element including
 *		- isPageLoaded()
 *		- retriveData() / getData()
 *		- setSwfReady()
 *
 * - Subclasses provide specific custom methods
 */
 
 
	//Check that namespace into which the Class definition will be creates has been defined & if not then create
	
	if (!mrm.global.isNamespaceDefined("mrm.common.display")) mrm.global.createNamespace("mrm.common.display", "1.0");
	
	
	mrm.common.display.SwfExternalDataHost = mrm.common.display.SwfHost.subClass(
		{
			/*
			 =============================
			 CONSTRUCTOR
			 =============================
			 */
				init : function (classInstanceID, replacementTargetParentID, replacementTargetID, swfInstanceID, targetFlashVersion, swfAttributesObject, swfParametersObject, swfFlashVars, swfData, deferSwfSetup)
				{
					this._swfData = swfData;
					
					var deferSetup = (deferSwfSetup) ? true : false;
					
					// Call super class init()
					this._super(classInstanceID, replacementTargetParentID, replacementTargetID, swfInstanceID, targetFlashVersion, swfAttributesObject, swfParametersObject, swfFlashVars, deferSetup);
				},
			
			
			
			/*
			 =============================
			 INTERNAL RUN-TIME PROPERTIES
			 =============================
			 */
				// Swf data - requested by flash object when created
				_swfData : undefined,
				
				// Swf ready status flag
				_swfReady : false,
			
			
			
			
			/*
			 =============================
			 PUBLIC METHODS
			 =============================
			 */
				
				isPageLoaded : function ()
				{
					return mrm.global.isPageLoaded();
				},
			
				
				getSwfObjectReady : function ()
				{
					return this._swfReady;
				},
			
				
				setSwfObjectReady : function (b, swfObjectID)
				{
					this._swfReady = b;
				},
			
				
				getSwfData : function ()
				{
					return this._swfData;
				},
				
				
				remoteTrace : function (traceStatements)
				{
					setTimeout("alert('"+traceStatements+"')",1);
				},
			
			
			
			/*
			 =============================
			 INTERNAL / PRIVATE METHODS
			 =============================
			 */
				/*
				 ---------------------------
				 OVERRIDE REMOVE AND SET 'ready' STATUS
				 ---------------------------
				 */
				_removeSwfObject : function ()
				{
					//alert("mrm.common.display.SwfExternalDataHost : _removeSwfObject");
					// Remove swf
					this.setSwfObjectReady(false);
					
					// Call super class
					this._super();
				}
			
		}
	)
	
	//alert("mrm.common.display.SwfExternalDataHost ::  Class definition successful");

