Short presentation about how to use openFrameworks with Flash. You create a simple server in openFrameworks to which Flash connects using a socket. You can receive and send messages in both ways.
2. Add ofxFlashCommunication to XCode
- Very simple to setup
- Can handle hundreds of connections
- Extremelly simple to use:
2 function calls to setup
2 function calls for receiving messages.
3. Add ofxFlashCommunication to XCode
Add ofxFlashCommunication to your project:
- create new group, call it ofxFlashCommunication
- drag the src directory onto it from Finder
5. Code setup
In testApp.cpp
- you application is the server
- tell the server on which IP and port to run.
- if you want to connect from Flash which runs in a
browser or using a AIR application, you need to
add a policy. See adobe policy.xml information; to
test you can just call: flash.addPolicy(“*”,”*”) which
allow all clients to connect.
6. Code setup
In testApp.cpp - setup flash server
- start listening on ip: 192.168.0.200 and port 1234
- policy: all clients can connect
- start(), lets run!
7. Code setup - receive message
In testApp.cpp - update()
- check for message from flash client.
9. Code setup
In Flash:
- use the ofxFlashCommunication Actionscript 3
classes
- connect to the OF server
- add an event listener which notifies you when the
OF application sends data. Handle the
NEW_DATA event.
- use “send(msg:String)” to send data to the OF
application.