Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add an onReadyCallback flashvar

  • Loading branch information...
commit f9fb4ac2ffec42271de594c6b29bc3d0940b3649 1 parent 68cfbc6
@xpac27 xpac27 authored
Showing with 16 additions and 14 deletions.
  1. +1 −1  Makefile
  2. +2 −2 src/core/xdcom/Api.as
  3. +13 −11 src/core/xdcom/XDCom.as
View
2  Makefile
@@ -8,5 +8,5 @@ all.js: $(FILES)
MXMLC_BIN := mxmlc
xdcom.swf: src/core/xdcom/*.as
- $(MXMLC_BIN) --strict -optimize -debug=false -sp src/core/xdcom -o xdcom.swf -- src/core/xdcom/XDCom.as
+ $(MXMLC_BIN) --strict -optimize -debug=false -static-link-runtime-shared-libraries=true -sp src/core/xdcom -o xdcom.swf -- src/core/xdcom/XDCom.as
View
4 src/core/xdcom/Api.as
@@ -48,10 +48,10 @@ package
}
// Dispatch the ready status
- public function setReady() : void
+ public function setReady(onReadyCallback : String) : void
{
this.ready = true;
- ExternalInterface.call('onXDComReady', this.id);
+ ExternalInterface.call(onReadyCallback, this.id);
}
// Call postMessage on the XDCom instance
View
24 src/core/xdcom/XDCom.as
@@ -28,19 +28,21 @@ package
public dynamic class XDCom extends Sprite
{
- private var localID : String;
- private var remoteID : String;
- private var api : Api;
- private var connection : LocalConnection;
+ private var localID : String;
+ private var remoteID : String;
+ private var onReadyCallback : String;
+ private var api : Api;
+ private var connection : LocalConnection;
public function XDCom() : void
{
Security.allowDomain('*');
- this.localID = '';
- this.remoteID = '';
- this.api = new Api(this);
- this.connection = new LocalConnection();
+ this.localID = '';
+ this.remoteID = '';
+ this.onReadyCallback = 'onXDComReady';
+ this.api = new Api(this);
+ this.connection = new LocalConnection();
this.addEventListener(Event.ADDED_TO_STAGE, this.addedToStageHandler);
}
@@ -56,7 +58,7 @@ package
if (success)
{
- this.api.setReady();
+ this.api.setReady(this.onReadyCallback);
}
}
}
@@ -66,7 +68,7 @@ package
{
var v : *;
var success : Boolean = true;
- for each (var flashvar : String in ['remoteID', 'localID'])
+ for each (var flashvar : String in ['remoteID', 'localID', 'onReadyCallback'])
{
v = LoaderInfo(this.root.loaderInfo).parameters[flashvar];
if (v === null || v === false || typeof v != 'string' || v == '')
@@ -76,7 +78,7 @@ package
}
this[flashvar] = v;
}
- return this.localID != '' && this.remoteID != '' && success;
+ return this.localID != '' && this.remoteID != '' && this.onReadyCallback != '' && success;
}
// Init the connection to the LocalConnection
Please sign in to comment.
Something went wrong with that request. Please try again.