the script allows form buttons in html to refer to labeled frames in flash. Which works fine.
Now I want to add onLoad functionality to force the flash file to jump to a labeled frame on load.
This is the Javascript in the head of the html file:
Expand|Select|Wrap|Line Numbers
- <!--
- 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 GotoLabelStart()
- {
- var flashMovie=getFlashMovieObject("myFlashMovie");
- flashMovie.TGotoLabel("/", "start");
- }
- //-->
Expand|Select|Wrap|Line Numbers
- <input type="button" value="Start" name="Start" onclick="GotoLabelStart();" />
SOLUTIONS tried and not working:
1. <body onload="GotoLabelStart();">
2. Added another js:
Expand|Select|Wrap|Line Numbers
- <!--
- function addLoadEvent(func) {
- var oldonload = window.onload;
- if (typeof window.onload != 'function') {
- window.onload = func;
- } else {
- window.onload = function() {
- oldonload();
- func();
- }
- }
- }
- addLoadEvent(GotoLabelStart);
- addLoadEvent(function GotoLabelStart()
- {
- var flashMovie=getFlashMovieObject("myFlashMovie");
- flashMovie.TGotoLabel("/", "start");
- }
- );
- //-->
Expand|Select|Wrap|Line Numbers
- <!--
- window.onload=function GotoLabelStart()
- {
- var flashMovie=getFlashMovieObject("myFlashMovie");
- flashMovie.TGotoLabel("/", "start");
- }
- //-->
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- function load()
- {
- var flashMovie=getFlashMovieObject("myFlashMovie");
- flashMovie.TGotoLabel("/", "terug");
- }
- </script>
- </head>
- <body onload="load()">
Expand|Select|Wrap|Line Numbers
- <script type="text/JavaScript">
- <!--
- function GotoLabelStart() {
- var flashMovie=getFlashMovieObject("myFlashMovie");
- flashMovie.TGotoLabel("/", "start");
- }
- //-->
- </script>
- </head>
- <body onload="GotoLabelStart();">
Expand|Select|Wrap|Line Numbers
- <script type="text/JavaScript">
- <!--
- window.onload=function(){
- function GotoLabelStart() {
- var flashMovie=getFlashMovieObject("myFlashMovie");
- flashMovie.TGotoStart("/", "start");
- }
- }
- //-->
- </script>