Go Back   kirupaForum > Flash > Flash CS3

Reply
 
Thread Tools Display Modes
Old 11-19-2009, 07:40 AM   #1
james1507
Registered User
Flash Media Server HELP!!!!!! Please

Hi i am trying to develop a multiplayer game using the flash media server. Currently i can get multiple users to control one shared object but i need to have 2 users controlling seperate shared objects on the same stage.

Here is my code so far:

// Create a connection
netConn = new NetConnection();
netConn.connect(serverPath);

keysObject = SharedObject.getRemote("keyboardStatus", netConn.uri, false);
keysObject.connect(netConn);

var keyListener:Object = new Object();
Key.addListener(keyListener);

var goLeft = false;
var goRight = false;

stop();

netConn.onStatus = function(info)
{
if (info.code == "NetConnection.Connect.Success")
{
trace("Sucessfully connected to server " + serverPath);
}
else
{
trace("Connection to server " + serverPath + " failed");
}
}

keysObject.onSync = function(list)
{
key = keysObject.data.key;
isKeyDown = keysObject.data.isKeyDown;

if (isKeyDown) //Only move it if key down.
{
switch (key) //Switch is just a fancy if - Nigel
{
case 37 : //Left arrow.
goLeft = true;
break;
case 39 : //Right arrow.
goRight = true;
break;
}
}
else
goLeft = goRight = false; //Stop stuff moving.
}

keyListener.onKeyDown = function()
{
var key = Key.getCode();
keysObject.data.isKeyDown = true;
keysObject.data.key = key;
}

keyListener.onKeyUp = function()
{
keysObject.data.isKeyDown = false; //Tell SO key is down.
}

onEnterFrame = function ()
{
if (goLeft)
{
tt._x -= 5;
//positionObject.data.posX = tt._x; //Don't send every frame any more.
}
if (goRight)
{
tt._x += 5;
//positionObject.data.posX = tt._x; //Don't send every frame any more.
}
}

PLEASE HELP!!!
james1507 is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-19-2009, 08:19 AM   #2
james1507
Registered User
bump
james1507 is offline   Reply With Quote
Reply

Tags
flash, fms, media, server


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:02 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com