Re: Embedding Flash in .app, Round Two
Re: Embedding Flash in .app, Round Two
- Subject: Re: Embedding Flash in .app, Round Two
- From: Rachel Blackman <email@hidden>
- Date: Wed, 4 Jan 2006 13:24:38 -0800
The issue here is that the WebView (as set up in this) doesn't
provide for Flash interactivity. I.e., receiving fscommand calls
from the Flash file, nor sending setVariable messages to Flash.
Loading the Flash file is no issue... it's getting at the
'swliveconnect' functionality that's giving me a headache. :)
Okay, I finally made it work!
For those who are curious (since I got a lot of off-list 'if you
figure this out, let me know' mail), the solution isn't quite as
clean as I might've hoped. The Flash plugin's security model is such
that unless the Flash and page are loaded from the web (no file://)
and have a matching domain portion of the URL, it won't enable
liveconnect.
This is annoying.
But in the end, since our Flash files were coming from a specific
remote server anyway, I wrote a PHP wrapper which takes a parameter
of the swf file in our collection, and hands back a pre-generated
webpage. The Flash is embedded (with 100% width and 95% height) with
a specific name ('csflash'), and a Javascript function for
csflash_FSCommand is also included which simply calls
document.CSFlashEngine.fsCommand(command,args).
When the WebScriptObject becomes available, I add the view itself as
CSFlashEngine. The view has a registered delegate, which then will
receive 'fsCommand' handed back off from the view whenever the Flash
generates an event. Sending variables to the Flash file is easy
enough, just a matter of using the WebScriptObject to evaluate
'document.csflash.setVariable()' calls.
On the plus side, I now have a nice embeddable view, where I just do
a single call to load a Flash file, and voila, I get back the
fscommand calls. On the down side, it's not quite as generally
reusable as I hoped because of Flash's security model. Fooie.
--
Rachel 'Sparks' Blackman -- sysadmin, developer, mad scientist
"If it is not broken, give me five minutes to redesign it!"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden