--I Think this is Adanced I D K Really. Cuz its Easy.-
--This is An Open Source Project So Please if you change anything cuz i dont care what you change Please Place some recognition to my website saying you started from us. Thankyou--Franky--Unkownname--
--Made in Flash Professional 8--
--C++ In Dev-C++ MINGW Compiler--


Ive always wanted to make projector files that worked online but I was sunk because I needed a flash comm server and Im to poor to obtain one.

I eventually found out you can use XMLSockets to connect to a c++ server I made.

I was Able to make chat system and stuff like that at the moment im currently working on an MMORPG make shift game with it.

But Knowing prob alot of people might want to as well I was like what the hell just put a tutorial right?

*Note At the End of this Tutorial I will have an attachment with all Im using to make my MMORPG with and let you go from their.
*This tutorial will use XMLSockets to connect to a c++ server and Ill Show you how to talk from one to one.
*This Tutorial Uses the Server That is Attached.

*--------Lets Start Now EH?
Basic Connection To Server. With Data Function.
Code:
_root.ip="localhost";
_root.port="1025";
Conn = new XMLSocket();
Conn.onConnect = handleStatus_Connect;
Conn.onClose = handleStatus_Disconect;
Conn.connect(_root.ip, _root.port);
function handleStatus_Connect(connectionStatus) {
connectionStatus ? handleOnStatusConnect(1) : handleOnStatusConnect(2);
}
function ConnText(textToSend){ Conn.send(textToSend);}
function handleOnStatusConnect(Online) {
if (Online != 1) {
trace("Server Is Currently Down Sorry.");
}else{
trace("Server is Online");
}
Conn.onData = function (src) {
//Manipulate "src" variable.
//What does "src" Contain you ask well through my server in c++ it redirects all the code to everyone which is connected to it. So Its a redirector server.
}


Thats Basically all their is to it.

Want an example of how to transfer variables from one exe to another?

First You do whats above.
Ok Now lets think for a moment lets say your making a chat? you make textbox's that hold username , chat history, and an inputbox for messages.
Oh dont forget the button to send or make a script for the inputbox that allows user to use "ENTER" instead.
Well with redirector server I provided just connect to it and it will redirect everything to you of course and everyone that is connected as well.
Lets start.
Code:
//Were you have your script to send message put this.
_root.username="Test";//declare this werever you ask the user to place a username. Like a textbox.
_root.msg="Hello World";//Same thing for Inputbox for messages.

ConnText(_root.username+": "+_root.msg);
//Then Finish anything else you want.

*--Now For the Function Conn.onData = function (src) ;

Code:
//If you did the very first part for connection just add this to the function.
//If you didnt just go up and copy the function. and add the following.

//Lets Say You Made a text area for chathistory named "chathistory"

_root.chathistory.text+=src;

//Wow Was that hard? Hope not cuz that was to easy.

//Now if you want it so you dont want it to show up messages from your end because you already placed them on chathistory? Do the Following Instead of the above.
split=src.split(':');
if(split[0]-=_root.username){
_root.chathistory.text+=src;
}

Fewh! Done with that was it hard? Well I hope This helped some one in the audience.
If theirs anything left unanswered post a new Topic Under this Forums

--Part 2--C++ To Flash--DONE--You Do need to know c++--
*NOTE Requirements to compile C++
--Youll Need Dev-C++--Free And Easy to use.
--And Youll Need Winsock2 Lib's Located on Dev-C++
----If you need info on any of the above youll need to see me at my site.
--My Site is my signature.

Ok Well Hopefully you all know c++?-Youll need alot of skill to do the following unless you come to my website and ill help you code out w/e you need.

What I am going to show you is how to send a message to flash.

Well Make it send when a user connects.

Code:
//Under 
void sendmotd(WPARAM);
//Place this.
void ourmsg(WPARAM);

//Under
sendmotd(wParam);
//Place this.
ourmsg(wParam);

//Now at the very end of the code Well start making our message sending function.
//At the end of all of the code add this.

void ourmsg(WPARAM wParam){
//Now Will Declare our Message
char* buffer="Hello Flash User Hows it going Its nice over here Hows it over their?";
send(wParam,buffer,256,0);
}



And thats all their is to sending a message through c++ to flash Its alot easier if you know how to c++.
--If more is need post a new Topic

Back to Flash-
What youll need to do to accept Message from c++ Server is completly nothing.
Everything that was Sent Should be "src" variable on the OnData() function.
Then you just manipulate it and trace it or put on a textbox for all to view heh.

Now-- I forgot something didn't I? I forgot to show you how to recieve messages from flash to c++ right?.

What Youll need to know how to do this successfully is the following:
You cannot use variables from textboxes they will be recieved like html messages.--NOT GOOD--if you want to manipulate it.
You can only use actionscript declared variables like so.

Code:
var_name="Hello World";

Thats about all you need to know because you can do anything really with sending textbox data to the server. It wont be able to manipulate without gut busting work.

Now For Sending it to the server.

Code:
//Its nothing new really you just use this.
ConnText(var_name);

Now Lets say you want it to show up on the server that you sent a message to it. Do the Following.

Open up the Server Code

Following is c++ But a simple line to view it on the window.

Code:
//After this line.
void packetb(char buffer[256],WPARAM wParam,char* ip){
//Add This.
addchat(buffer);
Fweh Done That wassent to hard now was it? lol

--If more is need post a new Topic

Well Their You have it Ready To go.-Good Luck From Me-
Thanks For Reading my Tutorial.

--Franky--

*Files

http://tempostudios.com/forums/index.php?board=1.0

A new version is now available its v2.0 and it has things v1.0 didnt and is alot more stable :)