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ѧϰ´ÓÈëÃŵ½¾«Í¨
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......
/*¶à̬ʾÀý*/
package demo;
class AA {
public void f(){
System.out.println("f in AA");
}
}
class BB extends AA{
public void f(){
System.out.println("f in BB");
}
}
public class Test_Dt {
public static void main(String[] args) ......
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ÀïÃæÈ ......
TypeError: Error #1034: 強ÖÆÐÍ変換¤Ëʧ敗¤·¤Þ¤·¤¿¡£jp.co.nec.necst.pi.ap2web::TestEvent@1645ee79 ¤ò jp.co.nec.necst.pi.ap2web.TestEvent ¤Ë変換¤Ç¤¤Þ¤»¤ó¡£
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispat ......
ÔÎijö´¦£ºhttp://gnuu.org/2009/09/18/writing-your-own-toy-compiler
1¡¢½éÉÜ
ÎÒ×ÜÊǶԱàÒëÆ÷ºÍÓïÑԷdz£¸ÐÐËȤ£¬µ«ÊÇÐËȤ²¢²»»áÈÃÄã×ߵĸüÔ¶¡£´óÁ¿µÄ±àÒëÆ÷µÄÉè¼Æ¸ÅÄî¿ÉÒÔ¸ãµÄÈκÎÒ»¸ö³ÌÐòÔ±ÃÔʧÔÚÕâЩ¸ÅÄîÖ®ÖС£²»ÓÃ˵£¬ÎÒÒ²Ôø
½ñ³¢ÊÔ¹ý£¬µ«ÊDz¢Ã»ÓÐÈ¡µÃÌ«´óµÄ³É¹¦£¬ÎÒÒÔǰµÄ³¢ÊÔ¶¼Í£ÁôÔÚÓïÒå·ÖÎö½×¶Î¡£±¾ÎĵÄÁé¸ÐÖ÷Ò ......