<" /> <" /> <"/>

AS3 method call to javascript + NO SERVER COMMUNICATION

95 Views Asked by At

Code below is my jscript, I believe I don't have any error on integrating the code.

<script type="text/javascript" src="./js/swfobject.js"></script>

<script type="text/javascript">
var flashvars = {};
var params = {};
params.allowscriptaccess = "always";
params.allownetworking = "all";
var attributes = {};
attributes.id = "map-moa";
swfobject.embedSWF("./video/map.swf?v=1.3", "map-moa", "1560", "980", "9.0.0", false, flashvars, params, attributes);
</script>

$(".goto-path").on("click",function(){
    // alert("goto booth #"+$(this).data('booth_id'));
    sendTextToAS3(); // call Flash (AS3) Method
});

function sendTextToAS3(){
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    var flash = (isIE) ? window["map-moa"] : document["map-moa"];
    console.log(flash)
    try{
    flash.sampleMethod();
    }catch(e){
        console.log(e)
    }
}

I am having an error as undefined method yet the function are properly declared in my as3 class.

public function Main():void { ExternalInterface.addCallback("sampleMethod", callbackID); }
public function callbackID():void { trace(this, "TEST"); }
0

There are 0 best solutions below