'flashvideoplayer' is null or not an object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phayman
    New Member
    • Nov 2007
    • 6

    'flashvideoplayer' is null or not an object

    I have this page that works great in every browser I've tried except IE. It uses javascript to pass variables to a .swf and whenever I look at it in IE it give me this error:

    'flashvideoplay er' is null or not an object.


    This is the page that I'm working on:


    The function that is giving me problems is this:

    [CODE=javascript]function initialize() {
    flashvideoplaye r = window.videopla yer;
    }
    [/CODE][HTML]<body onLoad="initial ize();" >[/HTML]


    .... which refers to my .swf file here:

    [HTML]<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=9,0,0,0" width="450" height="338" name="videoplay er" />
    <param name="allowScri ptAccess" value="always" >
    <param name="movie" value="video.sw f" />
    <embed src="video.swf" quality="high" bgcolor="#fffff f" width="450" height="338" name="videoplay er" allowScriptAcce ss="always" type="applicati on/x-shockwave-flash" pluginspage="ht tp://www.macromedia. com/go/getflashplayer" id="videoplayer " >
    </object>
    [/HTML]
    Unfortunately I only know enough javascript to be dangerous so
    any help or suggestions would be greatly appreciated.
    Last edited by acoder; Nov 9 '07, 08:26 AM. Reason: Added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You have an error in Firefox too:

    flashvideoplaye r.playVideo is not a function.

    Comment

    • phayman
      New Member
      • Nov 2007
      • 6

      #3
      Originally posted by acoder
      You have an error in Firefox too:

      flashvideoplaye r.playVideo is not a function.
      Thanks.

      I fixed the cause of the error but found that it did not effect the problem that I'm having with IE.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Since you've given the OBJECT tag an id of "videoplaye r", use document.getEle mentById("video player") to refer to it.

        Comment

        • phayman
          New Member
          • Nov 2007
          • 6

          #5
          Originally posted by acoder
          Since you've given the OBJECT tag an id of "videoplaye r", use document.getEle mentById("video player") to refer to it.
          Thank you very much for taking time to reply to my post.

          I changed how the variable "flashvideoplay er" was defined from:
          Code:
          flashvideoplayer = window.videoplayer;
          to:
          Code:
          flashvideoplayer = document.getElementById('videoplayer');
          My original error went away but was replaced with this new one:

          'videoplayer' is undefined

          Any ideas??

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Which line does this occur on?

            It should be a line using "videoplaye r" - perhaps that should be changed to flashvideoplaye r?

            Comment

            • phayman
              New Member
              • Nov 2007
              • 6

              #7
              Originally posted by acoder
              Which line does this occur on?

              It should be a line using "videoplaye r" - perhaps that should be changed to flashvideoplaye r?

              IE is telling me that the error is on Line: 1 Char:1

              I changed all instances of "videoplaye r" to "flashvideoplay er" and saved it to:

              This variation also works fine on other browsers but gives me the following error in IE:
              Line: 48
              Char: 3
              Error: Object expected
              This variation does not seem like a step in the right direction. Line 48 is within the following function that is only called from a link to "start video":
              42. function initFlashPlayVi deo() {
              43.
              44. var video = "";
              45. updateStatus("_ ___" + video + "____");
              46. flashvideoplaye r.playVideo(vid eo);
              47. document.pauseB utton.src = pauseButton.src ;
              48. var play_V = document.getEle mentById('PLAY' );
              48.
              50. //update page elements
              51. play_V.innerHTM L = "";
              52. }

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                You have two elements with the same "flashvideoplay er" ID: the object and embed tag. IDs must be unique. On top of that, the name of the embed tag is also flashvideoplaye r and IE is easily confused between name and ID.

                I'm not sure if this will solve it, but it may help.

                Comment

                • phayman
                  New Member
                  • Nov 2007
                  • 6

                  #9
                  Originally posted by acoder
                  You have two elements with the same "flashvideoplay er" ID: the object and embed tag. IDs must be unique. On top of that, the name of the embed tag is also flashvideoplaye r and IE is easily confused between name and ID.

                  I'm not sure if this will solve it, but it may help.
                  I think it helped, I no longer have an error when the page loads in IE.

                  Now when I make a selection from the pull down list I am getting the following error from IE:
                  Line: 33
                  Char: 1
                  Error: 'flashvideoplay er' is null or not an object

                  Line 33 is this line within in the following function:
                  flashvideoplaye r.playVideo("" + video);

                  [CODE=javascript]/* When the user selects a movie from the pull down list on the the form, update the videoStatus text area, and call the playVideo() function within the SWF file, passing it the URL of the FLV file. */
                  function callFlashPlayVi deo() {
                  var comboBox = document.forms['videoForm'].videos;
                  var video = comboBox.option s[comboBox.select edIndex].value;
                  updateStatus("_ ___" + video + "____");
                  flashvideoplaye r.playVideo("" + video);
                  var play_V = document.getEle mentById('PLAY' );

                  //update page elements
                  get_movie_info( 'getInfo.php?fl v='+ video +'&return=all', 'film_title','v ideo_info-title','video_i nfo-desc','<img src="gifs/loading_animati on.gif" width="30" alt="loading.." border="0">');
                  play_V.innerHTM L = "";

                  }[/CODE]

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    I'm not sure, but this link might help in your struggles with the embed tag, i.e. try using object only.

                    Comment

                    • phayman
                      New Member
                      • Nov 2007
                      • 6

                      #11
                      Originally posted by acoder
                      I'm not sure, but this link might help in your struggles with the embed tag, i.e. try using object only.
                      Yes it was helpful. I simplified some of the Object tags and it changed my IE error message once again.

                      Now when I make a selection from the pull down list I am getting the following error from IE:

                      Line: 33
                      Char: 1
                      Error: Object doesn't support this property or method.

                      Line 33 is this line within in the following function:
                      flashvideoplaye r.playVideo("" + video);

                      [CODE=javascript]/* When the user selects a movie from the pull down list on the the form, update the videoStatus text area, and call the playVideo() function within the SWF file, passing it the URL of the FLV file. */
                      function callFlashPlayVi deo() {
                      var comboBox = document.forms['videoForm'].videos;
                      var video = comboBox.option s[comboBox.select edIndex].value;
                      updateStatus("_ ___" + video + "____");
                      flashvideoplaye r.playVideo("" + video);
                      var play_V = document.getEle mentById('PLAY' );

                      //update page elements
                      get_movie_info( 'getInfo.php?fl v='+ video +'&return=all', 'film_title','v ideo_info-title','video_i nfo-desc','<img src="gifs/loading_animati on.gif" width="30" alt="loading.." border="0">');
                      play_V.innerHTM L = "";

                      }[/CODE]

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        So at least it's now recognising "flashvideoplay er" as an object.

                        What does your object tag look like now? There's no other elements with a name or id of "flashvideoplay er" now, is there?

                        Comment

                        • nprajapati
                          New Member
                          • Nov 2007
                          • 2

                          #13
                          Hi,

                          i have also same problem like you.... can you give me what was your solution to avoid this problem.....

                          i have used same like you:

                          var isIE = navigator.appNa me.indexOf("Mic rosoft") != -1;
                          flashvideoplaye r = (isIE) ? window['videoPlayer'] : document['videoPlayer'];

                          but still it is giving error in IE....

                          videoPlayer is undefined....

                          and let me know is there any possibility of js error in .swf file..... for creating object

                          plase give me replay as soon as possible.....

                          Thanks,
                          Nilesh

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            Hi

                            Maybe this might help you.

                            Comment

                            • nprajapati
                              New Member
                              • Nov 2007
                              • 2

                              #15
                              Hi,

                              my flash embeded is like following:

                              [HTML]<object classid="clsid: d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macr omedia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=8,0,0,0" width="740" height="420" id="FileUpload " align="middle">
                              <param name="allowScri ptAccess" value="always" />
                              <param name="movie" value="FileUplo ad.swf?cookies= <?= $cookieString ?>&contentId=<? = $contentId ?>" />
                              <param name="quality" value="high" />
                              <param name="bgcolor" value="#e1e2ff" />
                              <embed src="FileUpload .swf?cookies=<? = $cookieString ?>&contentId=<? = $contentId ?>" quality="high" bgcolor="#e1e2f f" width="740" height="420" name="FileUploa d" align="middle" allowScriptAcce ss="always" type="applicati on/x-shockwave-flash" pluginspage="ht tp://www.macromedia. com/go/getflashplayer" />
                              </object>
                              [/HTML]
                              in that object tag have id="FileUpload " while embed tag have name="FileUploa d" ...

                              is it causing any problem in IE?

                              when my page is loading at that time only it is giving me error in IE
                              "FileUpload " is undefined

                              i donot have much idea on flash.. so, can you tell me is it possible any javascript programming in .swf file? and may be it is casing the problem to creating object of "FileUpload "

                              is any wrong parameter is passed or we need more parameters in object or embe tag in IE?

                              Thanks,
                              Last edited by acoder; Nov 21 '07, 06:48 PM. Reason: Added code tags

                              Comment

                              Working...