TextFieldにスクロールバー *修正とか色々
zahirです。
スクロールバーの長さを決定する計算をトチ狂ってました。
多分、これで修正できたと思います。
機能追加(笑)
一つ矢印を押しっぱなしで連続スクロールできるようにしました。
テキストを編集したときにスクロールバーの長さ・位置を修正するようにしました。
いつかライブラリ化できそうな感じにいろいろ変更してみた。
2009/7/28 zahir
/**
* Copyright zahir ( http://wonderfl.net/user/zahir )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mfNA
*/
package{
/*
* zahirです。
* スクロールバーの長さを決定する計算をトチ狂ってました。
* 多分、これで修正できたと思います。
*
* 機能追加(笑)
* 一つ矢印を押しっぱなしで連続スクロールできるようにしました。
* テキストを編集したときにスクロールバーの長さ・位置を修正するようにしました。
* いつかライブラリ化できそうな感じにいろいろ変更してみた。
*
* 2009/7/28 zahir
*
* */
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;
import flash.text.AntiAliasType;
import flash.text.TextFieldType;
[SWF(width=465, height = 465, backgroundColor = 0x666666)]
public class SimpleTextBox extends Sprite{
public function SimpleTextBox(){
var str:String = "";
str = "line 1"+ " :: ";
for(var i:int = 2; i<=25; i++)
str += "\n"+ "line " + String( i ) + " :: ";
var tb:TextBox = new TextBox( 320, 180, "text", str);
addChild( tb );
tb.x = (stage.stageWidth - tb.width) >>1;
tb.y = (stage.stageHeight - tb.height) >>1;
tb.setTFColor(0, true, 0xCCCCCC, true, 0x111111 );
tb.selectable = true;
tb.type = flash.text.TextFieldType.INPUT;
tb.multiLine = true;
tb.wordWrap = true;
}
}
}
import flash.display.CapsStyle;
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.MouseEvent;
import flash.events.TextEvent;
import flash.geom.Matrix;
import flash.geom.Rectangle;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextLineMetrics;
import flash.text.StyleSheet;
import flash.ui.Mouse;
import mx.skins.Border;
import flash.text.TextFieldAutoSize;
class TextBox extends Sprite{
private var g:Graphics;
private var t:TextField;
private var bg:Sprite;
private var tw:int, th:int;
private var maxV:int, maxH:int;
private var showHScroll:String;
private var showVScroll:String;
private var hScrollbar:TextBoxHScrollBar;
private var vScrollBar:TextBoxVScrollBar;
private var fillFlg:Boolean = false;
private var fillType:String = "none";
private var fillColor:uint = 0xFFFFFF;
public var strokeFlg:Boolean = false;
public var strokeThickness:Number = 0;
private var strokeColor:Array = [0x000000, 0x000000, 0x000000, 0x000000];
private var barWidth:int = 18;
public function TextBox( width:int, height:int, textType:String = "text", text:String = "", showHScrollBar:String = "auto", showVScrollBar:String = "auto" ){
bg = new Sprite();
addChild( bg );
g = bg.graphics;
t = new TextField();
addChild(t);
t.width = width;
t.height = height;
if(textType.toLocaleLowerCase() == "html") t.htmlText = text;
else t.text = text;
showHScroll = showHScrollBar.toLocaleLowerCase();
showVScroll = showVScrollBar.toLocaleLowerCase();
vScrollBar = new TextBoxVScrollBar(t, barWidth, height);
addChild( vScrollBar );
vScrollBar.x = width - barWidth;
addEvents();
checkScrollV();
}
private function addEvents():void{
t.addEventListener(Event.SCROLL, onScroll);
t.addEventListener(Event.CHANGE, onChange );
}
/**
* Change Event
* */
private function onChange(e:Event):void{
checkScrollV();
vScrollBar.onSliderResize();
}
private function onScroll(e:Event):void{
}
private function rClick(e:MouseEvent):void{
}
private function checkScrollV():void{
if(t.textHeight > t.height && showVScroll == "auto"){
vScrollBar.visible = true;
}else if(t.textHeight <= t.height && showVScroll == "auto"){
vScrollBar.visible = false;
}else if(showVScroll == "on"){
vScrollBar.visible = true;
if(t.textHeight <= t.height ) vScrollBar.sliderVisivle = false;
else vScrollBar.sliderVisivle = true;
}
}
public function get strokeColors():Array{
return strokeColor;
}
public function set strokeColors( arr:Array):void{
strokeColor = arr;
}
public function get strokeLeftColor():uint{
return strokeColor[0];
}
public function set strokeLeftColor( value:uint ):void{
strokeColor[0] = value;
}
public function get strokeTopColor():uint{
return strokeColor[1];
}
public function set strokeTopColor( value:uint ):void{
strokeColor[1] = value;
}
public function get strokeRightColor():uint{
return strokeColor[2];
}
public function set strokeRightColor( value:uint ):void{
strokeColor[2] = value;
}
public function get strokeBottomColor():uint{
return strokeColor[3];
}
public function set strokeBottomColor( value:uint ):void{
strokeColor[3] = value;
}
// とりあえず打ってみた。
public function set textField( tf:TextField ):void{
t = tf;
}
public function get text():String{
return t.text;
}
public function set text( value:String ):void{
t.text = value;
}
public function get htmlText():String{
return t.htmlText;
}
public function set htmlText( value:String ):void{
t.htmlText = value;
}
public function get TextFieldWidth():int{
return t.width;
}
public function set TextFieldWidth( value:int ):void{
t.width = value;
}
public function get TextFieldHeight():int{
return t.height;
}
public function set TextFieldHeight( value:int ):void{
t.height = value;
}
// Read Only
public function get bottomScrollV():int{ return t.bottomScrollV; }
public function get caretIndex():int{ return t.caretIndex; }
public function get length():int{ return t.length; }
public function get maxScrollH():int{ return t.maxScrollH; }
public function get maxScrollV():int{ return t.maxScrollV; }
public function get textWidth():int{ return t.textWidth; }
public function get textHeight():int{ return t.textHeight; }
// Format
public function get textFormat():TextFormat{
return t.defaultTextFormat;
}
public function set textFormat( elm:TextFormat ):void{
t.defaultTextFormat = elm;
}
public function setTextFormat( format:TextFormat, beginIndex:int = -1, endIndex:int = -1):void{
t.setTextFormat( format, beginIndex, endIndex);
}
public function get alwaysShowSelection():Boolean{
return t.alwaysShowSelection;
}
public function set alwaysShowSelection( flg:Boolean ):void{
t.alwaysShowSelection = flg;
}
public function get antiAliasType():String{
return t.antiAliasType;
}
public function set antiAliasType( value:String ):void{
t.antiAliasType = value;
}
public function get condenseWhite():Boolean{
return t.condenseWhite;
}
public function set condenseWhite( flg:Boolean ):void{
t.condenseWhite = flg;
}
public function get displayAsPassword():Boolean{
return t.displayAsPassword;
}
public function set displayAsPassword( flg:Boolean ):void{
t.displayAsPassword = flg;
}
public function get embedFonts():Boolean{
return t.embedFonts;
}
public function set embedFonts( flg:Boolean ):void{
t.embedFonts = flg;
}
public function get gridFitType():String{
return t.gridFitType;
}
public function set gridFitType( value:String ):void{
t.gridFitType = value;
}
public function get maxChars():int{
return t.maxChars;
}
public function set maxChars( value:int ):void{
t.maxChars = value;
}
public function get mouseWheelEnabled():Boolean{
return t.mouseWheelEnabled;
}
public function set mouseWheelEnabled( flg:Boolean ):void{
t.mouseWheelEnabled = flg;
}
public function get multiLine():Boolean{
return t.multiline;
}
public function set multiLine( flg:Boolean ):void{
t.multiline = flg;
}
public function get restrict():String{
return t.restrict;
}
public function set restrict( value:String ):void{
t.restrict = value;
}
public function get scrollH():int{
return t.scrollH;
}
public function set scrollH( value:int ):void{
t.scrollH = value;
}
public function get scrollV():int{
return t.scrollV;
}
public function set scrollV( value:int ):void{
t.scrollV = value;
}
public function get selectable():Boolean{
return t.selectable;
}
public function set selectable( flg:Boolean ):void{
t.selectable = flg;
}
public function get sharpness():int{
return t.sharpness;
}
public function set sharpness( value:int ):void{
t.sharpness = value;
}
public function get styleSheet():StyleSheet{
return t.styleSheet;
}
public function set styleSheet( data:StyleSheet ):void{
t.styleSheet = data;
}
public function get thickness():Number{
return t.thickness;
}
public function set thickness( value:Number ):void{
t.thickness = value;
}
public function get type():String{
return t.type;
}
public function set type( value:String ):void{
t.type = value;
}
public function get useRichTextClipboard():Boolean{
return t.useRichTextClipboard;
}
public function set useRichTextClipboard( flg:Boolean ):void{
t.useRichTextClipboard = flg;
}
public function get wordWrap():Boolean{
return t.wordWrap;
}
public function set wordWrap( flg:Boolean ):void{
t.wordWrap = flg;
}
// TextField Color's
public function setTFColor( textColor:uint = 0x000000, background:Boolean = false, backgroundColor:uint = 0xFFFFFF, border:Boolean = false, borderColor:uint = 0x000000):void{
t.textColor = textColor;
t.background = background;
t.backgroundColor = backgroundColor;
t.border = border;
t.borderColor = borderColor;
}
public function get textColor():uint{
return t.textColor;
}
public function set textColor( value:uint ):void{
t.textColor = value;
}
public function get background():Boolean{
return t.background;
}
public function set background( flg:Boolean ):void{
t.background = flg;
}
public function get backgroundColor():uint{
return t.backgroundColor;
}
public function set backgroundColor( value:uint ):void{
t.backgroundColor = value;
}
public function get border():Boolean{
return t.border;
}
public function set border( flg:Boolean ):void{
t.border = flg;
}
public function get borderColor():uint{
return t.borderColor;
}
public function set borderColor( value:uint ):void{
t.borderColor = value;
}
public function appendText( txt:String ):void{
t.appendText( txt );
}
public function getCharBoundaries(charIndex:int):Rectangle{
return t.getCharBoundaries(charIndex);
}
public function getCharIndexAtPoint(x:Number, y:Number):int{
return getCharIndexAtPoint(x, y);
}
public function getFirstCharInParagraph(charIndex:int):int{
return getFirstCharInParagraph(charIndex);
}
public function getImageReference(id:String):DisplayObject{
return t.getImageReference(id);
}
public function getLineIndexAtPoint(x:Number, y:Number):int{
return t.getLineIndexAtPoint(x, y);
}
public function getLineIndexOfChar(charIndex:int):int{
return t.getLineIndexOfChar(charIndex);
}
public function getLineLength(lineIndex:int):int{
return t.getLineLength(lineIndex);
}
public function getLineMetrics(lineIndex:int):TextLineMetrics{
return t.getLineMetrics(lineIndex);
}
public function getLineOffset(lineIndex:int):int{
return t.getLineOffset(lineIndex);
}
public function getLineText(lineIndex:int):String{
return t.getLineText( lineIndex );
}
public function getParagraphLength(charIndex:int):int{
return t.getParagraphLength( charIndex );
}
public function getTextFormat(beginIndex:int = -1, endIndex:int = -1):TextFormat{
return t.(beginIndex, endIndex);
}
public function replaceSelectedText(value:String):void{
t.replaceSelectedText( value );
}
public function replaceText(beginIndex:int, endIndex:int, newText:String):void{
t.replaceText(beginIndex, endIndex, newText );
}
public function setSelection(beginIndex:int, endIndex:int):void{
t.setSelection(beginIndex, endIndex);
}
}
class TextBoxHScrollBar extends Sprite{
}
class TextBoxVScrollBar extends Sprite{
private var t:TextField;
private var w:int, h:int;
// Line
private var lineHeight:Number;
// item
private var up:UpArrow;
private var down:DownArrow;
private var top:TopArrow;
private var bottom:BottomArrow;
private var slider:TextBoxVSlider;
public function TextBoxVScrollBar( target:TextField , width:int, height:int){
t = target;
w = width;
h = height;
var m:Matrix = new Matrix();
m.createGradientBox( w, h);
var g:Graphics = this.graphics;
g.lineStyle(0, 0x111111 );
g.beginGradientFill( "linear", [ 0x999999, 0x777777],[1.0,1.0],[0,255],m);
g.drawRect(0, 0, w, h );
g.endFill()
initGUI();
}
private function initGUI():void{
up = new UpArrow( w );
down = new DownArrow( w );
top = new TopArrow( w );
bottom = new BottomArrow( w );
up.y = top.height;
bottom.y = h - down.height;
down.y = h - down.height - bottom.height;
var d:Number = down.y - (up.y + up.height);
d *= ( t.height / t.textHeight);
d = d < 5 ? 5 : d;
slider = new TextBoxVSlider( w , d );
slider.y = minY = up.y + up.height + 2;
maxY = (down.y - d) - 2;
lineHeight = (maxY - minY) / ( t.maxScrollV -1);
addChild(slider);
addChild( top );
addChild( bottom );
addChild( up );
addChild( down );
slider.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
cY = slider.mouseY;
slider.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
slider.stage.addEventListener(MouseEvent.MOUSE_UP, offMove);
});
top.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void{
t.scrollV = 1;
slider.y = minY;
});
bottom.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void{
t.scrollV = t.maxScrollV;
slider.y = maxY;
});
up.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
up.stage.addEventListener(MouseEvent.MOUSE_UP, onUpUp);
addEventListener(Event.ENTER_FRAME, upEnter );
});
down.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
down.stage.addEventListener(MouseEvent.MOUSE_UP, onUpDown);
addEventListener(Event.ENTER_FRAME, downEnter );
});
t.addEventListener(Event.SCROLL, function(e:Event):void{
slider.y = (t.scrollV -1) * lineHeight + minY;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
var pos:int = mouseY;
if(pos <= minY) return;
if(pos >= maxY + slider.height) return;
if( pos >= slider.y && pos <= (slider.y + slider.height)) return
if(pos >= maxY) pos -= slider.height;
slider.y = pos;
t.scrollV = int((pos - minY) / lineHeight) + 1;
stage.addEventListener( MouseEvent.MOUSE_MOVE, exMove);
stage.addEventListener( MouseEvent.MOUSE_UP, exMoveOff);
});
function exMove(e:MouseEvent ):void{
var pos:int = mouseY;
if(pos<= minY) pos = minY;
if(pos >= maxY) pos = maxY;
slider.y = pos;
t.scrollV = int((pos - minY) / lineHeight) + 1;
}
function exMoveOff(e:MouseEvent):void{
stage.removeEventListener( MouseEvent.MOUSE_MOVE, exMove);
stage.removeEventListener( MouseEvent.MOUSE_UP, exMoveOff);
}
}
private function onUpUp(e:MouseEvent):void{
up.stage.removeEventListener(MouseEvent.MOUSE_UP, onUpUp);
removeEventListener(Event.ENTER_FRAME, upEnter );
}
private function onUpDown(e:MouseEvent):void{
down.stage.removeEventListener(MouseEvent.MOUSE_UP, onUpUp);
removeEventListener(Event.ENTER_FRAME, downEnter );
}
private function upEnter(e:Event):void{
if( !(t.scrollV > 1) ) return
t.scrollV = t.scrollV - 1;
slider.y -= lineHeight;
if(slider.y < minY) slider.y = minY;
}
private function downEnter(e:Event):void{
if( !(t.scrollV < t.maxScrollV) ) return
t.scrollV = t.scrollV + 1;
slider.y += lineHeight;
if(slider.y > maxY) slider.y = maxY;
}
private var cY:int;
private var minY:int;
private var maxY:int;
private function onMove(e:MouseEvent):void{
var yy:int = mouseY - cY;
if(yy <= minY) yy = minY;
if(yy >= maxY) yy = maxY;
slider.y = yy;
t.scrollV = int((yy - minY) / lineHeight) + 1;
}
private function offMove(e:MouseEvent):void{
slider.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMove);
slider.stage.removeEventListener(MouseEvent.MOUSE_UP, offMove);
}
public function onSliderResize():void{
var d:Number = down.y - (up.y + up.height);
d *= ( t.height / t.textHeight);
slider.SliderHeight = d = d < 5 ? 5 : d;
maxY = (down.y - d) - 2;
lineHeight = (maxY - minY) / ( t.maxScrollV -1);
var yy:int = (t.scrollV - 1) * lineHeight + minY;
if(yy <= minY) yy = minY;
if(yy >= maxY) yy = maxY;
slider.y = yy;
}
public function set sliderVisivle( flg:Boolean):void{
slider.visible = flg;
}
}
class TextBoxVSlider extends Sprite{
private var w:int, h:Number;
private var w_2:int;
private var md_flg:Boolean = false;
private var g:Graphics;
public function get SliderHeight():Number{
return h;
}
public function set SliderHeight( value:Number ):void{
h = value < 5 ? 5 :value;
drawUp();
}
public function TextBoxVSlider( width:int, height:int ){
w = width;
h = height < 5 ? 5 : height;
w_2 = (w>>1) + 2;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
if(md_flg) return;
drawOver();
addEventListener( MouseEvent.ROLL_OUT, onOut);
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
md_flg = true;
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onOut(e:MouseEvent):void{
removeEventListener( MouseEvent.MOUSE_OUT, onOut);
if(md_flg) return;
drawUp();
}
private function onUp(e:MouseEvent):void{
drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle( 0 , 0, 1, true, "normal", flash.display.CapsStyle.ROUND);
g.beginFill( 0x333333 );
g.drawRoundRect(2,0, w - 4, h , 5,5);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle( 0 , 0x0099FF, 1, true, "normal", flash.display.CapsStyle.ROUND);
g.beginFill( 0x111111 );
g.drawRoundRect(2,0, w-4, h , 3,3);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle( 0 , 0, 1, true, "normal", flash.display.CapsStyle.ROUND);
g.beginFill( 0xCCCCCC );
g.drawRoundRect(2,0, w-4, h , 3,3);
g.endFill();
}
}
class ButtonColor{
// up
private static const DEFAULT_UP_BORDER_COLOR:uint = 0x111111;
private static const DEFAULT_UP_FILL_COLOR:uint = 0x333333;
private static const DEFAULT_UP_ARROW_BORDER_COLOR:uint = 0x333333;
private static const DEFAULT_UP_ARROW_FILL_COLOR:uint = 0xCCCCCC;
public static var UpArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var UpArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var UpArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var UpArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
public static var DownArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var DownArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var DownArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var DownArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
public static var GoArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var GoArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var GoArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var GoArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
public static var BackArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var BackArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var BackArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var BackArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
public static var LeftArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var LeftArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var LeftArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var LeftArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
public static var TopArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var TopArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var TopArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var TopArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
public static var RightArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var RightArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var RightArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var RightArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
public static var BottomArrow_UP_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var BottomArrow_UP_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var BottomArrow_UP_Arrow_BoderColor:uint = DEFAULT_UP_ARROW_BORDER_COLOR;
public static var BottomArrow_UP_Arrow_FillColor:uint = DEFAULT_UP_ARROW_FILL_COLOR;
// down
private static const DEFAULT_DOWN_BORDER_COLOR:uint = 0x0099FF;
private static const DEFAULT_DOWN_FILL_COLOR:uint = 0x000000;
private static const DEFAULT_DOWN_ARROW_BORDER_COLOR:uint = 0x111111;
private static const DEFAULT_DOWN_ARROW_FILL_COLOR:uint = 0xFFFFFF;
public static var UpArrow_DOWN_BorderColor:uint = DEFAULT_DOWN_BORDER_COLOR;
public static var UpArrow_DOWN_FillColor:uint = DEFAULT_DOWN_FILL_COLOR;
public static var UpArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var UpArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
public static var DownArrow_DOWN_BorderColor:uint = DEFAULT_DOWN_BORDER_COLOR;
public static var DownArrow_DOWN_FillColor:uint = DEFAULT_DOWN_FILL_COLOR;
public static var DownArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var DownArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
public static var GoArrow_DOWN_BorderColor:uint = DEFAULT_UP_BORDER_COLOR;
public static var GoArrow_DOWN_FillColor:uint = DEFAULT_UP_FILL_COLOR;
public static var GoArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var GoArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
public static var BackArrow_DOWN_BorderColor:uint = DEFAULT_DOWN_BORDER_COLOR;
public static var BackArrow_DOWN_FillColor:uint = DEFAULT_DOWN_FILL_COLOR;
public static var BackArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var BackArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
public static var LeftArrow_DOWN_BorderColor:uint = DEFAULT_DOWN_BORDER_COLOR;
public static var LeftArrow_DOWN_FillColor:uint = DEFAULT_DOWN_FILL_COLOR;
public static var LeftArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var LeftArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
public static var TopArrow_DOWN_BorderColor:uint = DEFAULT_DOWN_BORDER_COLOR;
public static var TopArrow_DOWN_FillColor:uint = DEFAULT_DOWN_FILL_COLOR;
public static var TopArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var TopArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
public static var RightArrow_DOWN_BorderColor:uint = DEFAULT_DOWN_BORDER_COLOR;
public static var RightArrow_DOWN_FillColor:uint = DEFAULT_DOWN_FILL_COLOR;
public static var RightArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var RightArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
public static var BottomArrow_DOWN_BorderColor:uint = DEFAULT_DOWN_BORDER_COLOR;
public static var BottomArrow_DOWN_FillColor:uint = DEFAULT_DOWN_FILL_COLOR;
public static var BottomArrow_DOWN_Arrow_BoderColor:uint = DEFAULT_DOWN_ARROW_BORDER_COLOR;
public static var BottomArrow_DOWN_Arrow_FillColor:uint = DEFAULT_DOWN_ARROW_FILL_COLOR;
// over
private static const DEFAULT_OVER_BORDER_COLOR:uint = 0x111111;
private static const DEFAULT_OVER_FILL_COLOR:uint = 0x333333;
private static const DEFAULT_OVER_ARROW_BORDER_COLOR:uint = 0x111111;
private static const DEFAULT_OVER_ARROW_FILL_COLOR:uint = 0xFFFFFF;
public static var UpArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var UpArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var UpArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var UpArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
public static var DownArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var DownArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var DownArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var DownArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
public static var GoArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var GoArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var GoArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var GoArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
public static var BackArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var BackArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var BackArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var BackArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
public static var LeftArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var LeftArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var LeftArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var LeftArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
public static var TopArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var TopArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var TopArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var TopArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
public static var RightArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var RightArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var RightArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var RightArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
public static var BottomArrow_OVER_BorderColor:uint = DEFAULT_OVER_BORDER_COLOR;
public static var BottomArrow_OVER_FillColor:uint = DEFAULT_OVER_FILL_COLOR;
public static var BottomArrow_OVER_Arrow_BoderColor:uint = DEFAULT_OVER_ARROW_BORDER_COLOR;
public static var BottomArrow_OVER_Arrow_FillColor:uint = DEFAULT_OVER_ARROW_FILL_COLOR;
}
class UpArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.UpArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.UpArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.UpArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.UpArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.UpArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.UpArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.UpArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.UpArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.UpArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.UpArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.UpArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.UpArrow_OVER_Arrow_FillColor;
public function UpArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, upArrowBorderColor);
g.beginFill( upArrowFillColor );
g.moveTo( w/2, 5 );
g.lineTo(3, h - 5 );
g.lineTo( w - 3 , h- 5);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 1, 1, w - 2, h -2 );
g.endFill();
g.lineStyle(0, downArrowBorderColor );
g.beginFill( downArrowFillColor );
g.moveTo( w/2, 6 );
g.lineTo(3, h - 4 );
g.lineTo( w - 3 , h- 4);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.moveTo( w/2, 5 );
g.lineTo(3, h - 5 );
g.lineTo( w - 3 , h- 5);
g.endFill();
}
}
class DownArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.DownArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.DownArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.DownArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.DownArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.DownArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.DownArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.DownArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.DownArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.DownArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.DownArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.DownArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.DownArrow_OVER_Arrow_FillColor;
public function DownArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, upArrowBorderColor);
g.beginFill( upArrowFillColor );
g.moveTo( w/2, h - 5 );
g.lineTo(3, 5 );
g.lineTo( w - 3 , 5);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 1, 1, w-2, h-2 );
g.endFill();
g.lineStyle(0, downArrowBorderColor);
g.beginFill( downArrowFillColor );
g.moveTo( w/2, h - 4 );
g.lineTo(3, 6 );
g.lineTo( w - 3 , 6);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.moveTo( w/2, h - 5 );
g.lineTo(3, 5 );
g.lineTo( w - 3 , 5);
g.endFill();
}
}
/**
* GoArrow
* */
class GoArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.DownArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.DownArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.DownArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.DownArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.DownArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.DownArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.DownArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.DownArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.DownArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.DownArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.DownArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.DownArrow_OVER_Arrow_FillColor;
public function GoArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, upArrowBorderColor);
g.beginFill( upArrowFillColor );
g.moveTo( w/2, h - 5 );
g.lineTo(3, 5 );
g.lineTo( w - 3 , 5);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 1, 1, w-2, h-2 );
g.endFill();
g.lineStyle(0, downArrowBorderColor);
g.beginFill( downArrowFillColor );
g.moveTo( w/2, h - 4 );
g.lineTo(3, 6 );
g.lineTo( w - 3 , 6);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.lineTo(3, 5 );
g.lineTo( w - 3 , 5);
g.endFill();
}
}
/**
* BackArrow
* */
class BackArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.DownArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.DownArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.DownArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.DownArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.DownArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.DownArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.DownArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.DownArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.DownArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.DownArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.DownArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.DownArrow_OVER_Arrow_FillColor;
public function BackArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, upArrowBorderColor);
g.beginFill( upArrowFillColor );
g.moveTo( w/2, h - 5 );
g.lineTo(3, 5 );
g.lineTo( w - 3 , 5);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 1, 1, w-2, h-2 );
g.endFill();
g.lineStyle(0, downArrowBorderColor);
g.beginFill( downArrowFillColor );
g.moveTo( w/2, h - 4 );
g.lineTo(3, 6 );
g.lineTo( w - 3 , 6);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.moveTo( w/2, h - 5 );
g.lineTo(3, 5 );
g.lineTo( w - 3 , 5);
g.endFill();
}
}
/**
* LeftArrow
* */
class LeftArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.DownArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.DownArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.DownArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.DownArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.DownArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.DownArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.DownArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.DownArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.DownArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.DownArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.DownArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.DownArrow_OVER_Arrow_FillColor;
public function LeftArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, upArrowBorderColor);
g.beginFill( upArrowFillColor );
g.moveTo( 3, h/2 );
g.lineTo(8, 4);
g.lineTo( 8 , h-4);
g.moveTo( 10, h/2 );
g.lineTo(w - 3, 4);
g.lineTo( w-3 , h-4);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, downArrowBorderColor);
g.beginFill( downArrowFillColor );
g.moveTo( 3, h/2 );
g.lineTo(8, 4);
g.lineTo( 8 , h-4);
g.moveTo( 10, h/2 );
g.lineTo(w-3, 4);
g.lineTo( w-3 , h-4);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.moveTo( 3, h/2 );
g.lineTo(8, 4);
g.lineTo( 8 , h-4);
g.moveTo( 10, h/2 );
g.lineTo(w-3, 4);
g.lineTo( w-3 , h-4);
g.endFill();
}
}
/**
* TopArrow
* */
class TopArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.DownArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.DownArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.DownArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.DownArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.DownArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.DownArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.DownArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.DownArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.DownArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.DownArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.DownArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.DownArrow_OVER_Arrow_FillColor;
public function TopArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.beginFill( 0xCCCCCC );
g.moveTo( w/2, 3 );
g.lineTo(4, 8 );
g.lineTo( w - 4 , 8);
g.moveTo( w/2, 10 );
g.lineTo(4, h - 3 );
g.lineTo( w - 4 , h - 3);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 1, 1, w-2, h-2 );
g.endFill();
g.lineStyle(0, downArrowBorderColor);
g.beginFill( downArrowFillColor );
g.moveTo( w/2, 3 );
g.lineTo(4, 8 );
g.lineTo( w - 4 , 8);
g.moveTo( w/2, 10 );
g.lineTo(4, h - 3 );
g.lineTo( w - 4 , h - 3);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.moveTo( w/2, 3 );
g.lineTo(4, 8 );
g.lineTo( w - 4 , 8);
g.moveTo( w/2, 10 );
g.lineTo(4, h - 3 );
g.lineTo( w - 4 , h - 3);
g.endFill();
}
}
/**
* RightArrow
* */
class RightArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.DownArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.DownArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.DownArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.DownArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.DownArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.DownArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.DownArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.DownArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.DownArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.DownArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.DownArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.DownArrow_OVER_Arrow_FillColor;
public function RightArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, upArrowBorderColor);
g.beginFill( upArrowFillColor );
g.moveTo( 8, h/2 );
g.lineTo(3, 4);
g.lineTo( 3 , h-4);
g.moveTo( w-3, h/2 );
g.lineTo(10, 4);
g.lineTo( 10 , h-4);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, downArrowBorderColor);
g.beginFill( downArrowFillColor );
g.moveTo( 8, h/2 );
g.lineTo(3, 4);
g.lineTo( 3 , h-4);
g.moveTo( w-3, h/2 );
g.lineTo(10, 4);
g.lineTo( 10 , h-4);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.moveTo( 8, h/2 );
g.lineTo(3, 4);
g.lineTo( 3 , h-4);
g.moveTo( w-3, h/2 );
g.lineTo(10, 4);
g.lineTo( 10 , h-4);
g.endFill();
}
}
/**
* BottomArrow
* */
class BottomArrow extends Sprite{
private var w:int, h:int;
private var g:Graphics;
private var flg:Boolean = false;
private var upBorderColor:uint = ButtonColor.DownArrow_UP_BorderColor;
private var upFillColor:uint = ButtonColor.DownArrow_UP_FillColor;
private var upArrowBorderColor:uint = ButtonColor.DownArrow_UP_Arrow_BoderColor;
private var upArrowFillColor:uint = ButtonColor.DownArrow_UP_Arrow_FillColor;
private var downBorderColor:uint = ButtonColor.DownArrow_DOWN_BorderColor;
private var downFillColor:uint = ButtonColor.DownArrow_DOWN_FillColor;
private var downArrowBorderColor:uint = ButtonColor.DownArrow_DOWN_Arrow_BoderColor;
private var downArrowFillColor:uint = ButtonColor.DownArrow_DOWN_Arrow_FillColor;
private var overBorderColor:uint = ButtonColor.DownArrow_OVER_BorderColor;
private var overFillColor:uint = ButtonColor.DownArrow_OVER_FillColor;
private var overArrowBorderColor:uint = ButtonColor.DownArrow_OVER_Arrow_BoderColor;
private var overArrowFillColor:uint = ButtonColor.DownArrow_OVER_Arrow_FillColor;
public function BottomArrow( size:int ){
w = h = size;
g = this.graphics;
drawUp();
this.addEventListener( MouseEvent.ROLL_OVER, function(e:MouseEvent):void{
drawOver();
flg = true;
});
this.addEventListener( MouseEvent.ROLL_OUT, function(e:MouseEvent):void{
drawUp();
flg = false;
});
this.addEventListener( MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
drawDown();
stage.addEventListener(MouseEvent.MOUSE_UP, onUp);
});
}
private function onUp(e:MouseEvent):void{
flg ? drawOver() : drawUp();
stage.removeEventListener(MouseEvent.MOUSE_UP, onUp);
}
private function drawUp():void{
g.clear();
g.lineStyle(0, upBorderColor);
g.beginFill( upFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, upArrowBorderColor);
g.beginFill( upArrowFillColor );
g.moveTo( w/2, 8 );
g.lineTo(4, 3 );
g.lineTo( w - 4 , 3);
g.moveTo( w/2, h - 3 );
g.lineTo(4, 10);
g.lineTo( w - 4 , 10);
g.endFill();
}
private function drawDown():void{
g.clear();
g.lineStyle(0, downBorderColor);
g.beginFill( downFillColor );
g.drawRect( 1, 1, w-2, h-2 );
g.endFill();
g.lineStyle(0, downArrowBorderColor);
g.beginFill( downArrowFillColor );
g.moveTo( w/2, 8 );
g.lineTo(4, 3 );
g.lineTo( w - 4 , 3);
g.moveTo( w/2, h - 3 );
g.lineTo(4, 10);
g.lineTo( w - 4 , 10);
g.endFill();
}
private function drawOver():void{
g.clear();
g.lineStyle(0, overBorderColor);
g.beginFill( overFillColor );
g.drawRect( 0, 0, w, h );
g.endFill();
g.lineStyle(0, overArrowBorderColor);
g.beginFill( overArrowFillColor );
g.moveTo( w/2, 8 );
g.lineTo(4, 3 );
g.lineTo( w - 4 , 3);
g.moveTo( w/2, h - 3 );
g.lineTo(4, 10);
g.lineTo( w - 4 , 10);
g.endFill();
}
}