ComboBoxDropDownButton类(下拉列表框的按钮类):
package
{
/**
* 下拉列表框的按钮类
* @author Jave.Lin
*/
public class ComboBoxDropDownButton extends Button
{
private var _rateX:Number=1;
private var _rateY:Number=1;
public override function set width(value:Number):void
{
if(super.width!=value)
{
super.width=value;
_rateX=value/10;
refreshBackground();
}
}
public override function set height(value:Number):void
{
if(super.height!=value)
{
super.height=value;
_rateY=value/10;
refreshBackground();
}
}
public function ComboBoxDropDownButton()
{
super();
width=10;
height=10;
}
protected override function refreshBackground():void
{
//super.refreshBackground();
//背景也居中
this.graphics.clear();
this.graphics.beginFill(0x55aa00, 0.1);
this.graphics.drawRect(0,0,10*_rateX,10*_rateY);
this.graphics.endFill();
//边框
this.graphics.moveTo(0,0);
this.graphics.lineStyle(1,0,.5);
this.graphics.lineTo(10*_rateX,0);
this.graphics.lineTo(10*_rateX,10*_rateY);
this.graphics.lineTo(0,10*_rateY);
this.graphics.lineTo(0,0);
//三角形
this.graphics.moveTo(5*_rateX,8*_rateY);
this.graphics.lineStyle(1,0,.5);
this.graphics.lineTo(8*_rateX,2*_rateY);
this.graphics.lineTo(2*_rateX,2*_rateY);
this.graphics.lineTo(5*_rateX,8*_rateY);
}
}
}
ComboBox下拉列表框类:
package
{
import controlsEvents.ComboBoxEvent;
import controlsEvents.OptionsListEvent;
import flash.display.Bitmap;
import flash.display.Shape;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
/**
* 下拉列表框类
* @author Jave.Lin
*/
public class ComboBox extends Control
{
private var _background:Shape;//背景
private var _glowFilter:GlowFilter;
private var _showSelectedItem:Option;//显示在当前选中框中的子项
private var _optionsList:OptionsList;
private var _dropDownBtn:ComboBoxDropDownButton;//下拉按钮
public override function get width():Number
{
return super.width;
}
public override function set width(value:Number):void
{
if(width!=value)
{
_w=value;
if(_w
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?