logo
  • About us
  • What we do
  • Our product
  • Recent work
  • Contact

News

  • Summer holiday internships
    April
  • Junior developer position
    April
  • Ecomonkey lives
    December
  • Calling Javascript from Actionscript
    December
  • Fun with PHP permissions
    December
Site Foci
  • Flash XML slideshow
    May
  • Database training
    May

Calling Javascript from Actionscript

I've been grappling with Actionscript (Flash) intregration recently, largely for synchronising the dynamic elements here. In AS2, here's how it's done.

To call a function

Actionscript code

import flash.external.ExternalInterface;

ExternalInterface.addCallback( "methodName", this, method );
function method() {
   trace("called from javascript");
}

Javascript code

function callAS() {
   swf.methodName();
}

To push a variable

Javascript code

function doPassVar(args){
	var sendText = args.value;
	window.document.myFlash.SetVariable("myVar", sendText);
}
  • Tech report
 

 

 

Copyright 2007 Lightenna Limited

  • About us
  • What we do
  • Our product
  • Recent work
  • Contact