Swiff.remote

75 views
Skip to first unread message

Sean Mehra

unread,
Jul 24, 2008, 9:16:52 PM7/24/08
to MooTools Users
If you are getting errors like "obj.CallFunction is not a function" or
you can't get the "onLoad" thing to work:

Make sure you do the following:

1) //(JavaScript)
var obj = new Swiff('mySwf.swf', {
width: 1,
height: 1,
container: $('swiffContainer'),
events: {
onLoad: function() {
alert("Flash is loaded!")
}
}
});


should actually have callBacks not events. So it should read:

//(JavaScript)
var obj = new Swiff('mySwf.swf', {
width: 1,
height: 1,
container: $('swiffContainer'),
callBacks: {
onLoad: function() {
alert("Flash is loaded!")
}
}
});


This is reflective of a recent change in the code.

Also, in the actionscript, it should read:

//Fires the 'onLoad' event within the Swiff object.
ExternalInterface.call(onLoad);


Calling
ExternalInterface.call("onLoad");

with the "quotes" will try to call a global function in javascript
called onLoad();


Finally, when you call an Actionscript function from JS, you can't use
the way it is said in the documentation. You'll get errors.

Instead do this:

swiffInstance.toElement().functionName();

or

Swiff.remote(swiffInstance.toElement(), 'functionName');


Hope that helps other people having similar problems.

shanebo

unread,
Sep 8, 2008, 2:45:44 PM9/8/08
to MooTools Users
Sean,

Thanks for trying to help with the error in their documentation. I'm
getting the error you referenced above:

"obj.CallFunction is not a function"

I understand your code above but don't know how to get the instance of
the Swiff object. Any ideas?

shane

Garrick

unread,
Oct 22, 2008, 6:17:08 PM10/22/08
to MooTools Users
The instance of the Swiff object is whatever var you set it as.

var obj = new Swiff('mySwf.swf', {
width: 1,
height: 1,
container: $('swiffContainer'),
callBacks: {
onLoad: function() {
alert("Flash is loaded!")
}
}
});

Instance of the Swiff object here is 'obj'.

Sean, when you're doing:

swiffInstance.toElement().functionName(); or
Swiff.remote(swiffInstance.toElement(), 'functionName');

Why is it necessary to do the toElement() method? Shouldn't the
swiffInstance suffice?

I'm just trying to understand how this thing works.
Reply all
Reply to author
Forward
0 new messages