Connecting Tech Pros Worldwide Forums | Help | Site Map

javascript help needed! javasript with flash.

Newbie
 
Join Date: Aug 2008
Posts: 3
#1: Aug 31 '08
Hello there, im needed to develop a gallery for this website.
im using hotspots to go to my frames in my flash
Each hotspot goes to each frame.
The flash is loaded properly.
When i right click and click play it goes to the next frame.
But the Hotspots just dont work with IE.
For your information: This works with other browsers like firefox, safari and Opera.

MY HEADER
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[/HTML]
THE SCRIPT
Expand|Select|Wrap|Line Numbers
  1. <script type="text/JavaScript">
  2. function stopError() {
  3.   return true;
  4. }
  5.  
  6. window.onerror = stopError;
  7.  
  8. <!--  
  9. var movieName = "stagelinkGallery";
  10.  
  11. function thisMovie(movieName) {
  12.   // IE and Netscape refer to the movie object differently.
  13.   // This function returns the appropriate syntax depending on the browser.
  14.   if (navigator.appName.indexOf ("Microsoft") !=-1) {
  15.     return window[movieName]
  16.   }    else {
  17.     return document[movieName]
  18.   }
  19. }
  20.  
  21. // Checks if movie is completely loaded.
  22. // Returns true if yes, false if no.
  23. function movieIsLoaded (theMovie) {
  24.   if (typeof(theMovie) != "undefined") {
  25.     return theMovie.PercentLoaded() == 100;
  26.   } else {
  27.     return false;
  28.   }
  29. }
  30.  
  31.  
  32. function playmovie() {
  33.   if (movieIsLoaded(thisMovie(movieName))) {
  34.     thisMovie(movieName).Play();
  35.   }
  36. }
  37.  
  38. function stopmovie() {
  39.   if (movieIsLoaded(thisMovie(movieName))) {
  40.     thisMovie(movieName).StopPlay();
  41.   }
  42. }
  43.  
  44.  
  45. function go1(theFrame) {
  46.   if (movieIsLoaded(thisMovie(movieName))) {
  47.     thisMovie(movieName).GotoFrame(theFrame);
  48.   }
  49. }
  50.  
  51. function golabel() {
  52.   if (movieIsLoaded(thisMovie(movieName))) {
  53.     thisMovie(movieName).TGotoLabel("_level0/","redframe");
  54.   }
  55. }
  56.  
  57.  
  58. function MM_swapImgRestore() { //v3.0
  59.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  60. }
  61.  
  62. function MM_preloadImages() { //v3.0
  63.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  64.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  65.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  66. }
  67.  
  68. function MM_findObj(n, d) { //v4.01
  69.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  70.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  71.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  72.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  73.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  74. }
  75.  
  76. function MM_swapImage() { //v3.0
  77.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  78.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  79. }
  80. //-->
  81. </script>
  82.  
THE HOTSPOTS
[HTML]<map name="Map">
<area shape="rect" coords="10,195,29,209" href="javascript:go1(1)">
<area shape="rect" coords="11,214,46,227" href="javascript:go1(2)">
<area shape="rect" coords="9,249,67,265" href="javascript:go1(4)">
<area shape="rect" coords="11,381,85,394" href="javascript:go1(11)">
<area shape="rect" coords="128,215,160,227" href="javascript:go1(14)">
<area shape="rect" coords="130,233,148,244" href="javascript:go1(15)">
<area shape="rect" coords="129,252,210,263" href="javascript:go1(16)">
<area shape="rect" coords="129,289,218,301" href="javascript:go1(18)">
<area shape="rect" coords="129,363,179,376" href="javascript:go1(22)">
<area shape="rect" coords="127,381,189,394" href="javascript:go1(23)">
<area shape="rect" coords="128,400,204,411" href="javascript:go1(24)">
<area shape="rect" coords="128,420,157,430" href="javascript:go1(25)">
<area shape="rect" coords="245,196,336,208" href="javascript:go1(26)">
<area shape="rect" coords="246,215,303,227" href="javascript:go1(27)">
<area shape="rect" coords="247,252,319,263" href="javascript:go1(29)">
<area shape="rect" coords="246,289,342,300" href="javascript:go1(31)">
<area shape="rect" coords="246,308,288,319" href="javascript:go1(32)">
<area shape="rect" coords="246,383,264,392" href="javascript:go1(36)">
<area shape="rect" coords="247,401,273,411" href="javascript:go1(37)">
<area shape="rect" coords="10,324,30,338" href="javascript:go1(8)">
</map>[/HTML]

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Sep 1 '08

re: javascript help needed! javasript with flash.


Where and how is GotoFrame defined?
Newbie
 
Join Date: Aug 2008
Posts: 3
#3: Sep 1 '08

re: javascript help needed! javasript with flash.


Sorry i am not too sure what do you mean by how it is defined?

function go1(theFrame) {
if (movieIsLoaded(thisMovie(movieName))) {
thisMovie(movieName).GotoFrame(theFrame);
}
}

GotoFrame is code in javascript i think, i do not need to define it.
If i am not wrong.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Sep 2 '08

re: javascript help needed! javasript with flash.


A quick search shows that GotoFrame is a Flash method. What I would suggest is you use SWFObject which will deal with all the differences.
Newbie
 
Join Date: Aug 2008
Posts: 3
#5: Sep 2 '08

re: javascript help needed! javasript with flash.


okok thanks.. i'll try it out.
Reply