共有ホワイトボードを作成していますが、共有ホワイトボードを共有できません。共有メソッドが正常に作成され、管理コンソールに共有オブジェクトが表示され、接続されていることがわかりますが、別のブラウザーで図面を表示できません。actionscript コード全体を投稿しています。できれば助けてください。大歓迎です。私はアクションスクリプトに本当に慣れていません。
package
{
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.net.SharedObject;
import flash.events.NetStatusEvent;
import flash.events.SyncEvent;
import flash.net.NetConnection;
import flash.events.MouseEvent;
public class PenSOmc extends Sprite
{
private var drawing_so:SharedObject;
private var nc:NetConnection;
private var good:Boolean;
private var isDrawing:Boolean;
private var penMC:MovieClip;
private var rpenMC:MovieClip;
// Mouse Coordinates
private var startX:int;
private var startY:int;
private var endX:int;
private var endY:int;
// Remote mouse coordinates
private var rstartX:int;
private var rstartY:int;
private var rendX:int;
private var rendY:int;
public function PenSOmc ()
{
penMC = new MovieClip();
var rtmpNow:String="rtmp://localhost/whiteboard";
nc=new NetConnection;
nc.connect(rtmpNow);
nc.addEventListener(NetStatusEvent.NET_STATUS,doSO);
stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, drawing);
stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
addChild(penMC);
}
private function doSO (e:NetStatusEvent):void
{
good=e.info.code == "NetConnection.Connect.Success";
if (good)
{
//Shared object
drawing_so = SharedObject.getRemote("draw",nc.uri,false);
drawing_so.connect(nc);
drawing_so.addEventListener(SyncEvent.SYNC,doUpdate);
trace("Connected");
}
}
private function doUpdate (se:SyncEvent):void
{
for (var cl:int = 0; cl < se.changeList.length; cl++)
{
trace(se.changeList[cl].code);
switch(se.changeList[cl].code)
{
case "clear":
break;
case "success":
break;
case "change":
//var points:String = sharedObject.data.points;
var pointsArray:Array = drawing_so.data.points.split(/,/);
var rstartX:int = int(pointsArray[0]);
var rstartY:int = int(pointsArray[1]);
var rendX:int = int(pointsArray[2]);
var rendY:int = int(pointsArray[3]);
rpenMC = new MovieClip();
rpenMC.graphics.moveTo(rstartX,rstartY);
rpenMC.graphics.lineTo(rendX,rendY);
addChild(rpenMC);
break;
}
}
}
private function startDrawing (e:MouseEvent):void
{
trace("Start drawing");
isDrawing = true;
var penTipSize:uint = 1;
var penColor:Number = 0x000000;
penMC.graphics.lineStyle(penTipSize, penColor, 1.0);
startX = mouseX;
startY = mouseY;
penMC.graphics.moveTo(startX, startY);
}
private function stopDrawing (e:MouseEvent):void
{
trace("Stop drawing");
isDrawing = false;
}
private function drawing (e:MouseEvent):void
{
if (isDrawing)
{
trace("Drawing");
endX = mouseX;
endY = mouseY;
drawing_so.setProperty("points",startX + "," + startY + "," + endX + "," + endY);
penMC.graphics.lineTo(endX, endY);
}
}
}
}