ホームに戻る(Kyoroの部屋)
PHPだぜ(Ming)に戻る

DragAndMoveを追加する

spriteを使うで作成したクラスにマウスの操作にあわせて オブジェクトが移動するの機能を追加します。

require "Primitive.php";

class PrimitiveWithDrag extends Primitive
{

function _layer()
	{
	$this->_layer = new SWFSprite();
	$this->_controller = $this->_layer->add($this->_object);
	$this->_controller->setName("primitive");
	$this->_controller->moveTo(100,100);
	$this->_layer->nextFrame();
	$this->_layer->add(
	new SWFAction(
	" primitive.onPress=function(){ this.startDrag('');};
	  primitive.onRelease=function(){ stopDrag();};"
	));
	}
}

実行結果(swfファイル)
上記のソースは 重宝しているさいと を参考にして書きました。

Gポイントポイ活 Amazon Yahoo 楽天

無料ホームページ 楽天モバイル[UNLIMITが今なら1円] 海外格安航空券 海外旅行保険が無料!