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 ) ;
|