發表新文章 回覆主題  [ 1 篇文章 ] 

討論區首頁 : 資訊專區 : Android 手機程式設計

發表人 內容
 文章主題 : guestbook of flash program for Android
文章發表於 : 2011年 11月 4日, 13:15 
離線
系統管理員

註冊時間: 2009年 1月 14日, 06:05
文章: 1419
import flash.net.URLRequest;
import flash.net.URLLoader;

var request:URLRequest = new URLRequest();
var reader:URLLoader = new URLLoader();
var writer:URLLoader = new URLLoader();

query_btn.addEventListener( MouseEvent.CLICK , entry_query );

function entry_query(e)
{
if (name_txt.text != "")
{
request.url = "http://localhost/guestbook2/test_flash_read.php?guest_name=" + name_txt.text;
request.method = URLRequestMethod.POST;
request.contentType = "application/x-www-form-urlencoded" ;

try
{
reader.load(request);
}
catch (error:ArgumentError)
{
trace( "An ArgumentError has occurred. " );
}
catch (error:SecurityError)
{
trace( "A SecurityError has occurred. " );
}

reader.addEventListener( Event.COMPLETE , query_respond );

}// if empty string end

}// entry_query end

function query_respond(e)
{
email_txt.text = ( new URLVariables( reader.data ) ) . guest_email ;
comment_txt.text = ( new URLVariables( reader.data ) ) . guest_comment ;
}

var is_modified = false ;

email_txt.addEventListener( Event.CHANGE , function (e) { is_modified = true ; } ) ;
comment_txt.addEventListener( Event.CHANGE , function (e) { is_modified = true ; } ) ;

append_btn.addEventListener( MouseEvent.CLICK , entry_append ) ;

function entry_append(e)
{
if (name_txt.text != "")
{
request.url = "http://localhost/guestbook2/test_flash_write.php?"
+ "guest_name=" + name_txt.text
+ "&guest_email=" + email_txt.text
+ "&guest_comment=" + comment_txt.text;

trace(request.url) ;

request.method = URLRequestMethod.POST;

try
{
writer.load(request);
}
catch (error:ArgumentError)
{
trace( "An ArgumentError has occurred. " );
}
catch (error:SecurityError)
{
trace( "A SecurityError has occurred. " );
}

writer.addEventListener( Event.COMPLETE , append_respond );

}// if empty string end

}// entry_query end

function append_respond(e)
{
email_txt.border = comment_txt.border = true ;

email_txt.borderColor = 0x22aaaa ;
comment_txt.borderColor = 0x22aaaa ;
}

email_txt.addEventListener( FocusEvent.FOCUS_IN , function (e) { email_txt.border = false ; } ) ;
comment_txt.addEventListener( FocusEvent.FOCUS_IN , function (e) { comment_txt.border = false ; } ) ;

InteractiveObject(name_txt.getChildAt(1)).tabIndex = 1 ;
InteractiveObject(email_txt.getChildAt(1)).tabIndex = 2 ;
InteractiveObject(comment_txt.getChildAt(1)).tabIndex = 3 ;

stage.focus = InteractiveObject( name_txt.getChildAt(1) ) ;
name_txt.selectable = true ;
name_txt.setSelection( 0 , name_txt.length ) ;


Back to top
 個人資料  
 
顯示文章 :  排序  
發表新文章 回覆主題  [ 1 篇文章 ] 

討論區首頁 : 資訊專區 : Android 手機程式設計


誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客


不能 在這個版面發表主題
不能 在這個版面回覆主題
不能 在這個版面編輯文章
不能 在這個版面刪除文章
不能 在這個版面上傳附加檔案

搜尋:
前往 :  
cron
Style by Midnight Phoenix & N.Design Studio
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
正體中文語系由 竹貓星球 維護製作