...

View Full Version : Autoplay of a flash movie



twomt
01-02-2008, 11:44 PM
Hello all,

I have embedded an object (flash video) and it automatically starts when the page is loaded. Does anyone know of a method to not start these automatically but have a play intro link/button that allows this movie to start?

Something like the youtube play button in the movie would be nice.


<object width="180" height="180">
<param name="movie" value="http://www.domain.com/swf/movie.swf">
<embed src="http://www.domain.com/swf/movie.swf" width="180" height="180" loop="false">
</embed>
</object>

VIPStephan
01-03-2008, 02:36 AM
At first this is a Flash issue. You have put a play button in the Flash movie, hence, you have to set automatic (or manual) playback in your Flash file, not in the HTML.
There is a non-standard (i.e. invalid) autoplay attribute for the similarly non-standard (i.e. invalid) embed element which you can set to 0 (don’t play) or 1 (play automatically). However, this won’t generate a “play” button, ’cause as I said, this is a Flash thing. Also this is more meant for playback of plain audio files, not flash.
Likewise, there is a similar value for the <param> element (<param name="autoplay" value="true [/false]">). However, functionality is based on the settings of/in the Flash movie (i.e. you have to enable it there before setting it in the HTML will do anything).
If I go to YouTube and choose a video it starts playback automatically. The play button only comes after one pass.

twomt
01-03-2008, 08:34 AM
OK,

am a bit confused now...

I've tried to keep my website as much as possible to standards and what I read above makes me feel that I am now using non-standard elements to display a flash movie.

Is there a "better" or let's say more standardized way to do so?

If I understood you correctly, I need to go to my gfx team to tell them to change the flash movie in such a way that it does not automatically start.
Is that correct?

Thanks for your help.

ahallicks
01-03-2008, 09:46 AM
I take it that you are using the <embed> tag to display your Flash movie then? <embed> is depracated in HTML 4.01 and if you are using a correct doctype (preferably strict) this will not validate as HTML. You need to use something like the Flash Satay method which is described here (http://www.alistapart.com/articles/byebyeembed)

And as for the second part, yes, you need to have the movie begin with a 'play' button so that it doesn't actually start until that button is pressed

twomt
01-03-2008, 11:11 AM
OK,

with the help of that link you have given me, the object is now coded as follows:


<object type="application/x-shockwave-flash"
data="http://www.nemesiswar.net/swf/intro_8.swf" width="180" height="180" id="">
<param name="movie" value="http://www.nemesiswar.net/swf/intro_8.swf" />
<param name="play" value="false" />
<param name="loop" value="false" />
<param name="quality" value="autohigh" />
</object>


That seems to already work for me, I now need to find out what other param settings I can use for the flash files.

Would this then be according to the real (non-microsoft) standard?

VIPStephan
01-03-2008, 01:26 PM
Yeah that should work. However, I suspect that you’ll get a notice in IE that you have to confirm whether or not you wanna display the object. This is because there was a lawsuit (http://en.wikipedia.org/wiki/EOLAS).

So, some ingeious mind developed a technique to prevent that and it’s called SWFObject (http://blog.deconcept.com/swfobject/). That’s how most people do it nowadays and that’s also how they do it at YouTube.

twomt
01-03-2008, 02:54 PM
Yeah that should work. However, I suspect that youíll get a notice in IE that you have to confirm whether or not you wanna display the object. This is because there was a lawsuit (http://en.wikipedia.org/wiki/EOLAS).

So, some ingeious mind developed a technique to prevent that and itís called SWFObject (http://blog.deconcept.com/swfobject/). Thatís how most people do it nowadays and thatís also how they do it at YouTube.


Thank you very much indeed. My flash movies are now called using swfobject ;)

ahallicks
01-03-2008, 02:57 PM
Wow, I didn't realise youtube had moved on to using SWFObject! It's been so long since I had to use any form of Flash I had forgotten all about the javascript method for implementation, which is also great from a standards point of view as you can create something to 'sit behind' the Flash that will show if the user has their javascript disabled, and also gives and HTML render of the Flash (for example, a menu as I used)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum