Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

FlexÖÐÎļþµÄÉÏ´«ÏÂÔØ

¹Ø¼ü´Ê£ºÎļþÉÏ´«£¬ÎļþÏÂÔØ£¬FileReference£¬FileReferenceList£¬FileFilter
ÔÚÏîÄ¿¿ª·¢¹ý³ÌÖУ¬¾­³£»áÓöµ½ÎļþÉÏ´«ÏÂÔصÄÎÊÌâ¡£µ«ÔÚflexÖÐÓÉÓÚ°²È«É³ÏäµÄÔ­Òò£¬flex³ÌÐò²»ÄÜÖ±½Ó·ÃÎʱ¾µØÎļþ¡£µ«ÊÇflex SDKÖÐÌṩÁËFileReferenceºÍFileReferenceListÁ½¸öÀ࣬¿ÉÒÔͨ¹ýÕâÁ½¸öÀàÀ´ÊµÏÖ£¬ÕâÁ½¸öÀàλÓÚflash.net°üÖС£
Ò»¡¢ ÎļþÉÏ´«
ÉÏ´«Îļþflex¶Ë´¦Àí£º
1¡¢ÉÏ´«ÎļþµÚÒ»²½——´ò¿ªÎļþ¡£
Ê×ÏÈÐèÒª´´½¨Ò»¸öFileReference¶ÔÏó£º
private var myFileReference:FileReference = new FileReference();
ÔÚFileReferenceÖÐÓÐÒ»¸öbrowse()º¯Êý£¬Õâ¸öº¯ÊýµÄ×÷ÓþÍÊÇ´ò¿ªÒ»¸öwindowsÎļþÑ¡Ôñ¿ò£¬¿ÉÒÔÑ¡ÔñÐèÒªÉÏ´«µÄÎļþ¡£ÔÚ´ò¿ªµÄÎļþÑ¡Ôñ¿òÖпÉÒÔÖ¸¶¨Ñ¡ÔñÎļþµÄÀàÐÍ£¬ÕâÊÇͨ¹ýFileFilterÀ´ÊµÏֵġ£´´½¨Ò»¸öFileFilter¶ÔÏó£¬×÷Ϊbrowseº¯ÊýµÄ²ÎÊý£¬ÕâÑù¾Í¿ÉÒÔÖ¸¶¨Ñ¡ÔñÎļþµÄÀàÐÍÁË£º
var imagesFilter:FileFilter = new FileFilter("Images(*.jpg,*.gif,*.png)", "*.jpg;*.gif;*.png");
myFileReference.browse([imagesFilter]);
2¡¢ÉÏ´«ÎļþµÚ¶þ²½——ÉÏ´«Îļþ
ÎļþÑ¡ÔñÁËÖ®ºó»á´¥·¢Event.SELECTʼþ£¬ËùÒÔÐèÒªÔÚmyFileReference¶ÔÏóÉÏ×¢²áSELECTʼþµÄ¼àÌý£º
myFileReference.addEventListener(Event.SELECT, onSelect);
onSelectÊÇÒ»¸ö¼àÌýº¯Êý£¬ÔÚÕâ¸öº¯ÊýÖпÉÒԵõ½Ñ¡ÔñµÄÎļþµÄÃû×Ö¡£ÓÉÓÚ°²È«É³ÏäµÄÔ­Òò£¬Ö»Äܵõ½Ñ¡ÔñµÄÎļþÃû£¬²»Äܵõ½ÍêÕûµÄÎļþ·¾¶¡£Ñ¡ÔñÁËÐèÒªÉÏ´«µÄÎļþºó£¬ÐèÒªµ÷ÓÃupload()º¯ÊýÉÏ´«Ñ¡ÔñµÄÎļþ£º
myFileReference.upload(uploadURL,myFileReference.name);
uploadµÄ²ÎÊýuploadURLÊÇÒ»¸öURLRequest¶ÔÏó£¬Õâ¸ö¶ÔÏóÖ¸¶¨ÁËÉÏ´«ÎļþÓõÄURL£¬myFileReference.name¾ÍÊÇÑ¡ÔñµÄÎļþµÄÎļþÃû¡£
3¡¢ÉÏ´«ÎļþµÚÈý²½——ÉÏ´«½ø¶È
Ò»°ãÇé¿öÏ£¬ÔÚÉÏ´«ÎļþµÄ¹ý³ÌÖÐÐèÒªÏÔʾһ¸ö±íʾÉÏ´«½ø¶ÈµÄ½ø¶ÈÌõ£¬ÕâÑù¿ÉÒÔÓÐÒ»¸öºÜºÃµÄÓû§ÌåÑé¡£ÒªÏëÏÔʾÉÏ´«½ø¶È£¬¿ÉÒÔÓÐÁ½ÖÖ·½Ê½¡£µÚÒ»ÖÖ¾ÍÊǼàÌýFileReference¶ÔÏóµÄprocessʼþ£¬ÔÚprocessʼþµÄ¼àÌýº¯ÊýÖпÉÒԵõ½ÉÏ´«µÄ½ø¶È£¬È»ºó¿ÉÒÔÉèÖýø¶ÈÌõµÄ½ø¶È¡£µÚ¶þÖÖ·½Ê½¾ÍÊÇ°ÑFileReference¶ÔÏóÓë½ø¶ÈÌõ¶ÔÏó½øÐа󶨣¬½ø¶ÈÌõ»á×Ô¶¯¼àÌýFileReference¶ÔÏóµÄprocessʼþ£¬À´ÏÔʾÉÏ´«½ø¶È¡£
4¡¢ÉÏ´«ÎļþµÚËIJ½——ÉÏ´«½áÊø
ÓеÄʱºòÐèÒªÔÚÎļþÉÏ´«½áÊøºó¸øÓû§Ò»¸öÌáʾ£¬¸æËßÓû§ÎļþÒѾ­ÉÏ´«½áÊøÁË¡£Õâ¾Í±ØÐëµÃ¶ÔFileReference¶ÔÏóµÄCOMPLETEʼþ½øÐ


Ïà¹ØÎĵµ£º

FlexÓëJavaScriptµÄ½»»¥

Flex Óë JavaScript ½»»¥£¬Ö÷ÒªÒÀ¿¿FlexµÄExternalInterface£¬ÆäÌṩÁËaddCallBackºÍcall·½·¨.
ÏÂÃæµÄÀý×Ó½«ÑÝʾFlexµ÷ÓÃjavascript£¬ºÍjavascriptµ÷ÓÃFlex¡£
js ´úÂë
-------------------------------------------------------------------------------------------------------------
function hello(param) {
......

FlexÖб¾µØͼƬÉÏ´«¼°ÉÏ´«ÎļþÇ°µÄÔ¤ÀÀ

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="12" creationComplete="init()">
<mx:Script>
<!--[CDATA[
import mx.utils.*;
import flash.net.*;
......

ѧϰadobe flexÁ½Ìì×ܽá

1.flex²ú³öÎïµÄÐÎʽÓÐÁ½ÖÖ  flashÎļþ »òÕßairÎļþ¡£
 1).flashÓÃflash player²¥·Å
 2).airÎļþÐèÒªÓÃflexµÄruntimeÔËÐУ¬ÀàËÆjavaµÄjre ºÍ.netµÄ.net runtime
2.ʹÓÃflex builder¿ÉÒÔ¿ÉÊÓ»¯¿ª·¢£¬ÓÐjava»òÕß.net»ù´¡£¬»òÕßjavacript»ù´¡+ÃæÏò¶ÔÏó»ù´¡£¬ÈëÃźÜÈÝÒס£
3.ÌṩÁËһЩÀà¿â£¬¿ÉÒÔʹÓá£
4.Í ......

×ܽáFlexÓëä¯ÀÀÆ÷½»»¥

   ÔÚÓÃflex×öWebÓ¦ÓÃʱΪÁËÀ©Õ¹Ó¦ÓóÌÐò¹¦ÄÜ£¬ÊƱػá¸ü¶àµÄͬä¯ÀÀÆ÷½øÐн»»¥£¬ÕâÑù¾Í»áÓõ½ÏÂÃæ½éÉܵÄ֪ʶ
1¡¢ÔÚFlexÖÐʵÏÖURL Ìøת(ʹÓÃflash.net.navigateToURL()·½·¨È磺)
   /*
* param1: ÒªÌøתµÄURL
* param2: Ìøת·½Ê½ _blank /_self
*/
navigateToURL(new URLR ......

flexÀàµÄÉÖÆ£¨À©Õ¹£©


1£º¼ÙÈçÄãÒªÉÖÆÒ»¸öÀàA
public class A
{
¡¡¡¡public var vo:B
}
ÄãÊ×ÏÈÒª×öµÄÊÇ×¢²áÀ࣬ÀýÈ磺
public static function registerClass():void
  {
¡¡¡¡//°Ñ×ÓÀà×¢²á
   PackUtil.registerClass(B);
  }
//½ÓÏÂÀ´¾ÍÊÇ¿Ë¡£º
¡¡¡¡var cloneA:A=clone(A);
cloneA¾ÍÊÇÎÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ