グローバル関数 Class
Methods
addChild
(
public
-
expression
Stageに子 DisplayObject インスタンスを追加します。
Parameters:
-
expression
Object追加される DisplayObject インスタンスです。
Example:
var backLayer = LSprite();
addChild(backLayer);
getTimer
()
Float
public
ライブラリの初期化終わってからの経過時間をミリ秒単位で返します。
Returns:
Float:
ライブラリの初期化終わってからの経過時間。
LExtends
(
public
-
child
-
parent
-
params
オブジェクトの継承。base と同等。
Parameters:
-
child
LDisplayObject子供オブジェクト。
-
parent
Object親オブジェクト。
-
params
Arrayパラメータ。
Example:
LInit(50, "legend", 800, 480, main);
function FatherClass(){
this.name = "Father";
}
FatherClass.prototype.getName = function(){
return this.name;
};
function ChildClass(){
LExtends(this,FatherClass,[]);
this.name = "Child";
}
function main () {
LGlobal.setDebug(true);
var father = new FatherClass();
var child = new ChildClass();
trace("father.getName() = " + father.getName()); //father.getName() = Father
trace("child.getName() = " + child.getName());//child.getName() = Child
}
LInit
(
public
-
speed
-
divid
-
width
-
height
-
callback
-
type
ライブラリの初期化。init と同等。
Parameters:
-
speed
Floatゲームスピード(单位:ミリ秒), FPS = 1000 / speed。
-
divid
Stringdivタブのid,ライブラリの初期化をする時,自動的にこのdivタブの中にcanvasを生成する。
-
width
Intゲーム画面の幅。
-
height
Intゲーム画面の高さ。
-
callback
Functionライブラリの初期化が終わったら,この関数を呼び出す。
-
type
Stringライブラリの初期化がwindow.onloadの後にしたら,このパラメータをLEvent.INITに設定しなければなりません。
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="../lufylegend-x.x.x.min.js"></script>
<title>demo</title>
</head>
<body>
<div id="mylegend">loading……</div>
<script>
LInit(50,"mylegend",800,480,main);
//window.onload = function(){LInit(50, "mylegend", 800, 480, main, LEvent.INIT);};
function main(){
alert("Hello lufylegend!");
}
</script>
</body>
</html>
removeChild
(
public
-
expression
Stage インスタンスの子リストから指定の child DisplayObject インスタンスを削除します。
Parameters:
-
expression
Object削除する DisplayObject インスタンスです。
Example:
var backLayer = LSprite();
addChild(backLayer);
removeChild(backLayer);
trace
(
public
-
expression
Debugモード を使用すると、trace() 関数の出力を取得し、その結果を表示できます。trace ステートメント内の引数に String 以外のデータ型が含まれる場合、trace 関数はそのデータ型に関連した toString() メソッドを呼び出します。たとえば、引数がブール値の場合、trace 関数は Boolean.toString() を呼び出して戻り値を表示します。
Parameters:
-
expression
Object評価する式。expression パラメータの値が [出力] パネルに表示されます。
Example:
trace("debug text 1", "debug text 2", "debug text 3");