加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex软件盘

发布时间:2020-12-15 05:12:39 所属栏目:百科 来源:网络整理
导读:1.先下载Vendy.KeyBoard.swc放到libs文件夹下。 2.添加如下代码: ?xml version="1.0" encoding="utf-8"?s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"

1.先下载Vendy.KeyBoard.swc放到libs文件夹下。

2.添加如下代码:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:VendyKeyBoard="VendyKeyBoard.*"
			   creationComplete="appInit(event)">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import VendyKeyBoard.KeyBoardEvent;
			
			import mx.events.FlexEvent;
			//键盘输入
			[Bindable]
			private var InputWord:String;
			//初始化
			protected function appInit(event:FlexEvent):void{
				mykeyboard.SetKeyBoard="数字";
				InputWord="";
			}
			protected function mykeyboard_inputHandler(e:KeyBoardEvent):void
			{
				switch(e.type){
					case "input":
						InputWord+=e.InputWord;
						break;
					case "boardChange":
						//InputType=mykeyboard.GetInputType
						break;
					case "del":
						InputWord=InputWord.slice(0,InputWord.length-1);
						break;
				}
			}


			protected function mykeyboard_delHandler(e:KeyBoardEvent):void
			{
				switch(e.type){
					case "input":
						InputWord+=e.InputWord;
						break;
					case "boardChange":
						//InputType=mykeyboard.GetInputType
						break;
					case "del":
						InputWord=InputWord.slice(0,InputWord.length-1);
						break;
				}
			}


			protected function mykeyboard_boardChangeHandler(e:KeyBoardEvent):void
			{
				switch(e.type){
					case "input":
						InputWord+=e.InputWord;
						break;
					case "boardChange":
						//InputType=mykeyboard.GetInputType
						break;
					case "del":
						InputWord=InputWord.slice(0,InputWord.length-1);
						break;
				}
			}
			
			protected function key_clickHandler(event:MouseEvent):void {
				if(this.mykeyboard.visible == false) {
					this.mykeyboard.x = this.jianpan.x-25;
					this.mykeyboard.y = this.jianpan.y+25; 
					kbFadeEft.play();
					//	this.mykeyboard.visible = true;
					this.upwd.enabled = false;
				} else {
					kbFadeEftOut.play();
					//	this.mykeyboard.visible = false;
					this.upwd.enabled = true;
				}
			}

		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
		<s:Fade id="kbFadeEft" target="{mykeyboard}" alphaFrom="0" alphaTo="1" 
				duration="1000" effectEnd="mykeyboard.visible = true"/>
		<s:Fade id="kbFadeEftOut" target="{mykeyboard}" alphaFrom="1" alphaTo="0" 
				duration="500" effectEnd="mykeyboard.visible = false"/>
	</fx:Declarations>
	<s:Label text="密码" x="40" y="60"/>
	<s:TextInput id="upwd" x="120" y="60" width="106" 
				 displayAsPassword="true" text="{InputWord}"/>
	<mx:Image id="jianpan" source="screenshot.png" x="228" y="60" 
			  width="22" height="22" click="key_clickHandler(event)"/>
	<VendyKeyBoard:KeyBoard id="mykeyboard" x="115" y="165" 
							scaleX="0.25" scaleY="0.16"	visible="false"
							input="mykeyboard_inputHandler(event)"
							del="mykeyboard_delHandler(event)"
							boardChange="mykeyboard_boardChangeHandler(event)"/>
</s:Application>

3.运行。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读