API Docs for: 最后更新日期:2014年8月25日
Google搜索   
Show:

LShape Class

Defined in: display/LShape.js:1

Available since 1.8.5

新しい LShape オブジェクトを作成します。 LShape クラスには、LGraphics クラスからメソッドにアクセスできる graphics プロパティがあります。

Constructor

LShape

() public

Defined in display/LShape.js:1

Available since 1.8.5

Example:

LInit(50, "legend", 800, 480, main);
function main () {
    var shape = new LShape();
    addChild(shape);
    shape.graphics.drawRect(2, "#ff0000", [10, 10, 50, 100], true, "#880088");
}

Methods

addEventListener

(
  • type
  • listener
)
public

Inherited from LEventDispatcher: events/LEventDispatcher.js:16

Available since 1.8.0

イベントリスナーオブジェクトを LEventDispatcher オブジェクトに登録し、リスナーがイベントの通知を受け取るようにします。イベントリスナーは、特定のタイプのイベント、段階、および優先度に関する表示リスト内のすべてのノードに登録できます。

イベントリスナーが正常に登録された後に、addEventListener() をさらに呼び出して優先度を変更することはできません。リスナーの優先度を変更するには、最初に removeListener() を呼び出す必要があります。その後、同じリスナーを新しい優先度レベルで再度登録できます。

イベントリスナーが不要になった場合は、removeEventListener() を呼び出して、イベントリスナーを削除します。削除しない場合、メモリの問題が発生する可能性があります。

Parameters:

  • type String

    イベントのタイプです。

  • listener Function

    イベントを処理するリスナー関数です。

callParent

(
  • functionName
  • arguments
)
public

Inherited from LObject: main/LObject.js:22

Available since 1.6.0

親クラスの関数を呼び出す。

Parameters:

  • functionName String

    函数名

  • arguments Array

    固定値arguments

Example:

function funA(){
    LExtends(this,LObject,[]);
}
funA.prototype.myName = function(){
    return "AAA";
}
function funB(){
    LExtends(this,funA,[]);
}
funB.prototype.myName = function(){
    return "BBB";
}
function funC(){
    LExtends(this,funA,[]);
}
funC.prototype.myName = function(){
    return this.callParent("myName",arguments);
}
LInit(1000/50,"legend",800,150,main);
function main(){
    LGlobal.setDebug(true);
    var objB = new funB();
    trace(objB.myName());//BBB
    var objC = new funC();
    trace(objC.myName());//AAA
}

clone

() LShape public

Defined in display/LShape.js:136

Available since 1.8.5

新しい LShape オブジェクトとして、元のインスタンスのクローンを返します。オブジェクトはまったく同じコピーになります。

Returns:

LShape:

元のオブジェクトと同一の新しい LShape オブジェクトです。

Example:

var shape = new LShape();
addChild(shape);
shape.graphics.drawRect(2, "#ff0000", [10, 10, 50, 100], true, "#880088");
shape.graphics.drawRect(2, "#ff0000", [20, 10, 110, 70], true, "#888888");
var shape02 = shape.clone();
shape02.y = 150;
addChild(shape02);

die

() public

Defined in display/LShape.js:178

Available since 1.8.5

使ったメモリをクリアする。

dispatchEvent

(
  • event
)
Boolean public

Inherited from LEventDispatcher: events/LEventDispatcher.js:59

Available since 1.8.0

イベントをイベントフローに送出します。イベントターゲットは LEventDispatcher オブジェクトです。これに対して dispatchEvent() メソッドが呼び出されます。

Parameters:

  • event LEvent | String

    イベントフローに送出されるイベントオブジェクトです。イベントが再度送出されると、イベントのクローンが自動的に作成されます。イベントが送出された後にそのイベントの target プロパティは変更できないため、再送出処理のためにはイベントの新しいコピーを作成する必要があります。

Returns:

Boolean:

値が true の場合、イベントは正常に送出されました。 function MyEventObject(){ var self = this; LExtends(self,LSprite,[]); self.graphics.drawRect(1,"#000000",[0,0,100,100],true,"#000000"); self.graphics.drawRect(1,"#FF0000",[100,0,100,100],true,"#FF0000"); self.addEventListener(LMouseEvent.MOUSE_UP,self.onclick); self.addEventListener(MyEventObject.CLICK_LEFT,function(event){ trace("dispatchEvent"); }); self.addEventListener(MyEventObject.CLICK_RIGHT,function(event){ trace("dispatchEvent event.name = " + event.name); }); } MyEventObject.CLICK_LEFT = "click_left"; MyEventObject.CLICK_RIGHT = "click_right"; MyEventObject.prototype.onclick = function(event){ var self = event.clickTarget; if(event.selfX < 100){ self.dispatchEvent(MyEventObject.CLICK_LEFT); }else{ var event = new LEvent(MyEventObject.CLICK_RIGHT); event.name = "LEvent Test"; self.dispatchEvent(event); } }

getBounds

(
  • targetCoordinateSpace
)
LRectangle public

Inherited from LDisplayObject: display/LDisplayObject.js:258

Available since 1.7.7

targetCoordinateSpace オブジェクトの座標系を基準にして、表示オブジェクトの領域を定義する矩形を返します。

Parameters:

  • targetCoordinateSpace LDisplayObject

    使用する座標系を定義する表示オブジェクトです。

Returns:

LRectangle:

targetCoordinateSpace オブジェクトの座標系を基準とする、表示オブジェクトの領域を定義する矩形です。

getDataURL

() Base64 Image public

Inherited from LDisplayObject: display/LDisplayObject.js:306

Available since 1.7.7

base64でエンコードされた画像の文字列を取得する。

Returns:

Base64 Image:

base64でエンコードされた画像の文字列。

getHeight

() Float public

Defined in display/LShape.js:87

Available since 1.8.5

表示オブジェクトの高さを取得します(ピクセル単位)。

Returns:

Float:

オブジェクトの高さ。

Example:

var shape = new LShape();
addChild(shape);
shape.graphics.drawRect(2, "#ff0000", [10, 10, 50, 100], true, "#880088");
shape.graphics.drawRect(2, "#ff0000", [20, 10, 110, 70], true, "#888888");
trace("height : " + shape.getHeight());

getRootCoordinate

() LPoint public

Inherited from LDisplayObject: display/LDisplayObject.js:237

Available since 1.7.7

canvasの左上からの座標を取得する。

Returns:

LPoint:

LPointプロジェクット。

getWidth

() Float public

Defined in display/LShape.js:56

Available since 1.8.5

表示オブジェクトの幅を取得します(ピクセル単位)。

Returns:

Float:

オブジェクトの幅。

Example:

var shape = new LShape();
addChild(shape);
shape.graphics.drawRect(2, "#ff0000", [10, 10, 50, 100], true, "#880088");
shape.graphics.drawRect(2, "#ff0000", [20, 10, 110, 70], true, "#888888");
trace("width : " + shape.getWidth());

hasEventListener

(
  • type
)
Boolean public

Inherited from LEventDispatcher: events/LEventDispatcher.js:122

Available since 1.8.0

LEventDispatcher オブジェクトに、特定のイベントタイプに対して登録されたリスナーがあるかどうかを確認します。これにより、LEventDispatcher オブジェクトがイベントタイプの処理をイベントフロー階層のどこで変更したかを判断できます。

Parameters:

  • type String

    イベントのタイプです。

Returns:

Boolean:

指定したタイプのリスナーが登録されている場合は true、それ以外の場合は false です。

remove

() public

Inherited from LDisplayObject: display/LDisplayObject.js:379

Available since 1.7.7

オブジェクト自体は、親コンテナから除去される。

removeAllEventListener

() public

Inherited from LEventDispatcher: events/LEventDispatcher.js:50

Available since 1.8.0

LEventDispatcher オブジェクトから全部のリスナーを削除します。

removeEventListener

(
  • type
  • listener
)
public

Inherited from LEventDispatcher: events/LEventDispatcher.js:29

Available since 1.8.0

LEventDispatcher オブジェクトからリスナーを削除します。対応するリスナーが LEventDispatcher オブジェクトに登録されていない場合は、このメソッドを呼び出しても効果はありません。

Parameters:

  • type String

    イベントのタイプです。

  • listener Function

    削除するリスナーオブジェクトです。

Properties

alpha

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:55

Available since 1.6.0

指定されたオブジェクトのアルファ透明度値を示します。有効な値は 0(完全な透明)~ 1(完全な不透明)です。デフォルト値は 1 です。alpha が 0 に設定されている表示オブジェクトは、表示されない場合でも、アクティブです。

Default: 0

blendMode

String public

Inherited from LDisplayObject: display/LDisplayObject.js:91

Available since 1.8.0

使用するブレンドモードを指定する LBlendMode クラスの値です。内部的には、2 つの方法でビットマップを描画できます。ブレンドモードを有効にした場合、または外部クリッピングマスクを使用する場合には、ビットマップで塗りつぶされた四角形シェイプをベクターレンダーに追加することによってビットマップが描画されます。このプロパティを無効な値に設定しようとすると、ランタイムは値を LBlendMode.NORMAL に設定します。

Default: null

filters

Array public

Inherited from LDisplayObject: display/LDisplayObject.js:100

Available since 1.6.0

表示オブジェクトに現在関連付けられている各フィルターオブジェクトが格納されているインデックス付きの配列です。

Default: null

graphics

LGraphics public

Defined in display/LShape.js:31

Available since 1.8.5

[読み取り専用] ベクターの描画コマンドが発生するこのスプライトに属する LGraphics オブジェクトを指定します。

Example:

var shape = new LShape();
addChild(shape);
shape.graphics.drawRect(2, "#ff0000", [10, 10, 50, 100], true, "#880088");

mask

LDisplayObject public

Inherited from LDisplayObject: display/LDisplayObject.js:82

Available since 1.6.0

呼び出し元の表示オブジェクトは、指定された mask オブジェクトによってマスクされます。ステージの拡大および縮小時にマスクが確実に機能するためには、表示リストのアクティブな部分に mask 表示オブジェクトが含まれている必要があります。mask オブジェクト自体は描画されません。マスクを除去するには mask を null に設定します。

Default: null

mouseEnabled

Boolean public

Inherited from LInteractiveObject: display/LInteractiveObject.js:14

Available since 1.8.10

このオブジェクトでマウスまたはその他のユーザー入力メッセージを受け取るかどうかを指定します。デフォルト値は true であり、これは表示リスト上の LInteractiveObject インスタンスがデフォルトでマウスイベントまたはその他のユーザー入力イベントを受け取ることを意味します。mouseEnabled を false に設定すると、インスタンスでは、マウスイベント(またはキーボードイベントなど、その他のユーザー入力イベント)を一切受け取りません。表示リスト上のこのインスタンスの子は影響を受けません。表示リスト上のオブジェクトのすべての子に関する mouseEnabled 動作を変更するには、LDisplayObjectContainer.mouseChildren を使用します。

Example:

LGlobal.setDebug(true);
var button01 = new LButtonSample1("mouseEnabled=true");
button01.x = button01.y = 20;
addChild(button01);
button01.addEventListener(LMouseEvent.MOUSE_DOWN,function(e){
    trace("button01 click");
});
var button02 = new LButtonSample1("mouseEnabled=false");
button02.x = 20;
button02.y = 150;
button02.mouseEnabled = false;
addChild(button02);
button02.addEventListener(LMouseEvent.MOUSE_DOWN,function(e){
    trace("button02 click");
});

objectIndex

Int public

Inherited from LObject: main/LObject.js:11

Available since 1.6.0

オブジェクトのID

rotate

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:73

Available since 1.6.0

LDisplayObject インスタンスの元の位置からの回転角を度単位で示します。時計回りに回転させる場合は 0 ~ 180 の値を指定します。反時計回りに回転させる場合は 0 ~ -180 の値を指定します。この範囲を超える値は、360 を加算または減算して、範囲内に収まる値になるように調整されます。例えば、my_video.rotate = 450 というステートメントは my_video.rotate = 90 と同義です。

Default: 0

scaleX

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:37

Available since 1.6.0

基準点から適用されるオブジェクトの水平スケール(パーセンテージ)を示します。 デフォルトの基準点は (0,0) です。1.0 は縮尺 100% と同等です。

Default: 1

scaleY

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:46

Available since 1.6.0

オブジェクトの基準点から適用されるオブジェクトの垂直スケール(パーセンテージ)を示します。 デフォルトの基準点は (0,0) です。1.0 は縮尺 100% です。

Default: 1

type

String public

Defined in display/LShape.js:22

Available since 1.8.5

オブジェクトのタイプ

Default: LShape

visible

Boolean public

Inherited from LDisplayObject: display/LDisplayObject.js:64

Available since 1.6.0

表示オブジェクトが可視かどうかを示します。非可視の表示オブジェクトは無効になります。例えば、ある LInteractiveObject インスタンスが visible=false に設定されている場合、これをクリックすることはできません。

Default: true

x

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:17

Available since 1.6.0

親 LDisplayObjectContainer のローカル座標を基準にした LDisplayObject インスタンスの x 座標を示します。変形されている LDisplayObjectContainer にオブジェクトが含まれる場合、そのオブジェクトの座標系は、それを囲む LDisplayObjectContainer のローカル座標系になります。したがって、反時計回りに 90 度回転した LDisplayObjectContainer の場合、その LDisplayObjectContainer の子は、反時計回りに 90 度回転した座標系を継承します。オブジェクトの座標は、基準点の位置を参照します。

Default: 0

y

Float public

Inherited from LDisplayObject: display/LDisplayObject.js:26

Available since 1.6.0

親 LDisplayObjectContainer のローカル座標を基準にした LDisplayObject インスタンスの y 座標を示します。変形されている LDisplayObjectContainer にオブジェクトが含まれる場合、そのオブジェクトの座標系は、それを囲む LDisplayObjectContainer のローカル座標系になります。したがって、反時計回りに 90 度回転した LDisplayObjectContainer の場合、その LDisplayObjectContainer の子は、反時計回りに 90 度回転した座標系を継承します。オブジェクトの座標は、基準点の位置を参照します。

Default: 0

Events

LEvent.ENTER_FRAME

Inherited from LDisplayObject but overwritten in display/LShape.js:194

利用不可。

LMouseEvent.DOUBLE_CLICK

Inherited from LInteractiveObject but overwritten in display/LShape.js:218

利用不可。

LMouseEvent.MOUSE_DOWN

Inherited from LInteractiveObject but overwritten in display/LShape.js:198

利用不可。

LMouseEvent.MOUSE_MOVE

Inherited from LInteractiveObject but overwritten in display/LShape.js:206

利用不可。

LMouseEvent.MOUSE_OUT

Inherited from LInteractiveObject but overwritten in display/LShape.js:210

利用不可。

LMouseEvent.MOUSE_OVER

Inherited from LInteractiveObject but overwritten in display/LShape.js:214

利用不可。

LMouseEvent.MOUSE_UP

Inherited from LInteractiveObject but overwritten in display/LShape.js:202

利用不可。