PDA

View Full Version : Changing functions in script from gotoAndStop to findCuePoint


aztecgreen
11-25-2008, 01:45 PM
I am attempting to access cue points in a FLV via html links/javascript using the external api.

The following html and javascript code sends an external api to the flash movie to go to a frame number:

<script>
function goToFrame(num) {
getMovieName("ExternalAPI").findCuePoint(num);
}
function getMovieName(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName]
}
else {
return document[movieName]
}
}
</script>
</head>
<body bgcolor="#ffffff">

<div id="menu">

<ul>
<li><a href="#" onClick="goToFrame(1)">one</a></li>
<li><a href="#" onClick="goToFrame(2)">two</a></li>
<li><a href="#" onClick="goToFrame(3)">three</a></li>
<li><a href="#" onClick="goToFrame(4)">four</a></li>
<li><a href="#" onClick="goToFrame(5)">five</a></li>

</ul>
</div>

<div id="flash">
<script type="text/javascript">
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '800',
'height', '300',
'src', 'ExternalAPI',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'left',
'play', 'true',
'loop', 'true',
'scale', 'noscale',
'wmode', 'transparent',
'devicefont', 'false',
'id', 'ExternalAPI',
'bgcolor', '#EEEEEE',
'name', 'ExternalAPI',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','always',
'movie', 'ExternalAPI',
'salign', 'lt'
); //end AC code
}
</script>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="550" height="400">
<param name="movie" value="test.swf" />
<param name="quality" value="high" />
<embed src="test.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed>
</object>
</div>
<noscript><p>Please install Flash and/or enable JavaScript to view this example.</p></noscript>



This is the actionscript code in the flash movie:
import flash.external.*;
#include "mc_tween2.as"
stop();

// The name of the Flash trigger variable to be called in JavaScript
var jsTrigger:String = "goTo";

// Callback function executed by the name of variable
ExternalInterface.addCallback(jsTrigger, null, goTo);
function goTo(frame:Number):Void {
image.alphaTo(0, .25, "easeOutQuad");
image.onTweenComplete = function() {
gotoAndStop(frame);
image._alpha = 0;
image.alphaTo(100, .5, "easeOutQuad");
}
}


Question: How do I change the scripts from the flash gotoAndStop function to the findCuePoint (with a name variable)?