Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

control flashmovies with a firefox extension?

5 views
Skip to first unread message

Thomas

unread,
Nov 22, 2006, 12:14:43 PM11/22/06
to
Hi,

i try to write a FF extension to control Flashmovies. I think it must be
simple, because the adope/macromedia flash plugin supports many
functions like Play, StopPlay, CurrentFrame, GotoFrame, ...

If i walk through the DOM with my extension and select the OBJECT/EMBED
tag with a flash-movie and try Stop(), i get an error.

If i write a webpage with a flash movie and i add some JS, then can i
get the movie with "var v = document['testcommand']" and can use
"v.StopPlay()" ('testcommand' is the ID of the OBJECT and the ID of the
EMBED inside the OBJECT)
You can view an example under:
credes.psiegmund.de/js4flash/javascript-to-flash.html
(many thanks to http://www.moock.org/webdesign/flash/fscommand/ for this
example!)

I have watched the Flashblock extension but they only cut the OBJECT out
of the DOM and replaced it with a DIV and if you click on the DIV they
reload the OBJECT and replace the DIV and the movie will be shown.

I can use functions like StopPlay(),... if i open a SWF file directly,
but i want to control the flashmovies that are embedded in a hmtl document.
I hope i could make myself clear and someone can help me.
Thanks Thomas

mark bokil

unread,
Nov 22, 2006, 1:16:59 PM11/22/06
to dev-ext...@lists.mozilla.org
Thomas wrote:
> Hi,
>
> i try to write a FF extension to control Flashmovies. I think it must
> be simple, because the adope/macromedia flash plugin supports many
> functions like Play, StopPlay, CurrentFrame, GotoFrame, ...
>
> If i walk through the DOM with my extension and select the
> OBJECT/EMBED tag with a flash-movie and try Stop(), i get an error.
>
Make certain to use Mook's javascript function to test if the movie is
100% loaded before calling stop. Possibly you could use the setTimeout
and setInterval functions from an extension to check at a certain
interval and probe the Flash movies for their loading status. Once the
loading is 100% then call stop. These routines could be started from a
window.onload script in your extension.

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
// First make sure the movie's defined.
if (typeof(theMovie) != "undefined") {
// If it is, check how much of it is loaded.
return theMovie.PercentLoaded() == 100;
} else {
// If the movie isn't defined, it's not loaded.
return false;
}
}


Thomas

unread,
Nov 22, 2006, 2:24:32 PM11/22/06
to

Hi,

my extensions adds a menu entry and i only try to use the function
behinde the menu-entry if the flash movie is 100% loaded. I'm realy sure
that the flash movie is 100% loaded, because ist is running :-)

i have copied the Mook JS code into my extension and typeof(theMovie)
will always be return an undefined.

Philip Chee

unread,
Nov 23, 2006, 6:23:43 AM11/23/06
to
On Wed, 22 Nov 2006 18:14:43 +0100, Thomas wrote:

> I have watched the Flashblock extension but they only cut the OBJECT out
> of the DOM and replaced it with a DIV and if you click on the DIV they
> reload the OBJECT and replace the DIV and the movie will be shown.

That must be a very old version of flashblock. In current versions and
certain classes of flash object we do use StopPlay().

> I can use functions like StopPlay(),... if i open a SWF file directly,
> but i want to control the flashmovies that are embedded in a hmtl document.
> I hope i could make myself clear and someone can help me.
> Thanks Thomas

If you are accessing webcontent from chrome, you may need to use the
JSWrappedObject property to access unsafe methods.

Phil
--
Philip Chee <phi...@aleytys.pc.my>, <phili...@gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]Truth is just another misconception.
* TagZilla 0.059

Thomas

unread,
Nov 29, 2006, 2:05:44 PM11/29/06
to
Hi,

> If you are accessing webcontent from chrome, you may need to use the
> JSWrappedObject property to access unsafe methods.

i have nothing found about JSWrapperObject. :-(
I make a bad smelling workaround. I add some javascript-code to the page
and add some hidden buttons. Now my extension calls HiddenButton.click()
and this button calls some javascript that was insert bevor. (something
like stopmovie() and stopmovie() gets the EMBED by ID and call
myembed.StopPlay())

0 new messages