admin管理员组

文章数量:1333413

I'm loading an SWFObject within an HTML file.

With the next line I create an player within this object.

var s1 = SWFObject( '.swf',
                    'mediaplayer', '480', '388', '7');

How can I control this player, like play/pause or fullscreen the player with a seperate function? So I can control it from JAVA?

Thanks.

I'm loading an SWFObject within an HTML file.

With the next line I create an player within this object.

var s1 = SWFObject( 'http://www.dumpert.nl/mediabase/player4.swf',
                    'mediaplayer', '480', '388', '7');

How can I control this player, like play/pause or fullscreen the player with a seperate function? So I can control it from JAVA?

Thanks.

Share Improve this question edited Oct 29, 2011 at 17:33 Bakudan 19.5k9 gold badges55 silver badges75 bronze badges asked Aug 30, 2011 at 16:09 IonIon 11 silver badge1 bronze badge
Add a ment  | 

2 Answers 2

Reset to default 3

Yes, read docs
http://code.google./p/swfobject/wiki/api

SWFObject JavaScript API documentation

SWFObject 2 contains an API that allows JavaScript developers to reuse SWFObject's internal functions and aims to deliver a plete tool set for publishing SWF's and retrieving Flash player related information.


but it also depends on what API provides the final SWF (Flash) app, if it cannot be controlled from outside, you cannot do anything via Javascript

SWFObject is only a means to embedding a Flash object in an HTML page. If you want the ability to control the functionality of a Flash based video player, You need to municate with it using ExternalInterface.

You will need to ensure that functionality is written into the video player to catch calls from the JavaScript and act on them. Here's a really simple example:

AS3:

//assume an FLVPlayback ponent called myPlayer
function stopVideoCallback():void
{
    myPlayer.stop();
}
ExternalInterface.addCallback("stopVideo", stopVideoCallback);

JS:

swfobject.getObjectById('mediaplayer').stopVideo();

本文标签: htmlHow to control an SWFObject in javascriptStack Overflow