S2Laszloもどき 利用方法
とりあえず、まずは使い方。下のがサンプルです。
私の方はイベントに記述して使います。
<?xml version="1.0" encoding="UTF-8"?> <!-- u1h/s2laszlomodokisample.lzx --> <canvas debug="true"> <include href="s2laszlomodoki.lzx"/> <resource name="waitcursor" src="../lps/components/redmond/resources/lzwaitcursor_rsc.swf"/> <button name="button1">ボタン <attribute name="result" value="null"/> <attribute name="_clicked" type="boolean" value="false"/> <method event="onclick"> // 貧弱なダブルクリック処理 if( this._clicked ) { return; } this._clicked = true; LzCursor.setCursorGlobal('waitcursor'); var service = new s2laszlomodoki(); service.target="sample"; // diconに記載の名前 service.method="hello"; // メソッド名 service.resultObject=this; // 結果を格納したいオブジェクト service.resultAttribute="result";// オブジェクトのどのattribute service.invoke(null); // とりあえず、引数なしで実行 </method> <method event="oninit"> // resultにデータが入ったらshowResultを実行されるようにする var check = new LzDelegate(this, "showResult"); check.register(this, "onresult"); </method> <method name="showResult"> LzCursor.unlock(); this._clicked = false; Debug.write("結果:" + this.result ); </method> </button> </canvas>
とりあえずはこんな感じなのですが、こんなのいやだ!!、こんな感じがいいってのがあったら教えてください。
あと、下記のことは実装しようと思っていますので・・・
- データ取得イベント
- エラーイベント
- データ取得後、指定のメソッドを実行
- エラー時に、指定のメソッドを実行