I solved this one by running this on XAMPP server
so yes i attached the swf file like this in my html file
<object id="myMovie" type="application/x-shockwave-flash" data="test.swf" width="550" height="400">
<param name="movie" value="test.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
</object>
Then i used the anchor tag to link it to the swf object
<a id="clicky" href="#">click</a>
Then i called this using this
<script type="text/javascript">
var clik= document.getElementById("clicky");
clik.addEventListener("click",function(){
document.getElementById("myMovie").letsalertme();
})
</script>
So whenever i click the anchor tag the letsalertme()
function inside the swf file will get executed.
And this is my .fla
file which contains the actionscript
import flash.external.ExternalInterface;
function alertMe():void {
gotoAndPlay(1,"Scene1");
}
ExternalInterface.addCallback("letsalertme",alertMe);
So whenever i call the letsalertme()
from Javscript
this function will call the alertMe
function where scene1
will start playing.
//edit: I achieved this without using swfobject