Do you want to buy me a beer or coffee?

Friday, December 11, 2009

Interaction Between Flash and Javascript

<!--

function getFlashMovieObject(movieName)

{

if (window.document[movieName])

{

return window.document[movieName];

}

if (navigator.appName.indexOf("Microsoft Internet")==-1)

{

if (document.embeds && document.embeds[movieName])

return document.embeds[movieName];

}

else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)

{

return document.getElementById(movieName);

}

}

function StopFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.StopPlay();

}

function PlayFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Play();

//embed.nativeProperty.anotherNativeMethod();

}

function RewindFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Rewind();

}

function NextFrameFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

// 4 is the index of the property for _currentFrame

var currentFrame=flashMovie.TGetProperty("/", 4);

var nextFrame=parseInt(currentFrame);

if (nextFrame>=10)

nextFrame=0;

flashMovie.GotoFrame(nextFrame);

}

function ZoominFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Zoom(90);

}

function ZoomoutFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.Zoom(110);

}

function SendDataToFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

flashMovie.SetVariable("/:message", document.controller.Data.value);

}

function ReceiveDataFromFlashMovie()

{

var flashMovie=getFlashMovieObject("myFlashMovie");

var message=flashMovie.GetVariable("/:message");

document.controller.Data.value=message;

}

//-->

0 comments:

Post a Comment

<--nothing-->