View Full Version : Embedding Flash into Cocoa application

Jun 19, 2008, 11:26 AM
I have developed an application in Obj-C with Cocoa which interfaces with a custom USB device. There is a standalone Flash application (.swf) I would like to embed into my application. Is this possible?

Basically, I would like my Obj-C app to be the interface between the USB device and the Flash application. Is there a Flash object that could be inserted into the application within Interface Builder, similar to how OpenGL is embedded?


Jun 19, 2008, 12:26 PM
There isn't a Flash class as such; but what you can do is create a html page to load that swf (you can include this page inside your app bundle), and then use a (Webkit) WebView to load that page.

You'll be able to get FSCommands back from the swf and set variables in the swf, and thus have 2-way communication.

Jun 19, 2008, 04:47 PM
Take a look at Flash'In'App (http://www.eltima.com/products/cocoa-framework/). I haven't used it myself, but it looks like it is what you need.


Jun 20, 2008, 01:42 PM
Cool. I'll try both methods. Thanks.

Feb 6, 2009, 01:22 PM
I would like to embed a flash object into Cocoa and communicate between the two. Can you please guide me through the process.

Jan 15, 2010, 12:50 AM
Are there other alternatives beside Webview and Flash'in'App?

We need to create 64-bit code and Flash'n'App does not support that yet.

The problem we had with WebView is that Flash display is 'jerky' and we need a way to determine when the flash file has finished playing, which we haven't been able to do with Webview.


Mar 12, 2010, 12:26 AM
Any suggestions? A suggestion or idea would be greatly appreciated.

thank you

Mar 12, 2010, 12:36 AM
Flash isn't 64 bit.

Mar 12, 2010, 08:33 AM
After Steve's thoughts on Flash.

I think he may come hunt you down ;)

Mar 12, 2010, 08:53 AM
Any suggestions? A suggestion or idea would be greatly appreciated.

thank you

For performance, there isn't much you can do. It's not great - but the 10.1 beta seems to be much better. I tried some animation benchmarks, and saw almost 100% improvements in framerate. If you're mostly playing video, your results may vary greatly.

If you want to determine if Flash is done playing (I assume you're talking about Flash video here), I'd do it as follows:

- Create a Flash movie player swf, and embed this in the html in the Webview.
- When you want to play a video, load it into the player swf.
- In the player swf, create a timer which checks at what point the video is at. If it hasn't changed since the last time the timer fired (and the video isn't paused), then it's at the end.