...

View Full Version : Resolved Using JS to call AS3 function



Frayster
11-19-2010, 12:27 AM
My problem is that I am trying to call an function within an SWF. Now, I already know how to setup my SWF and that isn't the problem. The problem is that when I try to call the function using Javascript, I am told that the function doesn't exist. I'll show you the code right here.


function AudioPlayerEmbed( e )
{
if ( e.success )
{
e.ref.LoadAudio( 'http://therevolve.com/upload/userfiles/Music/Alec_Smith1.mp3' );
}
}

swfobject.embedSWF("player/MP3Player.swf", "flash", "300", "90", "9.0.0", "player/expressInstall.swf", null, null, null, AudioPlayerEmbed );

HOWEVER, when I put some alert before the call, it happens to work. What is going on?


function AudioPlayerEmbed( e )
{
alert("A");
if ( e.success )
{
e.ref.LoadAudio( 'http://therevolve.com/upload/userfiles/Music/Alec_Smith1.mp3' );
}
}

swfobject.embedSWF("player/MP3Player.swf", "flash", "300", "90", "9.0.0", "player/expressInstall.swf", null, null, null, AudioPlayerEmbed );

Here is a live example. (http://therevolve.com/mp3player/)

Any help would be appreciated. If you need more information, I can provide it.

Frayster
11-19-2010, 01:05 AM
Actually, I found a much better method and it works now.

Philip M
11-19-2010, 07:45 AM
Actually, I found a much better method and it works now.

So, what was this much better method?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum