Flash 8 & Javascript

      Flash&AS2 2006-2-28 12:50
flash->javascript

javascript端:

< script language="javascript" >
function getLocation() {
return window.location.toString();
}
< /script >

Flash 端:

import flash.external.ExternalInterface;

function displayPageLocation():Void {
locationDisplay.text = ExternalInterface.call("getLocation");
}

locationButton.addEventListener("click", mx.utils.Delegate.create(this, displayPageLocation));

javascript->flash

javascript端:

< script language="javascript" >

function displayFlashInfo() {
//適用ie,netscapt需用window.document.flashObject
var flashInfo = window.flashObject.getFlashInfo();
for(var key in flashInfo) {
document.flashForm.flashInfoDisplay.value += key + ": " + flashInfo[key] + "\n";
}
}
< /script >

Flash端:

import flash.external.ExternalInterface;

function getFlashInfo():Object {
return System.capabilities;
}

ExternalInterface.addCallback("getFlashInfo", this, getFlashInfo);

这样是不是更爽了?
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}