<!--
var movieName = "testcommand";
function thisMovie(movieName) {
// IE and Netscape refer to the movie object differently.
// This function returns the appropriate syntax depending on the browser.
if (navigator.appName.indexOf ("Microsoft") !=-1) {
return window[movieName]
} else {
return document[movieName]
}
}
// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
if (typeof(theMovie) != "undefined") {
return theMovie.PercentLoaded() == 100;
} else {
return false;
}
}
|
|
stop();
text = "Label Copy";
// Setup sound object
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);
// Array of songs
var sa:Array = new Array();
// Currently playing song
var cps:Number = 17;
// Load the songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes:Array = this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++)
{
sa.push(new Song(nodes[i].attributes.url, nodes[i].attributes.artist, nodes[i].attributes.track));
}
playSong();
}
xml.load("songs.xml");
function playSong():Void
{
s = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);
mute.gotoAndStop("on");
if(cps == sa.length - 1)
{
cps = 0;
s.loadSound(sa[cps].earl, true);
}
else
{
s.loadSound(sa[++cps].earl, true);
}
trackInfo.text = sa[cps].track;
playPause.gotoAndStop("pause");
textPos = 0;
}
|
These are my main two functions:
goTheFrame
function go(theFrame) {
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie(movieName).GotoFrame(theFrame);
}
}
FlashVar
function PassFlash(){
thisMovie(movieName).SetVariable("text", "TC2_52869");
}
}
|
Where the Flash Movie is inside the HTML document
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab','name','testcommand','width','363','height','24','id','testcommand','src','javascript-to-lash2','play','false','loop','false','quality','high','scale','SHOWALL','swliveconnect','true','pluginspage','http://www.macromedia.com/go/flashplayer/','movie','javascript-to-flash2' ); //end AC code
</script>
<noscript>
<OBJECT
CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" name="testcommand"
WIDTH="363"
HEIGHT="24"
ID=testcommand>
<PARAM NAME="MOVIE" VALUE="javascript-to-flash2.swf">
<PARAM NAME="PLAY" VALUE="false">
<PARAM NAME="LOOP" VALUE="false">
<PARAM NAME="QUALITY" VALUE="high">
<PARAM NAME="SCALE" VALUE="SHOWALL">
<EMBED
NAME="testcommand"
SRC="javascript-to-flash2.swf"
WIDTH="363"
HEIGHT="24"
PLAY="false"
LOOP="false"
QUALITY="high"
SCALE="SHOWALL"
swLiveConnect="true"
PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/"> </EMBED>
</OBJECT>
</noscript> |
|