華府江山 http://203.72.56.8/phpBB3/ |
|
guestbook of flash program for Android http://203.72.56.8/phpBB3/viewtopic.php?f=46&t=707 |
第 1 頁 (共 1 頁) |
發表人: | alex [ 2011年 11月 4日, 13:15 ] |
文章主題 : | guestbook of flash program for Android |
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 ) ; |
第 1 頁 (共 1 頁) | 所有顯示的時間為 UTC + 8 小時 |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |