Hey Sam,

Thanks for all the kind words :-)

I've (been lucky?) never to need to communicate between flash and 
javascript, so I'm a bit out of the loop on how that whole process works.

If it's simply needing access to the <embed /> element after it's 
inserted into the dom, it should be pretty simple (off the top of my head):

$('#hello').flash(...).find('embed').each(function(){
        // do stuff
}).end();

If you need to wait until the flash movie has fully loaded before 
creating your object, that's a whole 'nother ballgame.

Could you call an javascript function from within the flash movie that 
creates the object you need? Something like:

- load page
- insert flash movie
- flash movie preloads itself
- flash movie calls someFunction() in javascript
- someFunction() creates the object that talks to flash
- ....
- Profit!

;-)

That'd probably work ok if you only have one flash movie calling 
someFunction(), but would get a little hairy otherwise because 
someFunction() wouldn't know which element in the DOM called it.

If <embed /> or <object /> fire onload events, it'd be possible to add a 
callback function -- but I'm pretty skeptical that they'd fire the event 
with any sort  of consistency across browsers (if at all).

You could use an Image object to preload your swf (if it's small), so 
that it'd come from the cache when inserted into the page (using the 
Image object's onload event to trigger the $().flash call).

Last but not least, you could wait for window.onload (instead of 
document.ready), but there might be quite a gap between when the flash 
movie finishes loading and window.onload is called

Hope that helps!

Luke

Sam Sherlock wrote:
> I am astounded Luke remarkable stuff.
> 
> Looks like I might be able to reduce my script over heads quite a bit 
> with this.
> 
> At first glance (through tired eyes n with fatigued mind) it appears to 
> handle text replacement better than the existing sifr jquery plugin.
> 
> I am working away on a project at mo that makes call into and out of 
> flash using Flash version 7 (flash 8 has extended interface which sounds 
> great), to work this I am using JSFC (JavaScript FlashCommmunicator - it 
> works well in all browser I have tested so far)  I have had some jip 
> with creating the object to talk to flash, as it needs to be created 
> after the flash is full placed in page (which can be sometime after 
> document.ready fires) - would your plugin be able to aide me here?
> 
> 1) Either by being  able to call function within flash?  (Previous 
> points have been aired claiming that this is best not done with jquery)
> 2) Could a call back be made to fire when flash is set in the page?
> 
> In any case the script is  piece of sheer wonderment
> 
> -S


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

Reply via email to