PDA

View Full Version : Run Actionscript function from Javascript


pandy
10-13-2004, 03:21 PM
Hi

I need to be able to run an actionscript function in a flash movie from a html page in an iframe. Firstly is it possible, or should I go back to the drawing board, secondly - if it is possible how do i do it?

Here is the script I have so far...

On the page in the iframe..
<script language="javascript" type="text/javascript">
<!--
var movie = window.top.movie;

movie.SetVariable('/bar:target', '4');
movie.director();

//-->
</script>

The function to run in the flash movie...
function director() {
if (/bar:target</bar:current) {
/bar:direction = "b";
} else if (/bar:target>/bar:current) {
/bar:direction = "f";
} else if (/bar:target == /bar:current) {
/bar:direction = "null";
}
goto = (String(/bar:direction+/bar:current));
trace(goto);
bar.gotoAndPlay(goto);
}

I hope this is enough. You can see what I am trying to achieve at http://www.ianetservices.com/beacon/our_team

It all works fine, but if you click "back" the iframe changes but the slider does not scroll back to the correct person - I need to to change when the iframe page loads.