?
Solved

Flash not playing in IE, works in Netscape

Posted on 2005-04-05
7
Medium Priority
?
193 Views
Last Modified: 2010-04-03
This is very tricky... I've never experience this before but nevertheless here's the problem.

I'm trying to set some variables in flash with SetVariable. Netscape had it working perfectly but not IE. I've checked both versions of plugin, they are the same (7.0.19.0). If I activate the debugging option, IE will have it working, else it just doesn't seems to work. But activating the debugging option should never be considered as it will pop up a dialog. So I've come to a conclusion that IE is not playing (though only 1 frame) the movie. Next thing I tried is to try to preload the movie before calling for the function. It didn't work. Then I created 1 more frame and tried to call the function in the 2nd frame. It worked, but it will shows the menu closed then open (which isn't the case for the initial working movie in Netscape). So any idea what went wrong? Btw, uninstalling and reinstalling the plugin for IE is not an option too because I've tried it on 4 different PC and they all had the same problem.

Below is the codes:

//Flash - only has 1 frame
var btns = new Array();
btns.push({id:"summaryBtn", cookie:"summary", sub:"", open_state:false});
btns.push({id:"forumBtn", cookie:"forum", sub:"forum_sub", open_state:false});
btns.push({id:"profileBtn", cookie:"myprofile", sub:"profile_sub", open_state:false});
btns.push({id:"accountBtn", cookie:"account", sub:"", open_state:false});
btns.push({id:"cash_chargeBtn", cookie:"cash_charge", sub:"", open_state:false});
btns.push({id:"credit_redemBtn", cookie:"credit_redem", sub:"", open_state:false});
btns.push({id:"trans_histBtn", cookie:"trans_hist", sub:"", open_state:false});
function checkAllBtns(){
      for(i=0;i<btns.length;i++){
            if(eval(btns[i].cookie)!=undefined){
                  if(eval(btns[i].cookie)=="true"){
                  btns[i].open_state = true;
                  btnStart = i+1;
                  pos = eval(btns[i].sub)._height-5.4;
                  for(j=btnStart;j<btns.length;j++){
                        btn = eval(btns[j].id);
                        sub = eval(btns[j].sub);
                        btn._y+=pos;
                        sub._y+=pos;
                  }
                  }
            }
      }
}
checkAllBtns();
stop(); //I've tried removing the stop, it doesn't help.


//HTML
<html>
.
.
<script language="javascript">
function checkNavi(){
      var movie = document.all ? navi : window.document.navi;
      btns = new Array("forum", "profile");
      for(i=0;i<btns.length;i++){
            if(getCookie(btns[i])!=null){
                  movie.SetVariable(btns[i], getCookie(btns[i]));
            }
      }
}
</script>
<body onLoad="checkNavi();">
.
.
.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="navi" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="148" height="328" align="top">
          <param name="movie" value="flash/navi.swf">
          <param name="quality" value="high">
          <param name="play" VALUE="true"> <!--as you've noticed, I've force it to play, but it still doesn't work-->
          <embed name="navi" src="flash/navi.swf" swLiveConnect="true" width="148" height="328" align="top" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
        </object>
.
.
.
</html>
0
Comment
Question by:elhy
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:negatyve
ID: 13713752
Try this, before anything else:

var movie = navigator.appName.indexOf("Microsoft") != -1 ? window.navi : window.document.navi;
0
 
LVL 5

Author Comment

by:elhy
ID: 13714220
actually this is equal to var movie = document.all ? navi : window.document.navi;

i mean they do the same thing, check if browser is IE. Anyway I did as you suggested, but it is still the same.
0
 
LVL 27

Expert Comment

by:negatyve
ID: 13714404
That's ok (was just one more test with javascript). Then, if you need to set variables before the checkAllBtns function get called, you should do something like this:

<html>
      <head>
            <title></title>
            <script language="javascript">
            function checkNavi()
            {
                  var movie = document.all ? navi : window.document.navi;
                  btns = new Array("forum", "profile");
                  for(var i = 0; i < btns.length; i++){
                        if(getCookie(btns[i])!=null){
                              movie.SetVariable(btns[i], getCookie(btns[i]));
                        }
                  }
                  movie.TCallLabel("_root", "checkAllBtns");
            }
            </script>
      </head>
      <body onLoad="checkNavi();">
            <object
                  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                  id="navi"
                  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"
                  width="148" height="328" align="top">
                  <param name="movie" value="flash/navi.swf">
                  <param name="quality" value="high">
                  <embed
                        name="navi"
                        src="flash/navi.swf"
                        swLiveConnect="true"
                        width="148"
                        height="328"
                        align="top"
                        quality="high"
                        pluginspage="http://www.macromedia.com/go/getflashplayer"
                        type="application/x-shockwave-flash">
                  </embed>
            </object>
      </body>
</html>

then, inside flash:

// first frame, buttons with this code:

stop();

// second frame, empty, labelled "checkAllBtns", with this code
var btns = new Array();
btns.push({id:"summaryBtn", cookie:"summary", sub:"", open_state:false});
btns.push({id:"forumBtn", cookie:"forum", sub:"forum_sub", open_state:false});
btns.push({id:"profileBtn", cookie:"myprofile", sub:"profile_sub", open_state:false});
btns.push({id:"accountBtn", cookie:"account", sub:"", open_state:false});
btns.push({id:"cash_chargeBtn", cookie:"cash_charge", sub:"", open_state:false});
btns.push({id:"credit_redemBtn", cookie:"credit_redem", sub:"", open_state:false});
btns.push({id:"trans_histBtn", cookie:"trans_hist", sub:"", open_state:false});
for(var i = 0; i < btns.length; i++){
      if(eval(btns[i].cookie)!=undefined){
            if(eval(btns[i].cookie)=="true"){
                  btns[i].open_state = true;
                  btnStart = i+1;
                  pos = eval(btns[i].sub)._height-5.4;
                  for(j=btnStart;j<btns.length;j++){
                        btn = eval(btns[j].id);
                        sub = eval(btns[j].sub);
                        btn._y+=pos;
                        sub._y+=pos;
                     }
            }
      }
}
0
 
LVL 5

Author Comment

by:elhy
ID: 13714883
somehow movie.TCallLabel("_root", "checkAllBtns"); works for IE but not netscape. I tried combining my method and yours but netscape still doesn't work. Seems that as long as movie.TCallLabel is use, netscape refuse to work. The solution should work for both IE and Netscape. Another thing that I've notice is that if I put checkNavi() into a .js and include that js file, the same piece of code that worked just now won't work now. Preferably checkNavi function should be in the .js file so that it is easier to be maintained.
0
 
LVL 5

Accepted Solution

by:
elhy earned 0 total points
ID: 13717043
Hmm...somehow, IE seems to load flash contents before anything else. anyway here's the solution i used:

//Flash
//additional code added to the original one that I posted.
id_check = setInterval(function(){
if(done=="true"){
      checkAllBtns();
      clearInterval(id_check);
}
}, 1);

//HTML
<script language="javascript">
function checkNavi(){
     var movie = document.all ? navi : window.document.navi;
     btns = new Array("forum", "profile");
     for(i=0;i<btns.length;i++){
          if(getCookie(btns[i])!=null){
               movie.SetVariable(btns[i], getCookie(btns[i]));
          }
     }
movie.SetVariable("done", "true");
}
</script>
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month14 days, 2 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question