flex 和 java (web)的组合开发
1、开发环境:在myeclipse7.0中整合flex plup3.0, 安装flex plup3.0时,选myeclipse 中eclipse的目录,然
找到flex 的安装好的目录,将plugins和features对应到拷到myeclipse里面 eclipse相应的目录下。
2、创建 flex和 java (Web)的工程(通信框架用blazeds.war):
1、在myeclipse7下转到flex开发环境,创建flex工程 flexssh:
2、右键创建好的flex 工程,为flex添加 web能力,使之有web能力,才可以使用ssh框架.
二、flex和java的通信
写一个java类:
package com.qili.flexssh.test;
import com.qili.flexssh.util.UploadFile;
public class Hello {
public String say(String yourworld){
System.out.println("at:"+UploadFile.getNowDatetime()+" you say:"+yourworld);
return "at:"+UploadFile.getNowDatetime()+" you say:"+yourworld;
}
}
在WebRoot/WEB-INF/flex/remoting-config.xml 下添加
<destination id="hello_java_class"> <!-- flex mxml页面要调用的ID -->
<properties>
<source>com.qili.flexssh.test.Hello</source> <!-- java中的类 -->
</properties>
</destination>
3) 页面写 flex程序
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.events.ResourceEvent;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
[Bindable]private var returnmess:String; //获取java类里面的方法回调的值
function sendMess():void{
var myworld:
相关文档:
通过java.awt.Robot的createScreenCapture截屏。
public static void captureScreen(String fileName) throws Exception {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle screenRectangle = new Rectangle(screenSize);
& ......
1flex端
<mx:Button label="下 载" click="download()"/>
//下载
public function download():void{
var str:String=this.uploadfiles.selectedIndex.toString();
if(str=="-1"){
Alert.show("请选中要下载的文件");
&n ......
在flex中,一般直接在设计时写remoteobject的话,这个是比较普遍了,但有的时候,需要在AS代码中动态设置
remoteobject,这个比较少见,所以小结学习之:
情景是,当页面加载时,代码新建立一个remoteobject,然后设置其方法和调用参数,最后把调用返回的结果(是JAVA中的一个LIST),绑定到
一个repeater控 ......