Chapter 44 Example 1
♥0 |
Line 22 |
Modified 2010-02-10 14:36:15 |
MIT License
archived:2017-03-10 18:30:03
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2nii
*/
package {
import com.actionscriptbible.Example;
import flash.events.MouseEvent;
import flash.events.StatusEvent;
import flash.net.LocalConnection;
public class ch44ex1 extends Example {
protected var sendingConnection:LocalConnection;
public function ch44ex1() {
//sending application.
sendingConnection = new LocalConnection();
sendingConnection.addEventListener(StatusEvent.STATUS, onSendStatus);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
protected function onMouseMove(event:MouseEvent):void {
sendingConnection.send("_mouseChannel", "mouseMoved", event.stageX, event.stageY);
}
protected function onSendStatus(event:StatusEvent):void {
if (event.level == "error") {
trace("ERROR: local connection failed to send the message.");
}
}
}
}