Pause an animation on page blur, resume on focus (From Flash Kit)

CODE FOR FIRST FRAME IN FLASH MOVIE

import flash.external.*; // this is for calling JS function on the Html from Flash without getURL.
content_status = "off";

// this is the function that toggles the widget on and off
function toggle_widget(content_status) {

if(content_status == "on"){
ESPWidget.instance.resume();
}else if(content_status == "off"){
ESPWidget.instance.pause();
}else{
// no other values accepted
}
}

// Register our toggle function for Browser to use
var ei1 = flash.external.ExternalInterface.addCallback("widget_focus", null, toggle_widget);

// this function will cal a JS function on Html page with 'str' argument
function sendText(str) {
var greeting:String;
greeting = String(ExternalInterface.call("getFromFlash", str));
}

CODE FOR THE HEAD OF THE HTML PAGE
[CODE]
get the code from flash kit
[/CODE]

No comments: