`
hgfghww6
  • 浏览: 40432 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

使用 Flash Remoting in Flash Forms 制作 Live Search

阅读更多

 
即时搜索效果察看
Live Search 的程式分成两部份,它的组成大约是一点点 Javascript,加上适量的 CFML,以及很多的 ActionScript...。在程式码之前有一段小小的 DHTML,用来显示叫出 pop-up window 的 link,如下:


 NewPopUpWindowAtCenter = function(aa,bb,ww,hh){
  var tmp_top = ( window.screen.height - hh ) / 2;
  tmp_top = tmp_top * 2 / 3;
  var tmp_left = ( window.screen.width - ww ) / 2;
  window.open(aa,bb,’height=’+hh+’,left=’+tmp_left+’,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,top=’+tmp_top+’,width=’+ww);
 }

开启搜寻
第一部份 livesearch.cfm 是重头戏,即内含 Flash Remoting 功能的 Flash Form。其语法虽然源自 AS Fusion,但我已将不必要的部份尽量精简,以将流程单纯化,并减少一些程式码:

 
  function formOnLoad(){
   myForm_01.myGlobalObjects = {};
   setUpRemoting();
   setStyles();
  }
  function setUpRemoting(){
   var myConnection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection("http://www.j2eemx.com/flashservices/gateway/");
   var myService:mx.remoting.NetServiceProxy;
   var myResponseHandler:Object = {};
   var myDataGrid_01:mx.controls.DataGrid = myDataGrid_01;
   myResponseHandler.onResult = function( results: Object ):Void {
    mx.managers.CursorManager.removeBusyCursor();
    myDataGrid_01.dataProvider = results;
    myDataGrid_01.selectedIndex = undefined;
   } 
   myResponseHandler.onStatus = function( stat: Object ):Void {
    mx.managers.CursorManager.removeBusyCursor();
    alert("Error: " + stat.description);
   }
   myForm_01.myGlobalObjects.myCFC = myConnection.getService("cfcs.livesearch", myResponseHandler);
  }
  function submitSearch(){
   mx.managers.CursorManager.setBusyCursor();
   var tmp = myKeyword_01.text;
   myForm_01.myGlobalObjects.myCFC.search_title(tmp);
  }
  function goArticle(){
   var myDataGrid_01:mx.controls.DataGrid = myDataGrid_01;
   var tmp_url = myDataGrid_01.selectedItem.atc_uid;
   tmp_url = "http://j2eemx.com/cfdp_cfms/article.cfm?atc=" + tmp_url;
   tmp_url = tmp_url + "&mode=1";
   getURL("javascript:;window.opener.location.href=’"+tmp_url+"’;window.close();");
  }
  function setStyles(){
   _global.styles.ComboBox.setStyle("color", 0x00253D);
   _global.styles.Label.setStyle("color", 0x222222);
   _global.styles.CheckBox.setStyle("color", 0x00253D);
   _global.styles.RadioButton.setStyle("color", 0x00253D);
   _global.styles.Form.setStyle("color", 0x222222);
   _global.styles.Form.setStyle("fontSize", 13);
   _global.styles.Button.setStyle("color", 0x222222);
   _global.styles.Button.setStyle("borderThickness", 1);
本文转自:http://www.5uflash.com/flashjiaocheng/Fmsjiaocheng/2318.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics