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

һƪ¹ØÓÚflexÓëÊý¾Ý¿â½»»¥µÄÀý×Ó£¨×ª£©

Ê×ÏÈÒªÇó´ó¼Òµ½Êý¾Ý¿â½¨Á¢Ò»¸öÊý¾Ý¿â£¬ÔÚÎÒÕâÀý×ÓÖÐÊý¾Ý¿âÃûΪuserDb,½¨Á¢Ò»¸ö±íuserInfo£¬ÀïÃæÉèÖÃÁ½¸ö×Ö¶ÎÒ»¸öΪid£¬Ò»¸öΪname¡£
´´½¨ÒÔÏÂjava´úÂëÔÚsrcĿ¼ÏÂ
User.java
package org.rjb.java;
public class User {

private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name=name;
}
}

UserDao.java
package org.rjb.java;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class UserDao {
public static Connection getConnection() {
Connection c = null;
try{
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/userDb";
String username = "root";
String password = "1235";

Class.forName(driver);
c=DriverManager.getConnection(url,username,password);
} catch (Exception e) {
System.out.println(e.getMessage());
}
return c;
}

public List getAllUser() throws SQLException{
Connection c = getConnection();
Statement st = c.createStatement();
ResultSet rs = st.executeQuery("select * from UserInfo");
ArrayList userList = new ArrayList<User>();
while(rs.next()) {
User u=new User();
u.setName(rs.getString("name"));
userList.add(u);
}
return userList;
}
}
ÒÔÉÏÊÇjava¶ËµÄÈ«²¿´úÂëÁË£¬ÏÂÃæÊÇflex¶ËµÄ´úÂë¡£
´´½¨ÒÔÏ´úÂëÔÚflex_srcÏ£º
User.as
package org.rjb.flex{
[RemoteClass(alias="org.rjb.java.User")]
public class User {
private var _name : String;

public function User(){}

public function get name() : String {
return this._name;
}

public function set name(name : String) : void {
this._name=name;
}
}
}
½ÓÏÂÀ´ÊÇmxml´úÂ룬Ҳ¾ÍÊÇÎÒÃÇÕæÕýչʾÎÒÃÇÊý¾ÝµÄ½çÃæ
FlexWithJava.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"


Ïà¹ØÎĵµ£º

JavaÓëFlexÇø±ð¶þ£ºÕûÊý³ý·¨¡¢±äÁ¿¶¨Òå¡¢Êý×éȡֵ

ÔÚJavaÀïÃæ£¬Á½¸öÕûÊýÏà³ýµÃµ½ÊǸöÕûÊý£¬±ÈÈç int a = 28;
int b = 10;
a/b == 2; //true
ÔÚFlexÖУ¬ÉÏÃæJava´úÂ뽫·µ»ØÍ¬ÑùµÄ½á¹û¡£ÖµµÃ×¢ÒâµÄÊÇ£¬Èç¹ûʹÓõÄÊÇNumberÀ࣬ÔòÓÐËù²»Ò»ÑùÁË¡£ÏÂÃæµÄ´úÂëÖУ¬resultµÄֵΪ2.8¡£Èç¹ûÄ㲻СÐİѷµ»ØµÄ½á¹û×÷ΪÊý×éµÄË÷ÒýȥȡֵµÄ»°£¬ÄÇôʲô½á¹û¶¼Ã»ÓС£
var a:Number = 28 ......

flexͨ¹ýblazedsÓëjavaʵÏÖÔöɾ¸Ä²é Õû¸öʵÏÖÁ÷³Ì

1£¬½¨Ò»¸öuserdb¿â£¬ÔÙ½¨userinfo±í£¬×ֶΣºid(int),username(varchar),password(varchar)¡£
2£¬DBConnection.java
    package com.datainfo;  
 
  import java.sql.Connection;  
  import java.sql.DriverManager;  
  import java.sql.SQ ......

Flexѧϰ±Ê¼Ç£¨1£©

×î½ü¿´ÁËflexÏà¹Ø×ÊÁÏ£¬ÐĵÃÌå»áÈçÏ£º
Flex³ÌÐò°üÀ¨£º
1.flex framework
2.MXML ³ÌÐòÖ÷Îļþ£¬»ùÓÚxmlµÄÒ»ÖÖʵÏÖ¡£
3.Actionscript 3.0 ÀàËÆJSµÄÒ»Öֽű¾
4.CSS Ñùʽ
5.ͼÐÎ×ÊÔ´ ͼ±êÖ®ÀàµÄ¶«¶«
6.Êý¾Ý
Flex±àÒë·¢²¼¹ý³Ì£º
FlexÓ¦ÓóÌÐò±»±àÒë³ÉÒ»¸öSWFÎļþ£¬È»ºóÔÚFlash PlayerÏÂÔËÐС£µ±Ô´´úÂë±»±àÒëÊÇ£¬Ëü¾Í±»× ......

FLEX MDI´°¿Ú¿ª·¢ÊµÀý

Ö÷³ÌÐò´úÂ룺
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    xmlns:mdi="ext.containers.windows.mdi.*"
    width="100%"
    height= ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ