⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mtiskin.as

📁 Sample CRUD flex with java
💻 AS
字号:
////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
//  All Rights Reserved. The following is Source Code and is subject to all
//  restrictions on such code as contained in the End User License Agreement
//  accompanying this product.
//
////////////////////////////////////////////////////////////////////////////////

package com.adobe.flex.extras.skins
{

import flash.display.Graphics;
import mx.core.mx_internal;
import mx.skins.ProgrammaticSkin;
import com.adobe.flex.extras.controls.MaskedTextInput;

use namespace mx_internal;

/**
 *  The skin for the background of the Masked Text Input control.
 */
public class MTISkin extends ProgrammaticSkin
{	
	//--------------------------------------------------------------------------
	//
	//  Constructor
	//
	//--------------------------------------------------------------------------

	/**
	 *  Constructor.
	 */
	public function MTISkin()
	{
		super();
	}
	
	//--------------------------------------------------------------------------
	//
	//  Overridden methods
	//
	//--------------------------------------------------------------------------
	
	/**
	 *  @private
	 */
	override protected function updateDisplayList(w:Number, h:Number):void
	{
		super.updateDisplayList(w, h);
		
		var fSize:Number = getStyle("fontSize");
		var cellWidth:Number = 0;
		if(parent is MaskedTextInput)
    		cellWidth = MaskedTextInput(parent).measureText("W").width;
    
    	var g:Graphics = this.graphics;
    	g.clear();
    	
    	var cellColor:Number = getStyle("cellColor");
    	if(!cellColor)
    	{
    		if(MaskedTextInput(parent).required)
    			cellColor = 0xFF0000;	
    		else
    			cellColor = 0x008CEA;
    	}
	
		g.lineStyle(0,0xFFFFFF,1);
		g.beginFill( cellColor, 0.20);
		var x1:Number = 3;
		var y1:Number = 2;
		
		switch(name)
		{
			case "MTISkin":
				if(parent is MaskedTextInput)
				{					
					for(var i:int=0;i<MaskedTextInput(parent).maskMap.length;i++)
					{
						if(MaskedTextInput(parent).maskMap[i][1] && MaskedTextInput(parent)._working[i] == " ")
						{
							g.drawRect(x1,y1,cellWidth,MaskedTextInput(parent).height-5);
							x1 = x1 + cellWidth ;
						}
						else
						{
							x1 = x1 + cellWidth ;
						}
					}
					g.endFill();
				}
				break;
		}
	}
	
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -