Flex Java ÉÏ´« ÏÂÔØ ×é¼þ
Flex Java ÉÏ´« ÏÂÔØ ×é¼þ ÊÕ²Ø
ÊÂǰ׼±¸¾ÍÊǵ½http://commons.apache.orgÏÂÔØcommon-fileupload-1.1.1.jarÒÔ¼°common-io-1.2.jarÁ½¸ö°ü¡£
ǰ̨Flex´úÂ룺
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns="*" creationComplete="init();">
<mx:Script>
<![CDATA[
import flash.net.FileReference;
import mx.controls.Alert;
import mx.events.CloseEvent;
import flash.events.*;
private var file: FileReference;
private function init(): void{
Security.allowDomain("*");
file = new FileReference();
file.addEventListener(ProgressEvent.PROGRESS, onProgress);
file.addEventListener(Event.SELECT, onSelect);
file.addEventListener(Event.COMPLETE, completeHandle);
}
private function completeHandle(event:Event):void{
Alert.show("¹§Ï²Ä㣬ÉÏ´«³É¹¦");
}
private function upload(): void{
var imageTypes:FileFilter = new FileFilter("Images (*.jpg, *.jpeg, *.png)", "*.jpg;*.jpeg;*.png");
var allTypes:Array = new Array(imageTypes);
file.browse(allTypes);
file.browse();
}
private function onSelect(e: Event): void{
Alert.show("ÉÏ´« " + file.name + " (¹² "+Math.round(file.size)+" ×Ö½Ú)?",
"È·ÈÏÉÏ´«",
Alert.YES|Alert.NO,
null,
proceedWithUpload);
}
private function onProgress(e: ProgressEvent): void{
lbProgress.text = " ÒÑÉÏ´« " + e.bytesLoaded
+ " ×Ö½Ú£¬¹² " + e.bytesTotal + " ×Ö½Ú";
var proc: uint = e.bytesLoaded / e.bytesTotal * 100;
bar.setProgress(proc, 100);
bar.label= "µ±Ç°½ø¶È: " + " " + proc + "%";
}
private function proceedWithUpload(e: CloseEvent): void{
if (e.detail == Alert.YES){
var request: URLRequest = new URLRequest("http://localhost:8080/FileUploaded/FileUploaded");
try {
file.upload(request);
} catch (error:Error) {
trace("ÉÏ´«Ê§°Ü");
}
}
}
]]>
</mx:Script>
<mx:Canvas width="100%" height="100%" x="10" y="170" fontSize="15">
<mx:VBox width="100%" horizontalAlign="center">
<mx:Label id="lbProgress" te
Ïà¹ØÎĵµ£º
×î½üÔÚдJava³ÌÐò´¦Àí´óÁ¿Êý¾ÝµÄʱºòÄÚ´æÍùÍùËæ×ųÌÐòÖ´ÐеÄÊý´ÎÔö¼Ó¶øÔö¼Ó, ×î´óʱÉÏÕǵ½1.XGÒÔÉÏ, ×îÖÕJVMÄÚ´æÓþ¡, ³ÌÐòÒì³£ÖÕÖ¹,ÔÚ³ÌÐòÖÐÒѾ½«ÄÜ»ØÊյıäÁ¿¶¼ÖÃΪnullÁË, »¹ÊDz»ÄÜʵʱ»ØÊÕÄÚ´æ, Ïëµ½C++µÄµÄ×ö·¨, ÓÐÎö¹¹º¯ÊýºÍdelete, ¿ÉÒÔ¼°Ê±µÄ»ØÊÕÄÚ´æ, JCPÄÜ·ñ¿ÉÒÔ¿¼ÂÇÒ»ÏÂÔÚJDK7ÖÐÔö¼Ódelete¹Ø¼ü×Ö, ÈÃJavaÒ²ÄÜÏñ ......
package demo;
class InOut{
String str=new String("Between");
static int i=666;
int j=888;
final int k=999;
public void amethod(final int iArgs){
int it315;
final int x=111;
/*static*/ class Bicycle
{
//&n ......
package demo;
class TA{
//Õâ¸ö³ÌÐòÒªºÃºÃÀí½â,³£Á¿²»ÊÇÊôÓÚÀàµÄ£¬ËüÔÚÄÚ´æÖÐÓÐÒ»¿éµ¥¶ÀµÄ´æ´¢ÇøÓò£¬ºÎÀàTAÎÞÈκιØÏµ
// public static final int m=9;
// ¾²Ì¬±äÁ¿ÊÇÊôÓÚÀàµÄ£¬ËüµÄ´æ´¢ÇøÓòÓëÀàÏà¹Ø
public static int m=9;
static {
System.out.println("In Static m=" ......
1:µ±ÓÃhttp://xxxxx/xxx.mxml?name=hermit·½Ê½·ÃÎÊ ¿ÉÒÔÓÃthis.parameters.nameÕâÖÖ·½Ê½ÔÚflexÀïÃæÈ¡url²ÎÊý
2:µ±ÓÃhttp://xxxxx/xxx.swf?name=hermit·½Ê½·ÃÎÊ ¿ÉÒÔÓÃthis.parameters.nameÕâÖÖ·½Ê½ÔÚflexÀïÃæÈ¡url²ÎÊý
3:µ±ÓÃhttp://xxxxx/xxx.html?name=hermit·½Ê½·ÃÎÊ ¿ÉÒÔÓÃthis.parameters.nameÕâÖÖ·½Ê½ÔÚflexÀïÃæÈ ......
FlexÓ¦ÓõĸùÊÇSystemManger£¬ËüÊÇflash.display.MovieClipµÄ×ÓÀ࣬һ¸öFlash PlayerÏÔʾ¶ÔÏóÀàÐÍ¡£SystemManagerÓÐÁ½¸öÖ¡£¬µÚÒ»Ö¡ÊÇÓÃÀ´ÏÔʾӦÓÃÔØÈëµÄ½ø¶Èָʾ£¬Õâ¸öÖ¡ÊÇÇáÁ¿µÄ£¬ËùÒÔËü¼¸ºõÄÜÁ¢¼´ÏÂÔØºÍÔËÐС£µÚ¶þÖ¡±ãÊÇÓ¦Óñ¾Éí¡£µ±Ò»¸öFlexÓ¦ÓõÄSystemManagerʵÀý½øÈëµ½µÚ¶þÖ¡£¬Ëü´´½¨Ò»¸öÖ÷Ó¦ÓõÄʵÀý¡£SystemManager ......