Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Aug 2011
    Posts
    192
    Thanks
    112
    Thanked 0 Times in 0 Posts

    How to prevent movie from auto starting?

    I have a swf on my web page that automatically plays when you load the page. I have tried various ways to try and prevent this, so that the user would have to hit the "play" button to view the movie.

    I would appreciate it if someone coud please show me how to to this?
    I appreciate it. Buffmin

    You can see my webpage at http://test.cnjwebsolutions.com

    And here is my code: (thank you again)

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="AC_RunActiveContent.js" type="text/javascript"></script>
    </head>
    	
    <body>
        <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','540','height','400','src','oxylifeline','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','oxylifeline' ); //end AC code
    </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="540" height="400">
          <param name="movie" value="oxylifeline.swf" />
          <param name="quality" value="high" />
          <embed src="oxylifeline.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="540" height="400"></embed>
        </object></noscript>
    
    </body>
    </html>

  • #2
    New Coder
    Join Date
    Jan 2012
    Location
    Columbus, Ohio, U.S.A
    Posts
    41
    Thanks
    0
    Thanked 8 Times in 8 Posts
    hi,

    to do it from javascript, you should have an id assigned to the object element.

    and then do something like this:

    PHP Code:
    document.getElementByid('myFlashMovie').stop(); 
    //there may be more work depending on which browser(s) you're aiming for... 
    of course, if you can open up the swf in flash you can just put the stop(); function in there on the first frame.

  • Users who have thanked adaminaudio for this post:

    Buffmin (02-29-2012)

  • #3
    Regular Coder
    Join Date
    Aug 2011
    Posts
    192
    Thanks
    112
    Thanked 0 Times in 0 Posts
    Thank you very much.

    I do not have the source code, so it looks like I will have to do it using javascript.

    I am new to javascript, and not quite sure how to do this, so I will can read up on how to use the getelementById. I appreciate your direction. Sincerely, Buffmin

  • #4
    New Coder
    Join Date
    Jan 2012
    Location
    Columbus, Ohio, U.S.A
    Posts
    41
    Thanks
    0
    Thanked 8 Times in 8 Posts
    here is a better multi-browser solutions..

    1. make sure your object tag has an ID attribute

    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" id="myMovie" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="540" height="400">
    <param name="movie" value="oxylifeline.swf" />
    <param name="quality" value="high" />
    <embed src="oxylifeline.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="540" height="400"></embed>
    </object>

    2. write a function to see if microsoft/mac

    PHP Code:
    function getFlashMovie(movieName){

             var 
    isIE navigator.appName.indexOf("Microsoft") != -1;
             return (
    isIE) ? window[movieName] : document[movieName];
       } 
    3. write functions that will play and/or stop your movie

    PHP Code:
     function playMovie(){

                 
    getFlashMovie("myMovie").play();
       }

         function 
    stopMovie(){
                    
                 
    getFlashMovie("myMovie).stop();

       }


    That should do what you want let me know if you have any questions on any of this. You might want to call your stopMovie() function after the page has loaded. (ie: something like body.onLoad() )

    -Adam

  • Users who have thanked adaminaudio for this post:

    Buffmin (02-29-2012)

  • #5
    Regular Coder
    Join Date
    Aug 2011
    Posts
    192
    Thanks
    112
    Thanked 0 Times in 0 Posts
    Adaminaudio,
    Thank you so much!
    I am familliar enough with javascript so i should be able to understand your instructions. Thank you so much for taking the time. It will be my "evening on the couch" project! If I have any questions, I will let you know, but again, thank you for taking the time to help me out. Buffmin


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •