...

View Full Version : How to prevent movie from auto starting?



Buffmin
02-29-2012, 04:39 PM
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)



<!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','plu ginspage','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>

adaminaudio
02-29-2012, 06:31 PM
hi,

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

and then do something like this:


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.

Buffmin
02-29-2012, 07:04 PM
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

adaminaudio
02-29-2012, 07:33 PM
here is a better multi-browser solutions..

1. make sure your object tag has an ID attribute

<object classid="clsid:D27CDB6E-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


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


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

Buffmin
02-29-2012, 09:34 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum