Flex 带验证码的登陆页面
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp()">
<mx:states>
<mx:State name="index">
<mx:RemoveChild target="{loginPanel}"/>
<mx:AddChild position="lastChild">
<mx:Label text="欢迎来到主页" fontFamily="Georgia" fontSize="20"/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function initApp():void{
lblCheckCode.text=GenerateCheckCode();
}
private function loginHandle():void
{
if(txtUsername.text==""||txtPassword.text==""){
Alert.show("用户名或者密码输入不完整!");
}
if(txtUsername.text=="admin" && txtPassword.text=="admin" && txtCheckCode.text.toLocaleLowerCase()==lblCheckCode.text.toLocaleLowerCase()){
currentState="index";
}else{
if(txtCheckCode.text.toLocaleLowerCase()!=lblCheckCode.text.toLocaleLowerCase()){
Alert.show("验证码不正确!");
lblCheckCode.text=GenerateCheckCode();
txtCheckCode.text="";
}else{
Alert.show("用户名或密码输入不正确!");
}
}
}
private function resetHandle():void{
txtUsername.text="";
txtPassword.text="";
&nb
相关文档:
服务器端代码,amfphp的services目录下建立readData.php文件,代码如下
<?php
class ReadDB
{
function getData()
&nb ......
首先:确定数据库的编码为utf8,正常储存中文(用MySQL-Front查看中文是否正常)
然后:Services查询MySQL时使用"SET NAMES 'utf8'",且通过"amfphp/browser"运行看看是否中文,如果乱码则修改gateway.php文件,去掉 $gateway->setCharsetHandler("utf8_decode", "ISO-8859-1", "ISO-8859-1");
最后:运行Flex程序显 ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical">
<mx:Script>
<![CDATA[
import mx.controls.dataGridClasses.DataGridListData;
imp ......
首先建立插件文件存放目录:
D:\eclipse_plugins\flex3\eclipse\features
D:\eclipse_plugins\flex3\eclipse\plugins
以上路径根据本机实际情况确定
然后把Flex Builder3 中的文件拷贝到对应目录下:
D:\IDE\Flex Builder 3\features\com.adobe * -> D:\eclipse_plugins\flex3\eclipse\features
D:\IDE\Flex ......
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 ......