Flash and Of how do i get it to work tutorial/guide

Hi, i know there is a thread on the forum about that, but it was not possible to follow it to get it to work with the class obj. It would be nice if some one could help me out so this would be a complete tutorial for the basic setup
for Mulitouch app. I love of it has so nice features, but to put them together as a beginner in c++ and of it can get hard. Best regards and a good start in the new year Anubisbot

Ok here is my code :

testApp.h

  
  
  
  
#define OF_ADDON_USING_OFXTOUCH  
#define OF_ADDON_USING_OFXNETWORK  
#define FINGER_RADIUS 10  
#include "ofMain.h"  
#include "ofAddons.h"  
#include"model_1.h"  
  
class testApp : public ofxTouchApp {  
  
  public:  
  
    bool bDragging;  
    void setup();  
    void update();  
    void draw();  
  
    void keyPressed  (int key);  
    void keyReleased  (int key);  
  
    void mouseMoved(int x, int y );  
    void mouseDragged(int x, int y, int button);  
    void mousePressed(int x, int y, int button);  
    void mouseReleased();  
  
    void fingerDragged( const ofxTouchFinger& finger );  
    void fingerPressed( const ofxTouchFinger& finger );  
    void fingerReleased( const ofxTouchFinger& finger );  
    void DoubleTap( const ofxTouchFinger& finger );  
  
        ofxTCPServer TCP;  
  
		ofTrueTypeFont  mono;  
		ofTrueTypeFont  monosm;  
  
		vector <string> storeText;  
};  
  
  

testApp.cpp

  
  
#include "testApp.h"  
#include "stdlib.h"  
void testApp::setup() {  
    setSetupMode( false );  
    //setSimulationMode( true );  //uncomment this to use mouse simulation  
    // setVideoPlayerMode( true );   //comment this out to run live from cam  
    //setVideoPlayerFile("touchkit-fingers.mov");  
    bDragging = false;  
	ofSetVerticalSync(true);  
  
	//load our type  
	mono.loadFont("type/mono.ttf", 9);  
	monosm.loadFont("type/mono.ttf", 8);  
    model_1* Model;  
    TCP.setup(11999);  
  
}  
  
  
void testApp::update(){  
	ofBackground( 0,0,0 );  
    //for each client lets send them a message letting them know what port they are connected on  
  
}  
  
  
void testApp::draw() {  
ofSetColor(0xDDDDDD);  
	mono.drawString("TCP SERVER Example \n\nconnect on port: "+ofToString(TCP.getPort()), 10, 20);  
  
	ofSetColor(0x000000);  
	ofRect(10, 60, ofGetWidth()-24, ofGetHeight() - 65 - 15);  
  
	ofSetColor(0xDDDDDD);  
  
	//for each connected client lets get the data being sent and lets print it to the screen  
	for(int i = 0; i < TCP.getNumClients(); i++){  
  
		//give each client its own color  
		ofSetColor(255 - i*30, 255 - i * 20, 100 + i*40);  
  
		//calculate where to draw the text  
		int xPos = 15;  
		int yPos = 80 + (12 * i * 4);  
  
		//get the ip and port of the client  
		string port = ofToString( TCP.getClientPort(i) );  
		string ip   = TCP.getClientIP(i);  
		string info = "client "+ofToString(i)+" -connected from "+ip+" on port: "+port;  
  
  
		//if we don't have a string allocated yet  
		//lets create one  
		if(i >= storeText.size() ){  
			storeText.push_back( string() );  
		}  
  
		//we only want to update the text we have recieved there is data  
		string str = TCP.receive(i);  
  
		if(str.length() > 0){  
			storeText[i] = str;  
		}  
  
		//draw the info text and the received text bellow it  
		monosm.drawString(info, xPos, yPos);  
		monosm.drawString(storeText[i], 25, yPos + 20);  
  
	}  
    ofNoFill();  
  
    ofEnableAlphaBlending();  
    if( bDragging ) {  
        ofFill();  
        bDragging = false;  
    } else {  
        ofNoFill();  
    }  
  
	for( int i=0; i<fingers.size(); i++ ) {  
  
        ofSetColor( 0, 255, 0, 255 );  
        ofCircle( fingers[i].x, fingers[i].y, 0.2*fingers[i].radius );  
  
  
	}  
  
  
}  
//----------------------------------------------------------  
  

  
  
void testApp::mouseMoved( int x, int y ) {}  
void testApp::mouseDragged( int x, int y, int button ) {}  
void testApp::mousePressed( int x, int y, int button ) {}  
void testApp::mouseReleased() {}  
  
void testApp::fingerDragged( const ofxTouchFinger& finger ) {bDragging = true;  
  
  
Model* model = new Model();  
model->x = finger.x;  
model->y = finger.y;  
model->depth = 1.5;  
     
TCP.sendRawBytesToAll((char*) model->x, sizeof(model->x));  
  
//This works//TCP.sendRawBytesToAll("sending bytes",13);// This work and i get the data in my flash file..  
}  
void testApp::fingerPressed( const ofxTouchFinger& finger ) {  
  
    }  
void testApp::fingerReleased( const ofxTouchFinger& finger ) {}  
void testApp::DoubleTap( const ofxTouchFinger& finger ) {}  
  
  
  

model_1.h

  
  
#ifndef _OF_MODEL_1                         // if this class hasn't been defined, the program can define it  
#define _OF_MODEL_1                         // by using this if statement you prevent the class to be called more  
                                         // than once which would confuse the compiler  
  
#include "ofMain.h"  
class Model  
{  
   public:  
           Model(void);  
          ~Model(void);  
  
      int x;  
      int y;  
      float depth;  
};  
#endif  
  
  

Flash file AS3

  
  
  
var _socket:Socket;  
Main();  
  
function Main() {  
	_socket = new Socket();  
	_socket.addEventListener(ProgressEvent.SOCKET_DATA,socketData);  
	_socket.addEventListener(Event.CONNECT,socketConnected);  
	_socket.addEventListener(IOErrorEvent.IO_ERROR,socketError);  
	send_btn.addEventListener(MouseEvent.CLICK,sendText);  
	connect_btn.addEventListener(MouseEvent.CLICK,connectToSocket);  
}  
  
function connectToSocket(e:Event):void {  
	_socket.connect(ip_txt.text,11999);  
}  
  
function sendText(e:Event):void {  
	if (_socket.connected) {  
		allMessages_txt.appendText("FLASH CLIENT: "+sendMessage_txt.text+"\n");  
		allMessages_txt.scrollV = allMessages_txt.maxScrollV;  
		_socket.writeUTFBytes(sendMessage_txt.text);  
		_socket.flush();  
  
	} else {  
		allMessages_txt.appendText("SYSTEM MSG: SOCKET IS NOT CONNECTED\n");  
		allMessages_txt.scrollV = allMessages_txt.maxScrollV;  
	}  
}  
function socketError(e:IOErrorEvent):void {  
	allMessages_txt.text = "SYSTEM MSG:"+e.text+"\n";  
	allMessages_txt.scrollV = allMessages_txt.maxScrollV;  
}  
function socketConnected(e:Event):void {  
	allMessages_txt.text = "SYSTEM MSG: SOCKET CONNECTED\n";  
	allMessages_txt.scrollV = allMessages_txt.maxScrollV;  
	connect_btn.gotoAndStop(2);  
	connect_btn.removeEventListener(MouseEvent.CLICK,connectToSocket);  
}  
function socketData(e:ProgressEvent):void {  
	var str:String = e.currentTarget.readUTFBytes(e.currentTarget.bytesAvailable);  
	allMessages_txt.appendText("C++ SERVER: "+str+"\n");  
	allMessages_txt.scrollV = allMessages_txt.maxScrollV;  
}  
  

:slight_smile: