チェンジセット 2324
- コミット日時:
- 2009/03/08 20:30:33 (3 年前)
- ファイル:
-
- air/TLife/bin/TLife.swf (更新) (変更前)
- air/TLife/src/Main.mxml (更新) (3 diffs)
- air/TLife/src/uwi/thread/ContextMenuItemEventThread.as (更新) (3 diffs)
- air/TLife/src/uwi/thread/DataGridRoutineThread.as (更新) (2 diffs)
- air/TLife/src/uwi/thread/InitialMovementThread.as (更新) (2 diffs)
- air/TLife/src/uwi/thread/PostEventThread.as (更新) (3 diffs)
- air/TLife/src/uwi/thread/ReloadEventThread.as (更新) (2 diffs)
- air/TLife/src/uwi/thread/ReloadThread.as (追加)
- air/TLife/src/uwi/thread/ReloadTimerThread.as (更新) (2 diffs)
- air/TLife/src/uwi/thread/ReplyGetThread.as (更新) (3 diffs)
- air/TLife/src/uwi/thread/StatusInsertThread.as (更新) (1 diff)
- air/TLife/src/uwi/thread/TimelineThread.as (更新) (9 diffs)
- air/TLife/src/uwi/twitter/TwitterBitScrapeThread.as (追加)
- air/TLife/src/uwi/twitter/TwitterBitStatusGetThread.as (更新) (4 diffs)
- air/TLife/src/uwi/twitter/TwitterFriendsTimelineGetThread.as (追加)
- air/TLife/src/uwi/twitter/TwitterPostThread.as (更新) (1 diff)
- air/TLife/src/uwi/twitter/TwitterReloadThread.as (削除)
- air/TLife/src/uwi/twitter/TwitterScrapeThread.as (追加)
- air/TLife/src/uwi/twitter/TwitterStatusGetThread.as (削除)
- air/TLife/src/uwi/util/CommonData.as (更新) (3 diffs)
- air/TLife/src/uwi/util/StatusScraper.as (更新) (3 diffs)
- air/TLife/src/uwi/util/StatusUtility.as (更新) (2 diffs)
- air/TLife/src/uwi/util/URLPostThread.as (更新) (4 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
air/TLife/src/Main.mxml
r2323 r2324 92 92 this.nativeWindow.addEventListener(Event.CLOSING, onClosing); 93 93 94 // debug95 //var b : Balloon = new Balloon();96 //b.text = "にゃんにゃん";97 //b.timeout = 3000;98 //b.open(true);99 100 94 new MainThread().start(); 101 95 } … … 156 150 for each(var tab : XML in CommonData.configxml.main.tabbar.tab) { 157 151 ar.push(tab.@name.toString()); 158 CommonData.tabmap[tab.@name.toString()] = {postid : -1, newestid : -1, notify : Boolean(tab.@notify)}; 159 } 160 // tabbar.titles.source = ["Recent", "Reply"]; 152 CommonData.tabmap[tab.@name.toString()] = {selectedid : -1, scrollposid : -1, newestid : -1, notify : Boolean(tab.@notify)}; 153 } 161 154 tabbar.titles = new ArrayCollection(ar); 162 155 tabbar.changeLayout(); … … 281 274 } 282 275 283 public function saveSelectedRow() : void 276 /** 277 * 選択行と表示行を保存 278 */ 279 public function saveRowInfo() : void 284 280 { 285 281 var tabname : String = tabbar.selectedTabName; 286 282 if (tabname == null) return; 287 CommonData.tabmap[tabname].postid = dg.selectedItem ? dg.selectedItem.postid : -1; 288 } 289 283 CommonData.tabmap[tabname].selectedid = dg.selectedItem ? dg.selectedItem.postid : -1; 284 if (timeline.length == 0) { 285 CommonData.tabmap[tabname].scrollposid = -1; 286 }else{ 287 CommonData.tabmap[tabname].scrollposid = timeline.getItemAt(dg.verticalScrollPosition).postid; 288 } 289 } 290 291 /** 292 * postidから行を検索 293 * @param query 294 * @return 295 */ 290 296 public function searchByPostID(query : Number) : int 291 297 { air/TLife/src/uwi/thread/ContextMenuItemEventThread.as
r2323 r2324 20 20 import uwi.db.SimpleTransactionThread; 21 21 import uwi.twitter.TwitterPostThread; 22 import uwi.twitter.TwitterReloadThread;23 22 import uwi.twitter.TwitterAPI; 23 import uwi.twitter.TwitterScrapeThread; 24 24 import uwi.ui.MultipleTabBar; 25 25 import uwi.ui.TabConfig; … … 276 276 // タイムラインをtwitterから取得 277 277 var se : SerialExecutor = new SerialExecutor(); 278 se.addThread(new Twitter ReloadThread(1, 2, title));278 se.addThread(new TwitterScrapeThread(1, title)); 279 279 se.addThread(new TimelineThread(20)); 280 280 se.start(); … … 308 308 // タイムラインをtwitterから取得 309 309 var se : SerialExecutor = new SerialExecutor(); 310 se.addThread(new Twitter ReloadThread(1, 2, posterid));311 se.addThread(new Twitter ReloadThread(1, 2, replyerid));310 se.addThread(new TwitterScrapeThread(1, posterid)); 311 se.addThread(new TwitterScrapeThread(1, replyerid)); 312 312 se.addThread(new TimelineThread(20)); 313 313 se.start(); air/TLife/src/uwi/thread/DataGridRoutineThread.as
r2294 r2324 34 34 public var flag : int = 0; 35 35 public var suspended : Boolean = false; 36 public var suspended2 : Boolean = false; 36 37 37 38 public function DataGridRoutineThread() 38 39 { 39 40 super(CommonData.configxml.main.dg.interval, false); 41 CommonData.dgrt = this; 40 42 } 41 43 42 44 protected override function onTimer() : void 43 45 { 44 if (flag == 0 || suspended ) return;46 if (flag == 0 || suspended || suspended2) return; 45 47 46 48 var obj : Object = dg.selectedItem; … … 51 53 var index : int = dg.selectedIndex; 52 54 53 if((flag & 2) != 0){ 55 if ((flag & 2) != 0) { 56 54 57 // friendpost欄に表示 55 58 friendname.text = obj.postername + " / " + obj.posterid; air/TLife/src/uwi/thread/InitialMovementThread.as
r2323 r2324 5 5 import org.libspark.thread.Thread; 6 6 import org.libspark.thread.utils.SerialExecutor; 7 import uwi.twitter.TwitterFriendsTimelineGetThread; 7 8 import uwi.twitter.TwitterLoginThread; 8 import uwi.twitter.Twitter ReloadThread;9 import uwi.twitter.TwitterScrapeThread; 9 10 import uwi.util.CommonData; 10 11 import uwi.util.Utility; … … 52 53 // ログイン成功時 53 54 var se : SerialExecutor = new SerialExecutor(); 54 se.addThread(new TwitterReloadThread(1, int(CommonData.configxml.numpageget.recent) + 1)); 55 // se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 56 se.addThread(new NotifyNewThread()); 55 se.addThread(new TwitterFriendsTimelineGetThread()); 56 // se.addThread(new TwitterScrapeThread(int(CommonData.configxml.numpageget.recent))); 57 se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 58 // se.addThread(new NotifyNewThread()); 57 59 se.start(); 58 60 se.join(); air/TLife/src/uwi/thread/PostEventThread.as
r2264 r2324 11 11 import org.libspark.thread.Thread; 12 12 import uwi.twitter.TwitterPostThread; 13 import uwi.twitter.Twitter ReloadThread;13 import uwi.twitter.TwitterScrapeThread; 14 14 import uwi.util.CommonData; 15 15 … … 68 68 69 69 var tpt : TwitterPostThread = new TwitterPostThread( 70 "http://twitter.com/statuses/update.xml", 70 "http://twitter.com/statuses/update.xml", 71 71 "status=" + decodeURI(postarea.text + footer) + 72 72 (CommonData.in_reply_to_status_id != "" ? "&in_reply_to_status_id=" + CommonData.in_reply_to_status_id : "") … … 84 84 charleft.text = CommonData.LIMLEN_POST.toString(); 85 85 86 new Twitter ReloadThread().start();86 new TwitterScrapeThread().start(); 87 87 postbtn.enabled = true; 88 88 next(run); air/TLife/src/uwi/thread/ReloadEventThread.as
r2264 r2324 6 6 import org.libspark.thread.Thread; 7 7 import org.libspark.thread.utils.SerialExecutor; 8 import uwi.twitter.Twitter ReloadThread;8 import uwi.twitter.TwitterScrapeThread; 9 9 import uwi.util.CommonData; 10 10 … … 31 31 32 32 var se : SerialExecutor = new SerialExecutor(); 33 se.addThread(new Twitter ReloadThread(1, int(CommonData.configxml.numpageget.recent) + 1));33 se.addThread(new TwitterScrapeThread(int(CommonData.configxml.numpageget.recent))); 34 34 se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 35 35 se.start(); air/TLife/src/uwi/thread/ReloadTimerThread.as
r2323 r2324 7 7 import org.libspark.thread.Thread; 8 8 import org.libspark.thread.utils.SerialExecutor; 9 import uwi.twitter.TwitterReloadThread; 9 import uwi.twitter.TwitterFriendsTimelineGetThread; 10 import uwi.twitter.TwitterScrapeThread; 10 11 import uwi.util.CommonData; 11 12 … … 48 49 49 50 var se : SerialExecutor = new SerialExecutor(); 50 se.addThread(new TwitterReloadThread(1, int(CommonData.configxml.numpageget.recent) + 1)); 51 // se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 52 se.addThread(new NotifyNewThread()); 51 se.addThread(new TwitterFriendsTimelineGetThread()); 52 // se.addThread(new TwitterScrapeThread(int(CommonData.configxml.numpageget.recent))); 53 se.addThread(new TimelineThread(CommonData.configxml.numstatusprint.recent)); 54 // se.addThread(new NotifyNewThread()); 53 55 se.start(); 54 56 se.join(); air/TLife/src/uwi/thread/ReplyGetThread.as
r2221 r2324 9 9 import org.libspark.thread.ThreadState; 10 10 import uwi.db.DBSelectThread; 11 import uwi.twitter.TwitterBitScrapeThread; 11 12 import uwi.twitter.TwitterBitStatusGetThread; 12 13 import uwi.util.CommonData; … … 73 74 var ar : Array = ret.data; 74 75 if (ar == null) { 75 // DBに存在しない場合はとりに行く76 // postがDBに存在しない場合はとりに行く 76 77 if (retryct == 1) { 78 // tbsgt = new TwitterBitScrapeThread(posterid, postid); 77 79 tbsgt = new TwitterBitStatusGetThread(posterid, postid); 78 80 tbsgt.start(); … … 81 83 } 82 84 }else { 83 // DB存在している場合はreply欄に表示85 // postがDBに存在している場合はreply欄に表示 84 86 var obj : Object = ar[0]; 85 87 replyname.text = posterid; air/TLife/src/uwi/thread/StatusInsertThread.as
r2221 r2324 51 51 stmt_rep_status.parameters[":content"] = status.content; 52 52 stmt_rep_status.parameters[":postedtime"] = status.postedtime; 53 stmt_rep_status.parameters[":replyid"] = status.replyid ;53 stmt_rep_status.parameters[":replyid"] = status.replyid != "" ? status.replyid : 0; 54 54 stmt_rep_status.parameters[":fav"] = status.fav; 55 55 try { air/TLife/src/uwi/thread/TimelineThread.as
r2323 r2324 7 7 import mx.core.Application; 8 8 import org.libspark.thread.Thread; 9 import org.libspark.thread.utils.ParallelExecutor; 9 10 import org.libspark.thread.utils.SerialExecutor; 10 11 import uwi.db.DBSelectThread; … … 28 29 29 30 private var dbst : DBSelectThread = null; 30 private var se : SerialExecutor = null;31 private var pe : ParallelExecutor = null; 31 32 32 33 private var posterdata : Object; // <ID, poster> … … 35 36 this.prefetch = prefetch; 36 37 this.query = query; 37 Application.application.saveSelectedRow();38 38 } 39 39 … … 46 46 protected override function run() : void 47 47 { 48 // 選択行を保存 49 Application.application.saveRowInfo(); 50 48 51 if (tabbar.SelectedIndex == -1) return; 49 52 … … 96 99 } 97 100 101 timeline.disableAutoUpdate(); 98 102 timeline.removeAll(); 99 103 … … 118 122 }); 119 123 } 124 125 // 行を選択、スクロールを移動 120 126 dg.callLater(function() : void { 121 var postid : Number = CommonData.tabmap[tabbar.selectedTabName].postid; 122 if (postid != -1) { 123 dg.selectedIndex = Application.application.searchByPostID(postid); 127 var selectedid : Number = CommonData.tabmap[tabbar.selectedTabName].selectedid; 128 var scrollposid : Number = CommonData.tabmap[tabbar.selectedTabName].scrollposid; 129 130 if (selectedid != -1) { 131 dg.selectedIndex = Application.application.searchByPostID(selectedid); 124 132 } 133 134 var scrollpos : int = Application.application.searchByPostID(scrollposid); 135 if (scrollpos != -1) { 136 dg.verticalScrollPosition = scrollpos; 137 } 138 125 139 // trace("state : " + CommonData.dget.state); 126 140 CommonData.dget.flagChange(); 127 141 } ); 128 142 129 se = new SerialExecutor();143 pe = new ParallelExecutor(); 130 144 for (var posterid : String in posterdata) { 131 145 var sql : String = "select screenname, iconurl from " + CommonData.TABLE_POSTER + " where posterid = '" + posterid + "'"; 132 146 var ddbst : DBSelectThread = new DBSelectThread(CommonData.db_memory.conn, sql, prefetch); 133 147 posterdata[posterid] = ddbst; 134 se.addThread(ddbst);135 } 136 se.start();137 se.join();148 pe.addThread(ddbst); 149 } 150 pe.start(); 151 pe.join(); 138 152 next(onSelectPosterComplete); 139 153 } 154 timeline.enableAutoUpdate(); 155 dg.offscreenExtraRowsOrColumns = dg.rowCount; 156 157 // timelineを書き換えている間はRoutineThreadをsuspendedに 158 CommonData.dgrt.suspended2 = true; 159 140 160 interrupted(onInterrupted); 141 161 } … … 149 169 for (var posterid : String in posterdata) { 150 170 var ddbst : DBSelectThread = posterdata[posterid]; 171 if (ddbst == null) { 172 trace("超なぞのエラー : " + posterid); 173 } 151 174 var ret : SQLResult = ddbst.Result; 152 175 var ar : Array = ret.data; … … 166 189 } 167 190 } 191 192 // RoutineThreadのsuspendedを解除 193 CommonData.dgrt.suspended2 = false; 168 194 } 169 195 … … 171 197 { 172 198 if (dbst != null) dbst.interrupt(); 173 if ( se != null) se.interrupt();199 if (pe != null) pe.interrupt(); 174 200 } 175 201 } air/TLife/src/uwi/twitter/TwitterBitStatusGetThread.as
r2294 r2324 2 2 { 3 3 import flash.net.URLRequest; 4 import flash.net.URLRequestMethod; 4 5 import org.libspark.thread.Thread; 5 6 import org.libspark.thread.threads.net.URLLoaderThread; 6 7 import org.libspark.thread.utils.ParallelExecutor; 8 import org.libspark.thread.utils.SerialExecutor; 7 9 import uwi.bean.Status; 8 10 import uwi.db.SimpleTransactionThread; … … 10 12 import uwi.thread.StatusInsertThread; 11 13 import uwi.util.CommonData; 12 import uwi.util.StatusScraper;13 14 14 15 /** 15 * Twitter単一ステータス取得用Thread16 * ... 16 17 * @author Uwi 17 18 */ … … 20 21 private var ult : URLLoaderThread = null; 21 22 private var lrt : LinkResolveThread = null; 22 private var pe : ParallelExecutor = null;23 23 24 24 private var s : Status = null; 25 25 private var followers : int; 26 26 private var posterid : String; 27 private var postid : String;28 27 29 28 public function TwitterBitStatusGetThread(posterid : String, postid : String) 30 29 { 31 30 this.posterid = posterid; 32 this.postid = postid; 31 var req : URLRequest = new URLRequest("http://twitter.com/statuses/show/" + postid + ".xml"); 32 req.method = URLRequestMethod.POST; 33 ult = new URLLoaderThread(req); 33 34 } 34 35 35 36 protected override function run() : void 36 37 { 37 trace("replyget : " + "https://twitter.com/" + posterid + "/status/" + postid);38 ult = new URLLoaderThread(new URLRequest("https://twitter.com/" + posterid + "/status/" + postid));39 38 ult.start(); 40 39 ult.join(); … … 45 44 private function onGetComplete() : void 46 45 { 47 trace("getcomplete"); 48 // スクレイピング 49 var ret : Object = StatusScraper.scrapeBit(ult.loader.data); 50 switch(ret.code) { 51 case 0: 52 // 正常 53 s = ret.status; 54 // リンク解決用Threadを走らせる 55 lrt = new LinkResolveThread(s.content); 56 lrt.start(); 57 lrt.join(); 58 next(resolveComplete); 59 break; 60 case 1: 61 // protected 62 // protected情報をDBにreplace 63 pe = new ParallelExecutor(); 64 var sql : String = "replace into " + CommonData.TABLE_RELATION + " (userid, posterid, following, protected, lastupdated) values ('" + CommonData.configxml.userid + "', '" + posterid + "', false, true, '" + new Date() + "')"; 65 pe.addThread(new SimpleTransactionThread(CommonData.db_memory.conn, sql)); 66 pe.addThread(new SimpleTransactionThread(CommonData.db_disk.conn, sql)); 67 pe.start(); 68 pe.join(); 69 break; 70 default: 71 break; 72 } 73 interrupted(onInterrupted); 46 var status : XML = XML(ult.loader.data); 47 // "Sun Mar 08 00:03:44 +0000 2009" 48 var datestr : String = status.created_at; 49 // "Sun Mar 08 00:03:44 UTC+0000 2009" にすればDateで読める。 50 var postedtime : Date = new Date(datestr.substring(0, 20) + "UTC" + datestr.substring(20)); 51 52 followers = int(status.user.followers_count); 53 54 s = new Status(status.id, status.user.name, status.user.screen_name, status.text, status.in_reply_to_status_id, postedtime, status.user.profile_image_url, status.favorited == "true"); 55 trace(s); 56 lrt = new LinkResolveThread(s.content); 57 lrt.start(); 58 lrt.join(); 59 next(onResolveComplete); 74 60 } 75 61 76 private function resolveComplete() : void62 private function onResolveComplete() : void 77 63 { 78 64 // リンク解決 79 trace("resolvecomplete");80 65 s.content = lrt.dst; 66 67 // DBにinsert(replace, update) 68 var se : SerialExecutor = new SerialExecutor(); 69 var pe1 : ParallelExecutor = new ParallelExecutor(); 70 var pe2 : ParallelExecutor = new ParallelExecutor(); 71 81 72 var v : Vector.<Status> = Vector.<Status>([s]); 73 pe1.addThread(new StatusInsertThread(CommonData.db_memory.conn, v, false)); 74 pe1.addThread(new StatusInsertThread(CommonData.db_disk.conn, v, false)); 75 se.addThread(pe1); 82 76 83 // DBにinsert 84 pe = new ParallelExecutor(); 85 pe.addThread(new StatusInsertThread(CommonData.db_memory.conn, v, false)); 86 pe.addThread(new StatusInsertThread(CommonData.db_disk.conn, v, false)); 87 pe.start(); 88 pe.join(); 89 interrupted(onInterrupted); 77 var sql : String = "update " + CommonData.TABLE_POSTER + " set" + 78 " follower = " + followers + 79 " where posterid = '" + posterid + "'"; 80 pe2.addThread(new SimpleTransactionThread(CommonData.db_memory.conn, sql)); 81 pe2.addThread(new SimpleTransactionThread(CommonData.db_disk.conn, sql)); 82 se.addThread(pe2); 83 84 se.start(); 85 se.join(); 90 86 } 91 87 92 88 private function onInterrupted() : void 93 89 { 94 if (pe != null) pe.interrupt();95 90 if (ult != null) ult.interrupt(); 96 91 if (lrt != null) lrt.interrupt(); air/TLife/src/uwi/twitter/TwitterPostThread.as
r2294 r2324 38 38 { 39 39 if (eventname != null) { 40 Alert.show("なぞのエラー", "Login");40 Alert.show("なぞのエラー", eventname); 41 41 StatusBarUtility.write(eventname + "失敗!"); 42 42 } air/TLife/src/uwi/util/CommonData.as
r2323 r2324 11 11 import uwi.migemo.AIRMigemo; 12 12 import uwi.thread.DataGridEventThread; 13 import uwi.thread.DataGridRoutineThread; 13 14 import uwi.thread.ReplyGetThread; 14 15 import uwi.tinysegmenter.TinySegmenter; … … 34 35 35 36 public static var dget : DataGridEventThread = null; 37 public static var dgrt : DataGridRoutineThread = null; 36 38 37 39 public static const FILE_DB_MIGEMODICT : File = new File("app:/migemo-dict.db"); … … 78 80 public static var dateformatter_timeline : DateFormatter; 79 81 80 // public static var balloons : Vector.<Balloon> = new Vector.<Balloon>();81 82 public static var balloons : Dictionary = new Dictionary(true); 82 83 air/TLife/src/uwi/util/StatusScraper.as
r2323 r2324 77 77 78 78 // replyid 79 var replyid : String = " 0";79 var replyid : String = ""; 80 80 var replytobase : int = str.indexOf(">in reply to"); 81 81 if (replytobase != -1) { … … 214 214 215 215 // replyid 216 var replyid : String = " 0";216 var replyid : String = ""; 217 217 var replytobase : int = entrymeta.indexOf(">in reply to"); 218 218 if (replytobase != -1) { … … 234 234 { 235 235 try { 236 var following : int = StringUtility.pinch(src, "<span id=\"following_count\" class=\"stats_count numeric\">", "</span>") as int;237 var follower : int = StringUtility.pinch(src, "<span id=\"follower_count\" class=\"stats_count numeric\">", "</span>") as int;238 var update : int = StringUtility.pinch(src, "<span id=\"update_count\" class=\"stats_count numeric\">", "</span>") as int;236 var following : int = int(StringUtility.pinch(src, "<span id=\"following_count\" class=\"stats_count numeric\">", "</span>").replace(/,/g, "")); 237 var follower : int = int(StringUtility.pinch(src, "<span id=\"follower_count\" class=\"stats_count numeric\">", "</span>").replace(/,/g, "")); 238 var update : int = int(StringUtility.pinch(src, "<span id=\"update_count\" class=\"stats_count numeric\">", "</span>").replace(/,/g, "")); 239 239 }catch (e : Error) { 240 240 trace(e.getStackTrace()); 241 241 return null; 242 242 } 243 trace("fing : " + following + ", " + follower + ", " + update); 244 243 245 return new PageData(following, follower, update); 244 246 } air/TLife/src/uwi/util/StatusUtility.as
r2323 r2324 68 68 } 69 69 70 public static const PREFIX_CUSTOMICONURL : String = "https://s3.amazonaws.com/twitter_production/profile_images/"; 71 public static const PREFIX_DEFAULTICONURL : String = "https://static.twitter.com/images/default_profile"; 70 public static const PREFIX_CUSTOMICONURL : String = "http://s3.amazonaws.com/twitter_production/profile_images/"; 71 public static const PREFIX_CUSTOMICONURL2 : String = "https://s3.amazonaws.com/twitter_production/profile_images/"; 72 public static const PREFIX_DEFAULTICONURL : String = "http://static.twitter.com/images/default_profile"; 73 public static const PREFIX_DEFAULTICONURL2 : String = "https://static.twitter.com/images/default_profile"; 72 74 73 75 /** … … 79 81 public static function compressIconUrl(src : String) : String 80 82 { 81 if (src.substr(0, PREFIX_DEFAULTICONURL.length) == PREFIX_DEFAULTICONURL) { 83 if (src.substr(0, PREFIX_DEFAULTICONURL.length) == PREFIX_DEFAULTICONURL || 84 src.substr(0, PREFIX_DEFAULTICONURL2.length) == PREFIX_DEFAULTICONURL2 85 ) { 82 86 return ""; 83 87 } 84 if (src.substr(0, PREFIX_CUSTOMICONURL.length) == PREFIX_CUSTOMICONURL) { 88 if (src.substr(0, PREFIX_CUSTOMICONURL.length) == PREFIX_CUSTOMICONURL || 89 src.substr(0, PREFIX_CUSTOMICONURL2.length) == PREFIX_CUSTOMICONURL2 90 ){ 85 91 var dot : int = src.lastIndexOf("."); 86 92 if (dot == -1) return ""; air/TLife/src/uwi/util/URLPostThread.as
r2294 r2324 1 1 package uwi.util 2 2 { 3 import flash.events.Event; 3 4 import flash.events.HTTPStatusEvent; 4 5 import flash.net.URLRequest; … … 13 14 public class URLPostThread extends Thread 14 15 { 16 protected var ult : URLLoaderThread; 15 17 protected var url : String; 16 18 protected var poststr : String; 17 protected var time : int; 19 protected var timeout_ : int; 20 protected var response : Boolean; 18 21 19 public function URLPostThread(url : String, poststr : String, time : int = 0) 22 /** 23 * 24 * @param url 25 * @param poststr 26 * @param response trueならresponseを、falseならcontentをlistenする。 27 * @param timeout_ 28 */ 29 public function URLPostThread(url : String, poststr : String, response : Boolean = true, timeout_ : int = 0) 20 30 { 21 31 this.url = url; 22 32 this.poststr = poststr; 23 this.time = time;33 this.timeout_ = timeout_; 24 34 } 25 35 … … 30 40 req.data = encodeURI(poststr); 31 41 32 var ult : URLLoaderThread= new URLLoaderThread(req);42 ult = new URLLoaderThread(req); 33 43 ult.start(); 34 ult.join(time); 35 event(ult.loader, HTTPStatusEvent.HTTP_RESPONSE_STATUS, onResponse); 44 ult.join(timeout_); 45 if(response){ 46 event(ult.loader, HTTPStatusEvent.HTTP_RESPONSE_STATUS, onResponse); 47 }else { 48 event(ult.loader, Event.COMPLETE, onComplete); 49 } 36 50 error(Error, onError); 37 51 timeout(onTimeout); … … 51 65 trace(e.status); 52 66 } 67 68 protected function onComplete(e : Event) : void 69 { 70 trace(ult.loader.data); 71 } 53 72 } 54 73

