Embedding Flash into Cocoa application

Discussion in 'Mac Programming' started by TurboLag, Jun 19, 2008.

  1. macrumors member

    Joined:
    Feb 24, 2004
    #1
    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?

    Thanks.
     
  2. macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #2
    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.
     
  3. macrumors member

    Joined:
    Feb 18, 2007
    Location:
    Eindhoven
    #3
  4. thread starter macrumors member

    Joined:
    Feb 24, 2004
  5. macrumors newbie

    Joined:
    Feb 6, 2009
    #5
    did you try using Webkit

    I would like to embed a flash object into Cocoa and communicate between the two. Can you please guide me through the process.
    Thanks.
     
  6. macrumors newbie

    Joined:
    Jan 14, 2010
    #6
    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.

    thanks!
     
  7. macrumors newbie

    Joined:
    Jan 14, 2010
    #7
    Any suggestions? A suggestion or idea would be greatly appreciated.

    thank you
     
  8. macrumors 6502a

    GorillaPaws

    Joined:
    Oct 26, 2003
    Location:
    Richmond, VA
  9. macrumors 65816

    Flynnstone

    Joined:
    Feb 25, 2003
    Location:
    Cold beer land
    #9
    After Steve's thoughts on Flash.

    I think he may come hunt you down ;)
     
  10. macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #10
    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.
     

Share This Page