SHOW:
|
|
- or go back to the newest paste.
| 1 | package classes.com.main{
| |
| 2 | //import classes | |
| 3 | import flash.display.Sprite; | |
| 4 | import flash.text.TextField; | |
| 5 | import flash.text.TextFormat; | |
| 6 | import flash.text.TextFieldAutoSize; | |
| 7 | import flash.text.TextFieldType; | |
| 8 | import flash.text.AntiAliasType; | |
| 9 | import vau3.as3arabic.Arabic;// <---------------------------------- | |
| 10 | ||
| 11 | public class menuItem extends Sprite {
| |
| 12 | //vars | |
| 13 | private var _bg:Sprite=new Sprite(); | |
| 14 | public var _bgAct:Sprite=new Sprite(); | |
| 15 | private var _color:Sprite=new Sprite(); | |
| 16 | public var _colorActive:Sprite=new Sprite(); | |
| 17 | private var _holder:Sprite=new Sprite(); | |
| 18 | private var _text:TextField=new TextField(); | |
| 19 | private var _tf:TextFormat=new TextFormat(); | |
| 20 | ||
| 21 | public var wid:Number; | |
| 22 | public var type:String; | |
| 23 | public var url:String; | |
| 24 | public var urlType:String; | |
| 25 | public var deepLink:String; | |
| 26 | public var categoryID:String; | |
| 27 | ||
| 28 | ||
| 29 | //for sumenu | |
| 30 | public var subY:Number; | |
| 31 | public var mainHei:Number; | |
| 32 | ||
| 33 | /** | |
| 34 | *-> Constructor Method | |
| 35 | */ | |
| 36 | public function menuItem(bgCol:uint,bgAlpha:Number,txtSize:Number,txt:String,col:uint,colA:uint,bgAct:uint,tPad:Number,actHei:Number,sub:Boolean,sbLc:uint):void {
| |
| 37 | ||
| 38 | //text format | |
| 39 | _tf.font="euro"; | |
| 40 | _tf.size=txtSize; | |
| 41 | _tf.color=0x000000; | |
| 42 | ||
| 43 | var textPadding:Number=tPad; | |
| 44 | var activeHei:Number=actHei; | |
| 45 | var txtPad:Number=textPadding*2; | |
| 46 | ||
| 47 | //text filed | |
| 48 | _text.embedFonts=true; | |
| 49 | _text.type=TextFieldType.DYNAMIC; | |
| 50 | _text.autoSize=TextFieldAutoSize.LEFT; | |
| 51 | _text.antiAliasType=AntiAliasType.ADVANCED; | |
| 52 | _text.selectable=false; | |
| 53 | _text.defaultTextFormat=_tf; | |
| 54 | _text.text=txt; | |
| 55 | Arabic.flipArTxt(_text,_text);//<------------------------------------ | |
| 56 | _text.x=textPadding+3; | |
| 57 | _text.y=(textPadding+activeHei)-2; | |
| 58 | ||
| 59 | //background | |
| 60 | _bg.graphics.beginFill(bgCol); | |
| 61 | ||
| 62 | if(sub){
| |
| 63 | _bg.graphics.lineStyle(1,sbLc); | |
| 64 | } | |
| 65 | ||
| 66 | _bg.graphics.drawRect(0,0,_text.textWidth+(txtPad)+9,_text.textHeight+(txtPad)+(activeHei*3)); | |
| 67 | _bg.graphics.endFill(); | |
| 68 | _bg.alpha=bgAlpha; | |
| 69 | _bg.name="Background"; | |
| 70 | ||
| 71 | // background active | |
| 72 | _bgAct.graphics.beginFill(bgAct); | |
| 73 | _bgAct.graphics.drawRect(0,0,_bg.width,activeHei); | |
| 74 | _bgAct.graphics.endFill(); | |
| 75 | _bgAct.name="bgActive"; | |
| 76 | _bgAct.alpha=0; | |
| 77 | _bgAct.y=_bg.height-_bgAct.height; | |
| 78 | ||
| 79 | mainHei=_bg.height; | |
| 80 | ||
| 81 | //color | |
| 82 | _color.graphics.beginFill(col); | |
| 83 | _color.graphics.drawRect(0,0,_text.textWidth+(txtPad)+9,_text.textHeight+(txtPad)+(activeHei*3)); | |
| 84 | _color.graphics.endFill(); | |
| 85 | ||
| 86 | //color active | |
| 87 | _colorActive.graphics.beginFill(colA); | |
| 88 | _colorActive.graphics.drawRect(0,0,_text.textWidth+(txtPad)+9,_text.textHeight+(txtPad)+(activeHei*3)); | |
| 89 | _colorActive.graphics.endFill(); | |
| 90 | _colorActive.name="colorActive"; | |
| 91 | ||
| 92 | _colorActive.alpha=0; | |
| 93 | ||
| 94 | _holder.name="Holder"; | |
| 95 | _holder.addChild(_color); | |
| 96 | _holder.addChild(_colorActive); | |
| 97 | ||
| 98 | //mask | |
| 99 | _holder.mask=_text; | |
| 100 | ||
| 101 | //set vars | |
| 102 | wid=_bg.width; | |
| 103 | ||
| 104 | ||
| 105 | addChild(_bg); | |
| 106 | addChild(_bgAct); | |
| 107 | addChild(_holder); | |
| 108 | addChild(_text); | |
| 109 | ||
| 110 | ||
| 111 | } | |
| 112 | ||
| 113 | } | |
| 114 | } |