I was loading an Actionscript 3 swf into a div using mootools with
the following code:
var swf = new Swiff('webcam.swf', {
id: 'webcam',
width: 720,
height: 370,
container: $('swf-content'),
events: {
onLoad: function(){
alert('flash loaded!');
}
}
});
Up until a few days ago the onLoad event was giving me an alert as it
should then it suddenly stopped working. I've also tried replacing it
with:
callBacks: {
load: function(){
alert('flash loaded!');
}
}
but this does not produce an alert either. Documentation on the Swiff
class is sparse.
I've looked around and I found the following Actionscript which I
added with no results:
import flash.external.*;
ExternalInterface.call('onLoad');
I also tried:
ExternalInterface.call('load');
with no luck.
Has anyone else encountered issues with onLoad firing properly for
Swiff? I'm brand new to using Swiff and maybe I'm not understanding
how this works or something. I find it really strange that it WAS
working and then stopped.
I've got it working again by using Request and requesting a php file
that has the flash object in it and then setting the HTML of 'swf-
content'. I don't think that's an ideal solution since older versions
of IE will require the object to be activated before it can be used
(ie. ActiveXObject).
I'd really appreciate any insight, thanks!
import flash.external.*;
ExternalInterface.call(onLoad);
as suggested causes these errors when compiling:
1120: Access of undefined property onLoad.
Warning: 3553: Function value used where type Object was expected.
Possibly the parentheses () are missing after this function reference.
What I am trying to do is fade in the 'swf-content' div once the swf
has loaded. Unfortunately it's impossible to do without a working
onLoad: event.
Anyone have any thoughts?
1120: Access of undefined property onLoad. is because onLoad is not
surrounded by "".
the idea behind all this is that flash has no onLoad event, it is
"faked" by placing this ExternalInterface.call("JSFUNCTIONNAME");
method as last executed line of code in flash.
--
jgabios
http://bash.editia.info
I did have the "" (quotes) around onLoad at one point and it didn't
work then either.
This is the last three lines of my flash file:
if(ExternalInterface.available){
ExternalInterface.call("onLoad");
}
and my Javascript code:
var swf = new Swiff(content, {
id: 'webcam',
width: 720,
height: 370,
container: $('swf-content'),
callBacks: {
onLoad: function(){
alert('flash loaded!');
}
}
});
I must be completely confused with this, because I've tried everything
and can't get it working...
On Jan 21, 1:17 pm, gabriel munteanu <jajali...@gmail.com> wrote:
> Hi, i made it work it my jsblaster game project.
> here is 1 source file :http://code.google.com/p/js-blaster/source/browse/trunk/js-blaster/sr...
> my similar line is the 28th: but my js function is called flashLoadedHandler.
> you should make this line as the last line executed in flash, in order
> to have all other flash resources loaded if possible.
>
> 1120: Access of undefined property onLoad. is because onLoad is not
> surrounded by "".
> the idea behind all this is that flash has no onLoad event, it is
> "faked" by placing this ExternalInterface.call("JSFUNCTIONNAME");
> method as last executed line of code in flash.
>
--
jgabios
http://bash.editia.info
--
jgabios
http://bash.editia.info
So if I declare the onLoad function like so:
var onLoad = function(){}
And then call it within the Swiff object, you're saying that it should
work. I don't see how it will...
--
jgabios
http://bash.editia.info
var swf = new Swiff(content, {
id: 'player_1',
width: 320,
height: 120,
container: $('player_wrapper'),
callBacks: {
playerReadyCallback: function()
{
alert
('player_ready');
}
}
});
The callback is sent by the player:
ExternalInterface.call("playerReadyCallback");
I can get the callback outside the domready.
How can I get it from inside swiff?
Is it possible?
Thanks for your help!
On Jan 27, 1:39 am, gabriel munteanu <jajali...@gmail.com> wrote:
> not from within theswiffobject but from the actionscript, from
> within flash object itself.
> more precisely from this actionscript statement:
> ExternalInterface.call("onLoad");
>
>
>
>
>
> On Tue, Jan 26, 2010 at 11:27 PM, reddrumhead <reddrumh...@gmail.com> wrote:
> > Hmmm, okay.
>
> > So if I declare the onLoad function like so:
>
> > var onLoad = function(){}
>
> > And then call it within theSwiffobject, you're saying that it should
--
jgabios
http://bash.editia.info
On Jan 28, 10:22 pm, gabriel munteanu <jajali...@gmail.com> wrote:
> that's exactly what i said in my posts on this thread, flash can see
> the global scope only.
> so when you say "I can get the callback outside the domready." that's
> what happens.
> now, if you want to call the method playerReadyCallback from inside
> thwSwiff, you should do something like: