I've run into this before too...

Calling a method (i.e. setConfig(), setVariable()) of the flash player (in 
Firefox it's an 
NPObject, in IE it's an ActiveX object) before the swf has loaded will throw an 
error.

The ready event fires before your swf has loaded, which throws an error.
The load event doesn't fire until the swf (and everything else) has finished 
loading, hence, no 
error.

Since you're not doing anything fancy, why not just pass the config as 
flashvars and save 
yourself a world of hurt? ;-)

Luke




Sam Collett wrote:
> On 04/02/07, Brice Burgess <[EMAIL PROTECTED]> wrote:
>> I am trying to embed flowplayer; http://flowplayer.sourceforge.net/
>>
>> For some reason I cannot access an embedded SWFObject within a $().ready
>> function. FF errors out with invalid access to a NPObject, or that the
>> setConf method is not found? I am not sure what this means.. but I do
>> know that if I switch from $().ready to window.onload, the problem goes
>> away.
>>
>> Here's one of my examples;
>>
>> <div id="fpholder">
>>     ...get flash text
>> </div>
>> <script type="text/javascript">
>> var fo = new SWFObject("FlowPlayer.swf", "FlowPlayer", "500", "560",
>> "7", "#ffffff", true);
>> fo.addParam("allowScriptAccess", "always");
>> fo.addParam("flashVars", "config={configInject: true}");
>> fo.write("fpholder");
>>
>>
>> function init() {
>>    var fpConf = {
>>        videoHeight: 320,
>>        hideControls: false };
>>
>>        var fp=$("#FlowPlayer")[0];
>>     fp.setConfig(fpConf);
>> }
>>
>> // $().ready(function(){ init(); });  <-- DOES NOT WORK
>> // window.onload = init; <-- WORKS
>> </script>
>>
>> I have tried many, many combinations.. but can't seem to figure out what
>> is causing this issue. Perhaps someone with deeper knowledge of the
>> .ready() function, or SWFObject experience will have an idea?
>>
>> Thanks!
>>
>> ~ Brice
> 
> Did you try using load instead of ready?
> 
> $().load(function(){ init(); });
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/


-- 
zinc Roe Design
www.zincroe.com
(647) 477-6016

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to