dango_generator 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/templates/as3/org/rubyforge/dango/DangoClientFramework.as +189 -159
- data/templates/as3/org/rubyforge/dango/DangoError.as +7 -7
- data/templates/as3/org/rubyforge/dango/DangoErrorCode.as +5 -5
- data/templates/as3/org/rubyforge/dango/DangoErrorEvent.as +20 -20
- data/templates/as3/org/rubyforge/dango/DangoReceiveEvent.as +22 -22
- data/templates/as3/org/rubyforge/dango/DangoURLLoader.as +125 -118
- data/templates/as3/org/rubyforge/dango/DangoURLLoaderEvent.as +24 -24
- data/templates/as3/org/rubyforge/dango/DangoUtil.as +129 -102
- metadata +2 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
package org.rubyforge.dango {
|
3
3
|
/**
|
4
4
|
* Dangoのクライアントフレームワーク本体のクラス
|
@@ -41,15 +41,12 @@ package org.rubyforge.dango {
|
|
41
41
|
private var delay_send_timer_msec:uint = 1500; // 遅延送信用のタイマーのミリ秒
|
42
42
|
private var delay_send_cache:Array = []; // 遅延送信用のキャッシュ
|
43
43
|
|
44
|
-
private var
|
45
|
-
private var
|
46
|
-
|
47
|
-
private var
|
48
|
-
private var recv_not_yet_str:String = ""; // データ受信時のキャッシュデータ
|
44
|
+
private var receive_cache_byta:ByteArray = new ByteArray; // 受信データの保管用のキャッシュ ByteArray
|
45
|
+
private var receive_cache_do_phase:uint = 0; // 受信データをどこまで処理してあるかのキャッシュ
|
46
|
+
private var receive_encode_type:uint = 0; // 受信データのエンコードタイプ
|
47
|
+
private var receive_data_size:uint = 0; // 受信データのデータサイズ
|
49
48
|
|
50
49
|
private var recv_wait_do_cache:Array = []; // 実行待ち受信キャッシュ
|
51
|
-
private var recv_cache_timer_msec:uint; // 受信キャッシュ用タイマーの実行間隔
|
52
|
-
private var recv_cache_timer:Timer; // 受信キャッシュ用タイマーの追加
|
53
50
|
|
54
51
|
private var recv_do_count_no:uint = 0; // 受信実行の回数
|
55
52
|
private var recv_do_timer_msec:uint; // 受信実行用タイマーの実行間隔
|
@@ -67,8 +64,12 @@ package org.rubyforge.dango {
|
|
67
64
|
public var sid:int;
|
68
65
|
|
69
66
|
/**
|
67
|
+
* DangoClientFramework
|
70
68
|
* コンストラクタ
|
71
69
|
*
|
70
|
+
* @param config:*
|
71
|
+
* @param disp_obj:DisplayObject = null
|
72
|
+
* @return void
|
72
73
|
*/
|
73
74
|
public function DangoClientFramework(config:*, disp_obj:DisplayObject = null){
|
74
75
|
// is_debug = d; // Debugモードかどうかのフラグ
|
@@ -149,13 +150,6 @@ package org.rubyforge.dango {
|
|
149
150
|
delay_send_timer.addEventListener(TimerEvent.TIMER, delay_send_callback); // イベントリスナーの発行
|
150
151
|
delay_send_timer.start(); // タイマーの作動開始
|
151
152
|
|
152
|
-
// 受信キャッシュ用タイマーの設定(4フレームごとに動かすよう変更)
|
153
|
-
recv_cache_timer_msec = uint((1000 * 4) / frame_rate);
|
154
|
-
if(is_debug){ trace("DangoClientFramework:recv_cache_timer_msec:" + recv_cache_timer_msec); }
|
155
|
-
recv_cache_timer = new Timer(recv_cache_timer_msec, 0); // タイマーの追加
|
156
|
-
recv_cache_timer.addEventListener(TimerEvent.TIMER, recv_cache_callback); // イベントリスナーの発行
|
157
|
-
recv_cache_timer.start(); // タイマーの作動開始
|
158
|
-
|
159
153
|
// 受信実行用タイマーの設定(2フレームごとに動かすよう変更)
|
160
154
|
recv_do_timer_msec = uint((1000 * 2) / frame_rate);
|
161
155
|
if(is_debug){ trace("DangoClientFramework:recv_do_timer_msec:" + recv_do_timer_msec); }
|
@@ -168,14 +162,26 @@ package org.rubyforge.dango {
|
|
168
162
|
this.send_action("_notice_heart_beat", { "_hb_id": hb_id}, true); // ハートビート送信
|
169
163
|
}
|
170
164
|
|
171
|
-
|
165
|
+
/**
|
166
|
+
* connectHandler
|
167
|
+
* 接続イベントの処理
|
168
|
+
*
|
169
|
+
* @param evt:Event
|
170
|
+
* @return void
|
171
|
+
*/
|
172
172
|
private function connectHandler(evt:Event):void {
|
173
173
|
is_connect = true;
|
174
174
|
var msg:String = "DangoClientFramework:connectHandler:" + DangoUtil.now2str();
|
175
175
|
if(is_debug){ trace(msg); }
|
176
176
|
}
|
177
177
|
|
178
|
-
|
178
|
+
/**
|
179
|
+
* closeHandler
|
180
|
+
* 切断イベントの処理
|
181
|
+
*
|
182
|
+
* @param evt:Event
|
183
|
+
* @return void
|
184
|
+
*/
|
179
185
|
private function closeHandler(evt:Event):void {
|
180
186
|
// タイマーが動いていれば止める
|
181
187
|
if(polling_timer != null && polling_timer.running){ polling_timer.stop(); }
|
@@ -186,7 +192,13 @@ package org.rubyforge.dango {
|
|
186
192
|
this.dispatchEvent(new DangoErrorEvent("DangoError", DangoErrorCode.CloseError, msg));
|
187
193
|
}
|
188
194
|
|
189
|
-
|
195
|
+
/**
|
196
|
+
* securityErrorHandler
|
197
|
+
* セキュリティエラーイベントの処理
|
198
|
+
*
|
199
|
+
* @param evt:Event
|
200
|
+
* @return void
|
201
|
+
*/
|
190
202
|
private function securityErrorHandler(evt:SecurityErrorEvent):void {
|
191
203
|
// タイマーが動いていれば止める
|
192
204
|
if(polling_timer != null && polling_timer.running){ polling_timer.stop(); }
|
@@ -198,7 +210,13 @@ package org.rubyforge.dango {
|
|
198
210
|
this.dispatchEvent(new DangoErrorEvent("DangoError", DangoErrorCode.SecurityError, msg));
|
199
211
|
}
|
200
212
|
|
201
|
-
|
213
|
+
/**
|
214
|
+
* ioErrorHandler
|
215
|
+
* IOエラーイベントの処理
|
216
|
+
*
|
217
|
+
* @param evt:Event
|
218
|
+
* @return void
|
219
|
+
*/
|
202
220
|
private function ioErrorHandler(evt:IOErrorEvent):void {
|
203
221
|
// タイマーが動いていれば止める
|
204
222
|
if(polling_timer != null && polling_timer.running){ polling_timer.stop(); }
|
@@ -209,73 +227,182 @@ package org.rubyforge.dango {
|
|
209
227
|
this.dispatchEvent(new DangoErrorEvent("DangoError", DangoErrorCode.IOError, msg));
|
210
228
|
}
|
211
229
|
|
212
|
-
|
213
|
-
|
230
|
+
/**
|
231
|
+
* socketDataHandler
|
232
|
+
* プログレスイベントの処理:実体はsocket_read_push_cache
|
233
|
+
*
|
234
|
+
* @param evt:Event
|
235
|
+
* @return void
|
236
|
+
*/
|
214
237
|
private function socketDataHandler(evt:ProgressEvent):void {
|
215
|
-
|
216
|
-
if(is_debug){ trace("DangoClientFramework:socketDataHandler:" + receve_count + ":start:" + DangoUtil.now2str()); }
|
217
|
-
var byte_array:ByteArray = new ByteArray;
|
218
|
-
socket.readBytes(byte_array, 0, socket.bytesAvailable);
|
219
|
-
receive_row_cache.push([byte_array, receve_count]);
|
238
|
+
socket_read_push_cache();
|
220
239
|
}
|
221
240
|
|
222
|
-
|
241
|
+
/**
|
242
|
+
* addEventListener
|
243
|
+
* Event送出用
|
244
|
+
*
|
245
|
+
* @param type:String
|
246
|
+
* @param listener:Function
|
247
|
+
* @param useCapture:Boolean = false
|
248
|
+
* @param priority:int = 0
|
249
|
+
* @param useWeakReference:Boolean = false
|
250
|
+
* @return void
|
251
|
+
*/
|
223
252
|
public function addEventListener(type:String, listener:Function,
|
224
253
|
useCapture:Boolean = false,
|
225
254
|
priority:int = 0,
|
226
255
|
useWeakReference:Boolean = false):void{
|
227
256
|
dispatcher.addEventListener(type, listener, useCapture, priority);
|
228
257
|
}
|
258
|
+
|
259
|
+
/**
|
260
|
+
* dispatchEvent
|
261
|
+
* Event送出用
|
262
|
+
*
|
263
|
+
* @param evt:Event
|
264
|
+
* @return Boolean
|
265
|
+
*/
|
229
266
|
public function dispatchEvent(evt:Event):Boolean{
|
230
267
|
return dispatcher.dispatchEvent(evt);
|
231
268
|
}
|
269
|
+
|
270
|
+
/**
|
271
|
+
* hasEventListener
|
272
|
+
* Event送出用
|
273
|
+
*
|
274
|
+
* @param type:String
|
275
|
+
* @return Boolean
|
276
|
+
*/
|
232
277
|
public function hasEventListener(type:String):Boolean{
|
233
278
|
return dispatcher.hasEventListener(type);
|
234
279
|
}
|
280
|
+
|
281
|
+
/**
|
282
|
+
* removeEventListener
|
283
|
+
* Event送出用
|
284
|
+
*
|
285
|
+
* @param type:String
|
286
|
+
* @param listener:Function
|
287
|
+
* @param useCapture:Boolean = false
|
288
|
+
* @return void
|
289
|
+
*/
|
235
290
|
public function removeEventListener(type:String, listener:Function,
|
236
291
|
useCapture:Boolean = false):void{
|
237
292
|
dispatcher.removeEventListener(type, listener, useCapture);
|
238
293
|
}
|
294
|
+
|
295
|
+
/**
|
296
|
+
* willTrigger
|
297
|
+
* Event送出用
|
298
|
+
*
|
299
|
+
* @param type:String
|
300
|
+
* @return Boolean
|
301
|
+
*/
|
239
302
|
public function willTrigger(type:String):Boolean {
|
240
303
|
return dispatcher.willTrigger(type);
|
241
304
|
}
|
242
305
|
|
243
|
-
|
244
306
|
/**
|
245
|
-
*
|
246
|
-
*
|
307
|
+
* socket_read_push_cache
|
308
|
+
* socketDataHandlerの実体処理
|
309
|
+
* データ受信、データのパース、実行待ちキャッシュに保存
|
247
310
|
*
|
248
|
-
* @param
|
311
|
+
* @param void
|
249
312
|
* @return void
|
250
313
|
*/
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
314
|
+
private function socket_read_push_cache():void{
|
315
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:" + DangoUtil.now2str()); }
|
316
|
+
|
317
|
+
var crlf:String = "";
|
318
|
+
var temp_byta:ByteArray = new ByteArray;
|
319
|
+
|
320
|
+
socket.readBytes(receive_cache_byta, receive_cache_byta.length, socket.bytesAvailable); // データ読み込み
|
321
|
+
|
322
|
+
while(true){
|
323
|
+
// 長さ取得処理
|
324
|
+
if(receive_cache_do_phase == 0){
|
325
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 0:" + DangoUtil.now2str()); }
|
326
|
+
if(receive_cache_byta.length < 6){ break; } // 長さの読み込みが終わっていなければ
|
327
|
+
|
328
|
+
try{
|
329
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 0:start read"); }
|
330
|
+
receive_encode_type = receive_cache_byta.readByte(); // エンコードタイプ
|
331
|
+
receive_data_size = receive_cache_byta.readUnsignedInt(); // データサイズ
|
332
|
+
crlf = receive_cache_byta.readUTFBytes(1);
|
333
|
+
|
334
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_encode_type=" + receive_encode_type); }
|
335
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_data_size=" + receive_data_size); }
|
336
|
+
|
337
|
+
// receive_cache_bytaの不要な部分を削除
|
338
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:length=" + receive_cache_byta.length); }
|
339
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:position=" + receive_cache_byta.position); }
|
340
|
+
|
341
|
+
if(receive_cache_byta.length - receive_cache_byta.position > 0){
|
342
|
+
receive_cache_byta.readBytes(temp_byta, 0, receive_cache_byta.length - receive_cache_byta.position);
|
343
|
+
receive_cache_byta = temp_byta;
|
344
|
+
receive_cache_byta.position = 0;
|
345
|
+
} else {
|
346
|
+
receive_cache_byta = new ByteArray;
|
347
|
+
}
|
348
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 0:end read:length=" + receive_cache_byta.length); }
|
349
|
+
|
350
|
+
} catch(err:Error){
|
351
|
+
this.dispatchEvent(new DangoErrorEvent("DangoError", DangoErrorCode.IOError, "failed in DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 0"));
|
352
|
+
break;
|
353
|
+
}
|
354
|
+
|
355
|
+
receive_cache_do_phase = 1;
|
356
|
+
}
|
261
357
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
358
|
+
// データ取得処理
|
359
|
+
if(receive_cache_do_phase == 1){
|
360
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 1:" + DangoUtil.now2str()); }
|
361
|
+
if(receive_cache_byta.length < receive_data_size){ break; } // データの読み込みが終わっていなければ
|
362
|
+
|
363
|
+
try{
|
364
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 1:start read"); }
|
365
|
+
var recv_data:String = receive_cache_byta.readUTFBytes(receive_data_size); // データ取得
|
366
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:recv_data=" + recv_data); }
|
367
|
+
|
368
|
+
// データのパースと実行待ち受信キャッシュにデータを入れる
|
369
|
+
var ret_obj_data:Array;
|
370
|
+
if(recv_data != "" && recv_data != "\n"){ // データが空じゃないならdecode
|
371
|
+
ret_obj_data = JSON.decode(recv_data) as Array;
|
372
|
+
for(var i:uint = 0; i < ret_obj_data.length; i++){
|
373
|
+
var notice_name:String = ret_obj_data[i]["notice"];
|
374
|
+
var recv_server_time:String = ret_obj_data[i]["server_time"];
|
375
|
+
|
376
|
+
if(is_debug){ trace("DangoClientFramework:push recv_wait_do_cache:dango_" + notice_name + " i=" + i + " recv_server_time=" + recv_server_time); }
|
377
|
+
recv_wait_do_cache.push([notice_name, ret_obj_data[i], recv_server_time, recv_do_count_no]);
|
378
|
+
recv_do_count_no ++;
|
379
|
+
if(is_debug){ trace("DangoClientFramework:pushed recv_wait_do_cache:recv_do_count_no=" + recv_do_count_no); }
|
380
|
+
}
|
381
|
+
} else { // データが空なら空データを作ってreturn
|
382
|
+
if(is_debug){ trace("DangoClientFramework:ret_obj_data is empty." + DangoUtil.now2str()); }
|
383
|
+
}
|
384
|
+
|
385
|
+
// receive_cache_bytaの不要な部分を削除
|
386
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:length=" + receive_cache_byta.length); }
|
387
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:position=" + receive_cache_byta.position); }
|
388
|
+
|
389
|
+
if(receive_cache_byta.length - receive_cache_byta.position > 0){
|
390
|
+
receive_cache_byta.readBytes(temp_byta, 0, receive_cache_byta.length - receive_cache_byta.position);
|
391
|
+
receive_cache_byta = temp_byta;
|
392
|
+
receive_cache_byta.position = 0;
|
393
|
+
} else {
|
394
|
+
receive_cache_byta = new ByteArray;
|
272
395
|
}
|
273
|
-
|
274
|
-
|
275
|
-
|
396
|
+
if(is_debug){ trace("DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 1:end read:length=" + receive_cache_byta.length); }
|
397
|
+
|
398
|
+
} catch(err:Error){
|
399
|
+
this.dispatchEvent(new DangoErrorEvent("DangoError", DangoErrorCode.IOError, "failed in DangoClientFramework:socket_read_push_cache:receive_cache_do_phase == 1"));
|
400
|
+
break;
|
276
401
|
}
|
402
|
+
receive_cache_do_phase = 0;
|
277
403
|
}
|
278
404
|
}
|
405
|
+
|
279
406
|
}
|
280
407
|
|
281
408
|
/**
|
@@ -323,7 +450,7 @@ package org.rubyforge.dango {
|
|
323
450
|
* @return void
|
324
451
|
*/
|
325
452
|
public function polling_callback(evt:TimerEvent):void {
|
326
|
-
if(is_debug){ trace("DangoClientFramework:polling_callback:" + DangoUtil.now2str() ); }
|
453
|
+
// if(is_debug){ trace("DangoClientFramework:polling_callback:" + DangoUtil.now2str() ); }
|
327
454
|
if(socket.connected){
|
328
455
|
// var send_obj:Object = null;
|
329
456
|
// this.send_data_to_server(send_obj);
|
@@ -348,8 +475,7 @@ package org.rubyforge.dango {
|
|
348
475
|
* delay_send_callback
|
349
476
|
* 遅延送信用タイマーコールバック
|
350
477
|
*
|
351
|
-
* @param
|
352
|
-
* @param send_obj:Object
|
478
|
+
* @param evt:TimerEvent
|
353
479
|
* @return void
|
354
480
|
*/
|
355
481
|
public function delay_send_callback(evt:TimerEvent):void {
|
@@ -373,8 +499,9 @@ package org.rubyforge.dango {
|
|
373
499
|
* send data to server.
|
374
500
|
* クライアント側から使うサーバーへのデータ送信メソッド
|
375
501
|
*
|
376
|
-
* @param
|
502
|
+
* @param action_name:String
|
377
503
|
* @param send_obj:Object
|
504
|
+
* @param delay:Boolean=false
|
378
505
|
* @return void
|
379
506
|
*/
|
380
507
|
public function send_action(action_name:String, send_obj:Object, delay:Boolean=false):void {
|
@@ -397,15 +524,14 @@ package org.rubyforge.dango {
|
|
397
524
|
|
398
525
|
// データをすぐ送信
|
399
526
|
this.send_data_to_server([send_obj_dup]);
|
400
|
-
if(is_debug){ trace("DangoClientFramework:send_action:end:" + action_name + ":" + DangoUtil.now2str()); }
|
527
|
+
// if(is_debug){ trace("DangoClientFramework:send_action:end:" + action_name + ":" + DangoUtil.now2str()); }
|
401
528
|
}
|
402
529
|
|
403
530
|
/**
|
404
531
|
* send data to server.
|
405
532
|
* フレームワーク側のデータ送信の一般処理
|
406
533
|
*
|
407
|
-
* @param
|
408
|
-
* @param send_obj:Object
|
534
|
+
* @param send_obj:Array
|
409
535
|
* @return void
|
410
536
|
*/
|
411
537
|
public function send_data_to_server( send_obj:Array ):void {
|
@@ -441,111 +567,15 @@ package org.rubyforge.dango {
|
|
441
567
|
// if(is_debug){ trace("DangoClientFramework:send_obj_str:" + send_obj_str + ":" + DangoUtil.now2str()); }
|
442
568
|
}
|
443
569
|
|
444
|
-
/**
|
445
|
-
* receive data from server.
|
446
|
-
* データ受信のデータのパースなど
|
447
|
-
*
|
448
|
-
* @return Object
|
449
|
-
*/
|
450
|
-
public function parse_notice(byte_array:ByteArray):Array {
|
451
|
-
if(is_debug){ trace("DangoClientFramework:parse_notice:" + DangoUtil.now2str()); }
|
452
|
-
|
453
|
-
// 変数定義
|
454
|
-
var recv_data_orig:String = "";
|
455
|
-
|
456
|
-
// まず読めるデータをすべてByteArrayに入れる
|
457
|
-
// var byte_array:ByteArray = new ByteArray;
|
458
|
-
// socket.readBytes(byte_array, 0, socket.bytesAvailable);
|
459
|
-
|
460
|
-
// 読んだデータの長さ取得
|
461
|
-
var byte_read_size:uint = byte_array.length;
|
462
|
-
|
463
|
-
if(recv_not_yet_size == 0){ // 未受信データが無ければ
|
464
|
-
// if(is_debug){ trace("DangoClientFramework:recv_not_yet_size==0"); }
|
465
|
-
|
466
|
-
if(byte_read_size < 6){ // きちんとデータが届いていなければ
|
467
|
-
this.dispatchEvent(new DangoErrorEvent("DangoError", DangoErrorCode.IOError, "byte_read_size is too short."));
|
468
|
-
return([]);
|
469
|
-
}
|
470
|
-
|
471
|
-
// 長さを取得
|
472
|
-
var byte_array_size:ByteArray = new ByteArray;
|
473
|
-
try{
|
474
|
-
byte_array.readBytes(byte_array_size, 0, 5);
|
475
|
-
} catch(err:Error){
|
476
|
-
this.dispatchEvent(new DangoErrorEvent("DangoError", DangoErrorCode.IOError, "failed to byte_array.readBytes."));
|
477
|
-
return([]);
|
478
|
-
}
|
479
|
-
|
480
|
-
var encode_type:int = byte_array_size.readByte();
|
481
|
-
recv_not_yet_size = byte_array_size.readUnsignedInt();
|
482
|
-
var crlf:String = byte_array.readUTFBytes(1);
|
483
|
-
byte_read_size -= 6;
|
484
|
-
// if(is_debug){ trace("DangoClientFramework:recv_not_yet_size=" + recv_not_yet_size); }
|
485
|
-
}
|
486
|
-
|
487
|
-
// 読めているだけ読んで、その分recv_not_yet_sizeを減らす
|
488
|
-
if(recv_not_yet_size > byte_read_size){
|
489
|
-
// if(is_debug){ trace("DangoClientFramework:byte_read_size=" + byte_read_size); }
|
490
|
-
recv_data_orig = byte_array.readUTFBytes(byte_read_size);
|
491
|
-
recv_not_yet_size -= byte_read_size;
|
492
|
-
}else{
|
493
|
-
// if(is_debug){ trace("DangoClientFramework:recv_not_yet_size=" + recv_not_yet_size); }
|
494
|
-
recv_data_orig = byte_array.readUTFBytes(recv_not_yet_size);
|
495
|
-
recv_not_yet_size = 0;
|
496
|
-
}
|
497
|
-
|
498
|
-
// if(is_debug){ trace("DangoClientFramework:recv_data_orig:" + recv_data_orig); }
|
499
|
-
|
500
|
-
// 全データを受信したかどうかを確認
|
501
|
-
if(recv_not_yet_size == 0){ // 受信完了ならJSONパース
|
502
|
-
var recv_data:String = recv_not_yet_str + recv_data_orig;
|
503
|
-
recv_not_yet_str = "";
|
504
|
-
|
505
|
-
// if(is_debug){ trace("DangoClientFramework:recieve:data=" + ObjectUtil.toString(recv_data)); }
|
506
|
-
|
507
|
-
var ret_obj_data:Array;
|
508
|
-
if(recv_data && recv_data != "" && recv_data != "\n"){ // データが空じゃないならdecode
|
509
|
-
ret_obj_data = JSON.decode(recv_data) as Array;
|
510
|
-
|
511
|
-
} else { // データが空なら空データを作ってreturn
|
512
|
-
return([]);
|
513
|
-
}
|
514
|
-
|
515
|
-
// ret_obj_dataがObjectでnoticeが存在しているかのチェック
|
516
|
-
if(!(ret_obj_data is Array) || !(ret_obj_data[0]["notice"] is String)){
|
517
|
-
// if(!is_connect){ throw new DangoError("error:recieve data is invalid." , 29); }
|
518
|
-
throw new DangoError("error:recieve data is invalid." , 29);
|
519
|
-
}
|
520
|
-
|
521
|
-
/*
|
522
|
-
if(ret_obj_data["notice"] == "_notice_sid"){
|
523
|
-
if(is_debug){ trace("DangoClientFramework:recieve:_notice_sid:no response:" + receve_count + ":" + DangoUtil.now2str()); }
|
524
|
-
}else{
|
525
|
-
var response_notice_name:String;
|
526
|
-
response_notice_name = "_response";
|
527
|
-
if(is_debug){ trace("DangoClientFramework:sending:response:notice_name=" + ret_obj_data["notice"] + ":" + ret_obj_data["_id"] + ":" + receve_count + ":" + DangoUtil.now2str()); }
|
528
|
-
|
529
|
-
this.send_action(response_notice_name, {"_id":ret_obj_data["_id"]}); // 受信完了確認の為に空データを送る
|
530
|
-
}
|
531
|
-
*/
|
532
|
-
return(ret_obj_data);
|
533
|
-
|
534
|
-
} else { // まだデータが残っているなら空を返す
|
535
|
-
recv_not_yet_str += recv_data_orig;
|
536
|
-
return([]);
|
537
|
-
}
|
538
|
-
}
|
539
|
-
|
540
570
|
/**
|
541
571
|
* dango_before_filter の雛形
|
542
572
|
* すべてのdango通知の前処理用のメソッド
|
543
|
-
*
|
573
|
+
* オーバーライドして使うもの
|
544
574
|
*
|
545
575
|
* @param evt:DangoReceiveEvent
|
546
576
|
* @return void
|
577
|
+
*/
|
547
578
|
protected function dango__before_filter(evt:Object):void {
|
548
579
|
}
|
549
|
-
*/
|
550
580
|
}
|
551
581
|
}
|
@@ -1,11 +1,11 @@
|
|
1
1
|
//参考:http://livedocs.adobe.com/flex/2_jp/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=Part5_ProgAS.html
|
2
2
|
|
3
3
|
package org.rubyforge.dango {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
import flash.events.*;
|
5
|
+
|
6
|
+
public class DangoError extends Error {
|
7
|
+
public function DangoError(message:String, errorID:int) {
|
8
|
+
super(message, errorID);
|
9
|
+
}
|
10
|
+
}
|
11
11
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
package org.rubyforge.dango {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
public class DangoErrorCode {
|
3
|
+
public static var CloseError:uint = 1; // 接続が切れたときのエラーコード
|
4
|
+
public static var SecurityError:uint = 2; // セキュリティエラー(crossdomainとか)のエラーコード
|
5
|
+
public static var IOError:uint = 3; // IOの失敗時のエラーコード
|
6
|
+
}
|
7
7
|
}
|
@@ -1,23 +1,23 @@
|
|
1
1
|
|
2
2
|
package org.rubyforge.dango {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
3
|
+
import flash.events.*;
|
4
|
+
|
5
|
+
public class DangoErrorEvent extends Event {
|
6
|
+
private var dango_type:String;
|
7
|
+
public var code:uint;
|
8
|
+
public var message:String;
|
9
|
+
|
10
|
+
public function DangoErrorEvent(type:String, code_orig:uint, message_orig:String,
|
11
|
+
bubbles:Boolean = false,
|
12
|
+
cancelable:Boolean = false) {
|
13
|
+
dango_type = type;
|
14
|
+
code = code_orig;
|
15
|
+
message = message_orig;
|
16
|
+
super(type, bubbles, cancelable);
|
17
|
+
}
|
18
|
+
|
19
|
+
public override function clone():Event {
|
20
|
+
return(new DangoErrorEvent(dango_type, code, message));
|
21
|
+
}
|
22
|
+
}
|
23
23
|
}
|
@@ -1,25 +1,25 @@
|
|
1
1
|
|
2
2
|
package org.rubyforge.dango {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
3
|
+
import flash.events.*;
|
4
|
+
|
5
|
+
public class DangoReceiveEvent extends Event {
|
6
|
+
private var dango_type:String;
|
7
|
+
public var receive_data:Object;
|
8
|
+
public var receive_count_no:uint;
|
9
|
+
|
10
|
+
public function DangoReceiveEvent(type:String,
|
11
|
+
receive_data_orig:Object,
|
12
|
+
receive_count_no_orig:uint,
|
13
|
+
bubbles:Boolean = false,
|
14
|
+
cancelable:Boolean = false) {
|
15
|
+
dango_type = type;
|
16
|
+
receive_data = receive_data_orig;
|
17
|
+
receive_count_no = receive_count_no_orig;
|
18
|
+
super(type, bubbles, cancelable);
|
19
|
+
}
|
20
|
+
|
21
|
+
public override function clone():Event {
|
22
|
+
return(new DangoReceiveEvent(dango_type, receive_data, receive_count_no));
|
23
|
+
}
|
24
|
+
}
|
25
25
|
}
|
@@ -1,127 +1,134 @@
|
|
1
1
|
package org.rubyforge.dango {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
/**
|
3
|
+
* Dangoで利便性を高めたURLLoader
|
4
|
+
*
|
5
|
+
*/
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
7
|
+
import flash.net.*;
|
8
|
+
import flash.events.*;
|
9
|
+
import flash.text.*;
|
10
|
+
import flash.utils.*;
|
11
|
+
import flash.system.*;
|
12
|
+
|
13
|
+
import flash.events.IEventDispatcher;
|
14
|
+
import flash.events.EventDispatcher;
|
15
|
+
import flash.events.Event;
|
16
|
+
|
17
|
+
import org.rubyforge.dango.*;
|
18
|
+
|
19
|
+
public class DangoURLLoader implements IEventDispatcher {
|
20
|
+
|
21
|
+
private var url:String; // 取得URL
|
22
|
+
private var event_name:String; // 発生させるイベント名
|
23
|
+
private var is_debug:Boolean; // Debugモードかどうかのフラグ
|
24
|
+
|
25
|
+
private var dispatcher:EventDispatcher; // Event送出用
|
26
|
+
|
27
|
+
/**
|
28
|
+
* DangoURLLoader
|
29
|
+
* URLから認証情報を取得開始(コンストラクタ)
|
30
|
+
*
|
31
|
+
* @param u:String
|
32
|
+
* @param e:Strin
|
33
|
+
* @param d:Boolean = false
|
34
|
+
*/
|
35
|
+
public function DangoURLLoader(u:String, e:String, d:Boolean = false){
|
36
|
+
if(is_debug){ trace("DangoURLLoader:start"); }
|
37
|
+
|
38
|
+
// 初期設定
|
39
|
+
url = u;
|
40
|
+
event_name = e;
|
41
|
+
is_debug = d;
|
42
|
+
|
43
|
+
// データ受信準備
|
44
|
+
var loader:URLLoader = new URLLoader();
|
45
|
+
loader.dataFormat = URLLoaderDataFormat.TEXT;
|
46
|
+
|
47
|
+
// 各種イベントの登録
|
48
|
+
configureListeners(loader);
|
49
|
+
|
50
|
+
// Event送出用
|
51
|
+
dispatcher = new EventDispatcher(this);
|
52
|
+
|
53
|
+
// データ受信
|
54
|
+
var request:URLRequest = new URLRequest(url);
|
55
|
+
try {
|
56
|
+
loader.load(request);
|
57
|
+
} catch (error:Error) {
|
58
|
+
var receive_object:Object = {"status":"failed", "data":"Unable to load requested document."};
|
59
|
+
this.dispatchEvent(new DangoURLLoaderEvent(event_name, receive_object));
|
60
|
+
}
|
61
|
+
|
62
|
+
}
|
63
|
+
|
64
|
+
private function configureListeners(loader:IEventDispatcher):void {
|
65
|
+
loader.addEventListener(Event.COMPLETE, completeHandler);
|
66
|
+
loader.addEventListener(Event.OPEN, openHandler);
|
67
|
+
loader.addEventListener(ProgressEvent.PROGRESS, progressHandler);
|
68
|
+
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
|
69
|
+
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
|
70
|
+
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
|
71
|
+
}
|
72
|
+
|
73
|
+
private function completeHandler(event:Event):void {
|
74
|
+
var loader:URLLoader = URLLoader(event.target);
|
75
|
+
if(is_debug){ trace("DangoURLLoader:completeHandler: " + loader.data); }
|
76
|
+
|
77
|
+
var receive_object:Object = {"status":"success", "data":loader.data};
|
78
|
+
this.dispatchEvent(new DangoURLLoaderEvent(event_name, receive_object));
|
79
|
+
}
|
73
80
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
81
|
+
private function openHandler(event:Event):void {
|
82
|
+
var msg:String = "DangoURLLoader:openHandler: " + event;
|
83
|
+
if(is_debug){ trace(msg); }
|
84
|
+
}
|
78
85
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
86
|
+
private function progressHandler(event:ProgressEvent):void {
|
87
|
+
var msg:String = "DangoURLLoader:progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal;
|
88
|
+
if(is_debug){ trace(msg); }
|
89
|
+
}
|
83
90
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
private function securityErrorHandler(event:SecurityErrorEvent):void {
|
92
|
+
var msg:String = "DangoURLLoader:securityErrorHandler";
|
93
|
+
if(is_debug){ trace(msg); }
|
94
|
+
|
95
|
+
var receive_object:Object = {"status":"failed", "data":msg};
|
96
|
+
this.dispatchEvent(new DangoURLLoaderEvent(event_name, receive_object));
|
97
|
+
}
|
91
98
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
99
|
+
private function httpStatusHandler(event:HTTPStatusEvent):void {
|
100
|
+
var msg:String = "DangoURLLoader:httpStatusHandler: " + event;
|
101
|
+
if(is_debug){ trace(msg); }
|
102
|
+
}
|
96
103
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
104
|
+
private function ioErrorHandler(event:IOErrorEvent):void {
|
105
|
+
var msg:String = "DangoURLLoader:ioErrorHandler" + event;
|
106
|
+
if(is_debug){ trace(msg); }
|
107
|
+
|
108
|
+
var receive_object:Object = {"status":"failed", "data":msg};
|
109
|
+
this.dispatchEvent(new DangoURLLoaderEvent(event_name, receive_object));
|
110
|
+
}
|
111
|
+
|
112
|
+
// Event送出用
|
113
|
+
public function addEventListener(type:String, listener:Function,
|
114
|
+
useCapture:Boolean = false,
|
115
|
+
priority:int = 0,
|
116
|
+
useWeakReference:Boolean = false):void{
|
117
|
+
dispatcher.addEventListener(type, listener, useCapture, priority);
|
118
|
+
}
|
119
|
+
public function dispatchEvent(evt:Event):Boolean{
|
120
|
+
return dispatcher.dispatchEvent(evt);
|
121
|
+
}
|
122
|
+
public function hasEventListener(type:String):Boolean{
|
123
|
+
return dispatcher.hasEventListener(type);
|
124
|
+
}
|
125
|
+
public function removeEventListener(type:String, listener:Function,
|
126
|
+
useCapture:Boolean = false):void{
|
127
|
+
dispatcher.removeEventListener(type, listener, useCapture);
|
128
|
+
}
|
129
|
+
public function willTrigger(type:String):Boolean {
|
130
|
+
return dispatcher.willTrigger(type);
|
131
|
+
}
|
132
|
+
}
|
126
133
|
}
|
127
134
|
|
@@ -1,29 +1,29 @@
|
|
1
1
|
|
2
2
|
package org.rubyforge.dango {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
/**
|
4
|
+
* Dangoで利便性を高めたURLLoaderのイベントクラス
|
5
|
+
*
|
6
|
+
*/
|
7
|
+
import flash.net.*;
|
8
|
+
import flash.events.*;
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
10
|
+
import org.rubyforge.dango.*;
|
11
|
+
|
12
|
+
public class DangoURLLoaderEvent extends Event {
|
13
|
+
private var dango_type:String;
|
14
|
+
public var receive_object:Object;
|
15
|
+
|
16
|
+
public function DangoURLLoaderEvent(type:String, receive_object_orig:Object,
|
17
|
+
bubbles:Boolean = false,
|
18
|
+
cancelable:Boolean = false) {
|
19
|
+
dango_type = type;
|
20
|
+
receive_object = receive_object_orig;
|
21
|
+
super(type, bubbles, cancelable);
|
22
|
+
}
|
23
|
+
|
24
|
+
public override function clone():Event {
|
25
|
+
return(new DangoURLLoaderEvent(dango_type, receive_object));
|
26
|
+
}
|
27
|
+
}
|
28
28
|
}
|
29
29
|
|
@@ -1,109 +1,136 @@
|
|
1
1
|
|
2
2
|
package org.rubyforge.dango {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
//
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
/**
|
4
|
+
* Dangoで使っているユーティリティクラス
|
5
|
+
*
|
6
|
+
*/
|
7
|
+
|
8
|
+
import flash.utils.*;
|
9
|
+
// import mx.formatters.*;
|
10
|
+
import mx.utils.ObjectUtil;
|
11
|
+
|
12
|
+
public class DangoUtil {
|
13
|
+
|
14
|
+
/**
|
15
|
+
* array_delete
|
16
|
+
* Arrayから特定アイテムを削除した結果を返す
|
17
|
+
*
|
18
|
+
* @param arr:Array
|
19
|
+
* @param delete_item:*
|
20
|
+
* @return Array
|
21
|
+
*/
|
22
|
+
public static function array_delete(arr:Array, delete_item:*):Array {
|
16
23
|
|
17
|
-
|
18
|
-
|
24
|
+
// filterメソッドだと「ABC データは破損しているため、境界外の読み取りが試行されました。」が
|
25
|
+
// Flashバージョンによって出るのでforループで作り直し
|
19
26
|
/*
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
var filter_function:Function = function filter_function(item:*, idx:int, arr:Array):Boolean {
|
28
|
+
return(item != delete_item);
|
29
|
+
};
|
30
|
+
return(arr.filter(filter_function));
|
24
31
|
*/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
32
|
+
var temp_arr:Array = [];
|
33
|
+
for (var i:uint = 0; i < arr.length; i ++) {
|
34
|
+
var item:* = arr[i];
|
35
|
+
if (item != delete_item){
|
36
|
+
temp_arr.push(item);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return(temp_arr);
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* string_byte_length
|
44
|
+
* Stringのバイト数を返す
|
45
|
+
*
|
46
|
+
* @param str:String
|
47
|
+
* @return uint
|
48
|
+
*/
|
49
|
+
public static function string_byte_length(str:String):uint {
|
50
|
+
var str_size_ba:ByteArray = new ByteArray();
|
51
|
+
str_size_ba.writeUTFBytes(str);
|
52
|
+
var size:uint = str_size_ba.length;
|
53
|
+
return(size);
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* date2str
|
58
|
+
* Date型から日時のStringにして返す
|
59
|
+
*
|
60
|
+
* @param date:Date
|
61
|
+
* @return String
|
62
|
+
*/
|
63
|
+
public static function date2str(date:Date):String {
|
64
|
+
// var df:DateFormatter = new DateFormatter();
|
65
|
+
// df.formatString = "YYYY-MM-DD HH:NN:SS";
|
66
|
+
// var str:String = df.format(date);
|
48
67
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
//
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
68
|
+
var str:String = "" +
|
69
|
+
date.getFullYear() + "-" +
|
70
|
+
(date.getMonth() + 1) + "-" +
|
71
|
+
date.getDate() + " " +
|
72
|
+
date.getHours() + ":" +
|
73
|
+
date.getMinutes() + ":" +
|
74
|
+
date.getSeconds() + "." +
|
75
|
+
date.getMilliseconds() + " TZ=" +
|
76
|
+
(date.getTimezoneOffset() / 60);
|
77
|
+
return(str);
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* now2str
|
82
|
+
* 現在時間を返す
|
83
|
+
*
|
84
|
+
* @return String
|
85
|
+
*/
|
86
|
+
public static function now2str():String {
|
87
|
+
return(date2str(new Date()));
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* parse_query
|
92
|
+
* URLのQUERY_STRINGのparse
|
93
|
+
*
|
94
|
+
* @param query:String
|
95
|
+
* @param parse1:String = "&"
|
96
|
+
* @param parse2:String = "="
|
97
|
+
* @return Object
|
98
|
+
*/
|
99
|
+
public static function parse_query(query:String, parse1:String = "&", parse2:String = "="):Object {
|
100
|
+
// 受信データの分解
|
101
|
+
var arr_split_equal:Array;
|
102
|
+
var ret_object:Object = {};
|
103
|
+
|
104
|
+
var regex1:RegExp = new RegExp(parse1);
|
105
|
+
var regex2:RegExp = new RegExp(parse2);
|
106
|
+
|
107
|
+
var arr_split_and:Array = query.split(regex1);
|
108
|
+
|
109
|
+
for (var i:uint = 0; i < arr_split_and.length; i++) {
|
110
|
+
arr_split_equal = arr_split_and[i].split(regex2);
|
111
|
+
ret_object[String(arr_split_equal[0])] = String(arr_split_equal[1]);
|
112
|
+
}
|
113
|
+
|
114
|
+
return(ret_object);
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* get_flashvars
|
119
|
+
* parametersからflashvarsを分解してobjectに入れて返す
|
120
|
+
*
|
121
|
+
* @param app:Object
|
122
|
+
* @return Object
|
123
|
+
*/
|
124
|
+
public static function get_flashvars(app:Object):Object {
|
125
|
+
var flash_vars:Object = {};
|
126
|
+
var value:String;
|
127
|
+
for (var key:String in app.parameters) {
|
128
|
+
value = app.parameters[key];
|
129
|
+
flash_vars[key] = value;
|
130
|
+
}
|
131
|
+
|
132
|
+
return(flash_vars);
|
133
|
+
}
|
134
|
+
|
135
|
+
}
|
109
136
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dango_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keisuke Minami
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-28 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|