Calling a function from javascript to actionscript 3

Calling a function from Javascript to Flash / ActionScript 3.

//Javascript----------
function flashCom(flashIDName, stringVar){
   var video = (isIE()) ? window[flashIDName] : document[flashIDName];
   video.updateFlash(JSONString);
}
flashCom("flash_object_id_name", "string_to_be_passed");
//AS3----------------
package com{
   import flash.external.ExternalInterface;
   public class init extends MovieClip {
      public function init():void {
         ExternalInterface.addCallback("updateFlash", updateProject);
      }
      public function updateProject(msg:String){
         //code here
      }
    }
}
This entry was posted in ActionScript 3.0, Javascript and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>