Flex3ÓëÒ³ÃæJavaScriptµÄÏ໥µ÷ÓÃ
ÈÕÇ°×öÏîÄ¿£¬ÐèÒª°ÑÒ³ÃæµÄJS´úÂë³é³öÀ´·Åµ½Ò»¸ö.jsÎļþÖУ¬ÓÉÓÚflex³ÌÐòÊÇÒÔdiv+SWFObjectµÄ·½Ê½Ç¶Èëµ½Ò³ÃæµÄ£¬ÎªÁ˴ﵽĿ±êÍøÕ¾Ö»ÐèÒªÒýÓÃÒ»¸ö.jsÎļþ¼´ÊµÏÖÒýÓÃÏîÄ¿¹¤³ÌµÄÄ¿µÄ£¬ËùÒÔÒ²Òª°ÑSWFObjectµÄ´úÂë·Åµ½.jsÎļþÖС£
˼·ÊÇÓÃdocument.write()°ÑÒýÓÃswfÎļþµÄ´úÂëд½øÒ³Ã棬Ȼºó°ÑflexÒªµ÷ÓõÄjsº¯Êý¶¼·Åµ½.jsÎļþÖÐ
ºÜ¿ì£¬¾ÍǨÒÆÍê±ÏÁË¡£²âÊÔing...
Ïë²»µ½µÄÊÇ£¬flexÖÐÓÃExternalInterface.call("methodName",params);µ÷JSº¯ÊýȱûÓзµ»ØÖµ£¬ÓÃalert("a")µ¯³öһϣ¬¹ûȻûÓе÷Óõ½¡£ÕâÊÇΪʲôÄØ£¿ÄѵÀ°ÑSWFÓÃdocument.writeµÄ·½Ê½¼ÓÈëµ½Ò³ÃæºóȨÏÞ½µµÍÁË£¿
·Å¹·ÕÒÁËһϣ¬Ëƺõ´ó¼ÒµÄµ÷Óö¼ºÜÕý³£……°¦……ÈËÉú×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ´ËÁË¡£
ͻȻÏëµ½infoqµÄһЩÁ¬½ÓÏÔʾµÄÊÇÀàËÆjavascript:void(0)µÄ×ÖÑù£¬ÓÚÊǺõ£¬ÎÒÏëµ½ÁËÓÃflexµÄURLRequestµ÷ÓÃÒ³ÃæµÄJS¡£
Á¢¿Ì³¢ÊÔ
flexÖУº
var req:URLRequest = new URLRequest("javascript:test('hello')");
navigateToURL(req,"_self");
ÔÚJSÖУº
function test(str){
alert("ÄãºÃ" + str);
return "world";
}
ä¯ÀÀÆ÷µ¯³ö¶Ô»°¿ò£¬ÀïÃæµÄÎÄ×ÖÏÔʾҲÕý³£¡£
Õâ˵Ã÷ÓÃURLRequestµ÷ÓÃÊÇûÎÊÌâµÄ¡£
µ«ÊÇ……ä¯ÀÀÆ÷È´ÌøתÁË£¬Ò³ÃæÏÔʾworld¡£
ºÜÃ÷ÏÔ£¬²»¿ÉÒÔµ¥´¿µØÕâôµ÷¡£
Ôõô°ìÄØ£¿·ÁËÒ»ÏÂflexµÄÎĵµ£¬ÔÀ´ExternalInterfaceÓиöaddCallBackµÄ·½·¨£¬Ê¹ÓÃËü¿ÉÒÔ½¨Ò»¸öJSµÄ»Øµ÷º¯Êý
ʹÓ÷½·¨ÈçÏ£º
ExternalInterface.addCallBack("returnValue",returnValue);//µÚÒ»¸ö²ÎÊýÊÇ¿ª·Å¸øJSµÄº¯ÊýÃû£¬µÚ¶þ¸ö²ÎÊýÊǶÔÓ¦µÄAS·½·¨¡£
flexÖУº
public function invokeJavaScript(details:String):void{
var JavaScriptRequest:URLRequest = new URLRequest("javascript:" + details);
navigateToURL(JavaScriptRequest,"_self");
}
public function returnValue(value:String):void{
this.value = value;
}
private function testASJS():void{
invokeJavaScript("test('seal','ÀϺú')");
}
jsÖУº
function thisMovie(flexName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[flexName];
} else {
return document[flexName];
}
}
function sendToActionScript(flexName,value) {
thisMovie(flexName).returnValue(value);
}
function test(flexName,param1){
sendToAction
Ïà¹ØÎĵµ£º
ʲôÊÇCairngorm£¿
Cairngorm£¨ÖÐÎÄÃû£º“ÑÌË®¾§”£¿£©ÊÇÒ»¸öÇáÁ¿¼¶µÄFlex RIA³ÌÐò¿ª·¢¿ò¼Ü£¬´Ó¶øʹ³ÌÐò¿ÉÀ©Õ¹ÐÔ¡¢¿Éά»¤ÐÔ¶¼´ó´óÌá¸ß£¬Æä±¾Éí²¢²»ÊÇÒ»¸öÍêÕûµÄÆóÒµÓ¦Óã¬ËüÖ»ÊÇÌṩÁËÒ»¸ö¿ª·¢¹Ç¼Ü£¬Adobe³Æ֮ΪÌåϵ¡£
CairngormÌåϵ
Ö÷Òª°üÀ¨ÒÔϼ¸¸ö²¿·Ö£º
1¡¢VO£¨Value Object£©
IValueObject ºÍ ValueO ......
flexÓ¦Óÿ´¾ÃÁË£¬Ò»¸öĬÈϵÄ×°ÔØloading½çÃæ¾Í»áµ¼ÖÂÉóÃÀÆ£ÀÍ£¬ÏÂÃæÌṩһÖÖ·½·¨£¬ÈÃÄã¿ÉÒÔ×Ô¶¨ÒåÄãµÄ×°ÔؽçÃæ¡£
1£¬ÔÚsrcĿ¼Ï½¨Á¢×Ô¶¨ÒåÀ࣬Á½¸öÎļþ´úÂëÈçÏ ÔÚadminConsoleÏîÄ¿¿ÉÕÒµ½¡£
*********************************************************************************
1¡¢Preloader ......
²»Óò»ÖªµÀ,Ò»ÓòÅÖªµÀÕâÁ½ÕßÊDz»´óÒ»ÑùµÄ,ÏñÔÚjavaÖÐ,ÊÇÖ±½ÓʹÓà ,Èç str1.replace("$","*") °Ñ$ºÅ±ä³É*ºÅ
µ«ÔÚjavascript¾Í²»Ò»Ñù,ҪʵÏÖÉÏÃæµÄ¹¦ÄÜÊÇÕâÑùд: str.replace(/&/g,"*") ÆäÖеÄgÊDzÎÊý,˵Ã÷Òª½«È«²¿µÄ$¶¼±ä³É*
ÏÂÃæ°ÑjavascriptµÄÕ³ÌùÔÚÏÂÃæ:
¶¨ÒåºÍÓ÷¨
replace() ·½·¨ÓÃÓÚÔÚ×Ö·û´®ÖÐÓÃһЩ×Ö·ûÌ ......
×î½üÔÚ¿´Flex3ȨÍþÖ¸ÄÏ£¬ÀïÃæ¶ÔÒ³Ãæ¼Ü¹¹ºÍRIA¼¼Êõ×ܽáµÄºÜºÃ¡£
Ò». »ùÓÚÒ³Ãæ¼Ü¹¹µÄWebÓ¦ÓÃÁ÷³Ì
1. Óû§´ò¿ªä¯ÀÀÆ÷£¬ÏòWEB·þÎñÆ÷ÇëÇóÒ»¸öÒ³Ãæ¡£
2. WEB·þÎñÆ÷ÊÕµ½ÇëÇó¡£
3. (optional)ÍøÂç·þÎñÆ÷°ÑÇëÇ󽻸øÓ¦Ó÷þÎñÆ÷À´¶¯Ì¬×é×°Ò³Ãæ¡£
&nb ......