Поверь можно, я хотел слить сервер какой нить игры, посмотрел допустим соединение игры Вормикс
Code
package
{
import Preloader.*;
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.utils.*;
import ru.kubline.preloader.gui.*;
public class Preloader extends Sprite
{
private var stageHeight:int = 590;
private var startScreenSaver:MovieClip = null;
private var progressBar:ProgressBar = null;
private var timer:Timer;
private var engineUrl:String;
private var loader:Loader;
private var userStore:SharedObject;
private var wrapper:Object;
private var baseUrl:String = "http://wormix.ru/engine/0.2.9.2/";
private var debugField:TextField;
private var stageWidth:int = 745;
private var localConnection:LocalConnection;
private var context:LoaderContext;
private var howToStart:MovieClip = null;
private var howToStartUrl:String;
private var channelName:String = "_kubline_progress_bar_";
private var engineInstance:Sprite = null;
public static var flashVars:Object;
public static var instance:Preloader;
public function Preloader()
{
debugField = new TextField();
engineUrl = baseUrl + "WormsWar.swf?88";
howToStartUrl = baseUrl + "data/interface/requests/howToStart.swf";
timer = new Timer(300);
instance = this;
context = new LoaderContext(true, new ApplicationDomain(ApplicationDomain.currentDomain), SecurityDomain.currentDomain);
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
localConnection = new LocalConnection();
localConnection.allowDomain("*");
var client:* = new Object();
client.progress = function (flashVars:int) : void
{
if (progressBar != null)
{
progressBar.progress(flashVars);
}
return;
}// end function
;
localConnection.client = client;
return;
}// end function
public function securityErrorListener(event:SecurityErrorEvent) : void
{
showMsg(event.text);
dispatchEvent(event);
return;
}// end function
public function showMsg(flashVars:String) : void
{
var _loc_2:* = new TextFormat("_sans", 14, 16763749);
debugField.autoSize = TextFieldAutoSize.LEFT;
debugField.type = TextFieldType.INPUT;
debugField.defaultTextFormat = _loc_2;
debugField.filters = [new DropShadowFilter(1, 45, 0, 1, 2, 2, 2, 2)];
debugField.alpha = 0.7;
debugField.htmlText = debugField.htmlText + (" >> " + flashVars);
debugField.x = 20;
debugField.y = 200;
addChild(debugField);
return;
}// end function
private function checkSettings(flashVars:Object = null) : void
{
var _loc_2:int = 0;
if (flashVars == null)
{
_loc_2 = int(flashVars["api_settings"]);
}
else
{
wrapper.removeEventListener("onSettingsChanged", checkSettings);
_loc_2 = int(flashVars.settings);
}
if ((_loc_2 & 1) == 0 || (_loc_2 & 2) == 0 || (_loc_2 & 4) == 0 || (_loc_2 & 2048) == 0)
{
wrapper.addEventListener("onSettingsChanged", checkSettings);
wrapper.external.showSettingsBox(7 + 256 + 2048);
}
else
{
removeChild(howToStart);
showScreenSaver();
}
return;
}// end function
private function onApplicationAdded(flashVars:Object) : void
{
wrapper.removeEventListener("onApplicationAdded", onApplicationAdded);
checkSettings();
return;
}// end function
public function onCompleteEngineLoader(event:Event) : void
{
var event:* = event;
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, showProgress);
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onCompleteEngineLoader);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorListener);
try
{
localConnection.connect(channelName);
}
catch (error:ArgumentError)
{
progressBar = null;
}
engineInstance = Sprite(event.target.content);
var referrerId:uint;
if (userStore.data.referrerId)
{
referrerId = userStore.data.referrerId;
}
Object(engineInstance).initFromPreloader(wrapper, baseUrl, referrerId);
engineInstance.addEventListener(Event.INIT, onEngineInit);
addChildAt(engineInstance, 0);
loader = null;
return;
}// end function
private function showProgress(event:ProgressEvent) : void
{
progressBar.progress(Math.round(event.bytesLoaded / event.bytesTotal * 10));
return;
}// end function
private function checkInstallApplication() : void
{
if (flashVars != null && flashVars["is_app_user"] != "1")
{
if (!userStore.data.referrerId)
{
userStore.data.referrerId = flashVars["user_id"];
userStore.flush();
}
wrapper.external.showInstallBox();
wrapper.addEventListener("onApplicationAdded", onApplicationAdded);
}
else
{
checkSettings();
}
return;
}// end function
public function slowHideScreenSaver() : void
{
timer.start();
timer.addEventListener(TimerEvent.TIMER, function () : void
{
startScreenSaver.alpha = startScreenSaver.alpha - 0.3;
if (startScreenSaver.alpha <= 0.01)
{
timer.stop();
removeChild(startScreenSaver);
startScreenSaver = null;
}
return;
}// end function
);
return;
}// end function
private function onAddedToStage(event:Event) : void
{
wrapper = Object(parent.parent);
stageWidth = wrapper.application.stageWidth;
stageHeight = wrapper.application.stageHeight;
flashVars = wrapper.application.parameters;
var _loc_2:* = "store_" + flashVars["viewer_id"];
userStore = SharedObject.getLocal(_loc_2);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onHowToStartLoaded);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorListener);
loader.load(new URLRequest(howToStartUrl), context);
return;
}// end function
public function showScreenSaver() : void
{
startScreenSaver = new PreloaderScreen();
startScreenSaver.x = 0;
startScreenSaver.y = 0;
this.addChild(startScreenSaver);
progressBar = new ProgressBar(startScreenSaver.progressBar);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteEngineLoader);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorListener);
loader.load(new URLRequest(engineUrl), context);
return;
}// end function
public function onHowToStartLoaded(event:Event) : void
{
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onHowToStartLoaded);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorListener);
howToStart = MovieClip(event.target.content);
howToStart.x = (stageWidth - howToStart.width) / 2;
howToStart.y = (stageHeight - howToStart.height) / 2;
addChild(howToStart);
checkInstallApplication();
return;
}// end function
public function onEngineInit(event:Event) : void
{
slowHideScreenSaver();
return;
}// end function
public function ioErrorListener(event:IOErrorEvent) : void
{
showMsg(event.text);
dispatchEvent(event);
return;
}// end function
public static function deleteScreenSaver() : void
{
instance.slowHideScreenSaver();
return;
}// end function
}
}
Даже в этом куске инфы можно найти много что полезного вот например проверку которую я искал)
Добавлено (12.10.2010, 17:59)
---------------------------------------------
В основном тут написан только опять же один клиент на флехе, а остальное уже всё php страницы.