Luke, Sam ->

  Thank you for clarifying the issue for me.  It's always the simple 
things that take the longest to debug ;(

  Another thing I learned is that if the DOM element containing the 
embedded flash is hidden (display: none), I cannot send 
commands/interact with the SWF via Javascript. I would get "[method 
name] is not a method" errors. There is apparently a small delay when 
showing/hiding/creating the flash videos -- which is related to my 
$().ready() issue. To get around this, I wrote a simple queue plugin 
which continually tries to execute a method until it is successful. 
Here's the code;

(function($) {
$.fn.fq = function(o) { var i=this[0].id; $.fq.q(i,o,0); return this; }
$.fq = {
q: function(i,o,c) { if(c>20) return; var e=$('#'+i)[0];
    (e[o]) ? e[o]() : 
setTimeout("$.fq.q('"+i+"','"+o+"',"+(c+1)+");",350); return; }
};
})(jQuery);

Example use;
--------------------
<div id="fp"></div>
...
var fo = new SWFObject("flowplayer/FlowPlayer.swf", "FP", "730", "510", 
"7");
 ...
fo.write("fp");

$('#FP').fq('DoPlay');   // Continually try to execute the DoPlay method 
on the DOM element created by SWFObject.

NOTE:  I think my method queue function doesn't work in opera. The whole 
thing may be garbage [quick hack on no sleep] ;) Also.. for some reason 
in seems that if I cache the element ($('#'+i)[0]) it will never detect 
the new method.. so I perform the getElementByID() function per loop cycle.

Luke Lutman wrote:
> Since you're not doing anything fancy, why not just pass the config as 
> flashvars and save 
> yourself a world of hurt? ;-)
>   
It is now time to let the fanciness commence ;)

~ Brice

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to