In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

右クリックとホイールクリック

@see http://wakuworks.jugem.jp/?eid=22
* @see http://help.adobe.com/ja_JP/AIR/1.5/jslr/flash/net/LocalConnection.html
Get Adobe Flash player
by osamX 15 Nov 2009
/**
 * Copyright osamX ( http://wonderfl.net/user/osamX )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4LeH
 */

/**
 * @see http://wakuworks.jugem.jp/?eid=22
 * @see http://help.adobe.com/ja_JP/AIR/1.5/jslr/flash/net/LocalConnection.html
 */

package
{
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.net.URLRequest;
	import flash.text.TextField;
	
	public class MouseTest extends Sprite 
	{
		private var lc:LocalConnectionEx;
		
		public function MouseTest():void 
		{
			var tf:TextField = new TextField();
			tf.width = 200;
			tf.height = 465;
			tf.text = "右クリック、ホイールクリックしてみてね\n";
			addChild(tf);
			
			var loader:Loader = new Loader();
			var request:URLRequest = new URLRequest("http://flash-scope.com/wonderfl/ClickTest/mouse.swf");
			loader.load(request);
			
			lc = new LocalConnectionEx();
			lc.allowDomain('*');
			lc.connect("_wonderflconnection");
			
			lc.leftDown = function():void {
				tf.appendText("LeftDown\n");
			};
			lc.leftUp = function():void {
				tf.appendText("LeftUp\n");
			};
			lc.rightDown = function():void {
				tf.appendText("RightDown\n");
			};
			lc.rightUp = function():void {
				tf.appendText("RightUp\n");
			};
			lc.wheelDown = function():void {
				tf.appendText("WheelDown\n");
			};
			lc.wheelUp = function():void {
				tf.appendText("WheelUp\n");
			};
			
		}
		
	}
	
}

import flash.net.LocalConnection; 
dynamic class LocalConnectionEx extends LocalConnection  
{
}

/*=======================================================
   mouse.swf [AS2]
=======================================================*/
/*
var lc:LocalConnection = new LocalConnection();
var cl:Boolean = false, pl:Boolean = false;
var cr:Boolean = false, pr:Boolean = false;
var cw:Boolean = false, pw:Boolean = false;
var ch:String = "_wonderflconnection";

onEnterFrame = function() {
	cl  = cr = cw = false;
	
	//Down
	if(Key.isDown(1)){
			cl = true;
			if (!pl && cl) lc.send(ch, "leftDown");
	}
	if(Key.isDown(2)){
			cr = true;
			if (!pr && cr) lc.send(ch, "rightDown");
	}
	if(Key.isDown(4)){
			cw = true;
			if (!pw&& cw) lc.send(ch, "wheelDown");
	}
	
	//Up
	if (pl && !cl) lc.send(ch, "leftUp");
	if (pr && !cr) lc.send(ch, "rightUp");
	if (pw && !cw) lc.send(ch, "wheelUp");
	
	pl = cl;
	pr = cr;
	pw = cw;
}
*/