From 79670053c7247d3a49b607960efd284e93f057e5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:14:26 -0500 Subject: install.pl --- bPod/com/keywords/KeywordButton.as | 95 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 bPod/com/keywords/KeywordButton.as (limited to 'bPod/com/keywords/KeywordButton.as') diff --git a/bPod/com/keywords/KeywordButton.as b/bPod/com/keywords/KeywordButton.as new file mode 100644 index 0000000..aec9648 --- /dev/null +++ b/bPod/com/keywords/KeywordButton.as @@ -0,0 +1,95 @@ +import com.oop.UIButton; +import com.oop.SelectionSystem; +import mx.utils.Delegate; + +import mx.transitions.easing.*; +import mx.transitions.Tween; + +class com.keywords.KeywordButton extends UIButton +{ + private var title_mc:MovieClip; + private var desc_mc:MovieClip; + private var icon_mc:MovieClip; + private var bg_mc:MovieClip; + private var gridObj:Object; + private var shine_mc:MovieClip; + private var element_mc:MovieClip; + private var initialAlpha:Number = 60; + private var initialShine:Number = 30; + private var tint:Number; + + public var elementSymbol:String; + + private var installedX:Number = 0; + private var installedY:Number = 0; + + public function KeywordButton() {} + + public function init(_selectionSystem:SelectionSystem, _id:Number, _itemData:Object, _gridObj:Object ):Void { + gridObj = _gridObj; + super.init (_selectionSystem, _id, _itemData); + makeButton(itemData); + } + + public function hashColor (_inStr:String):Number { + switch (_inStr) { + case "ivory": return (0xE0E0D8); + case "orange": return (0xFFD799); + case "yellow": return (0xFFF7A8); + case "green": return (0xDAF4B2); + case "blue": return (0xCCCCFF); + case "purple": return (0xDDB1FF); + case "pink": return (0xFFAECD); + case "plain": return (0xE6f0f0); + default: return (0xFFFFFF); + } + } + + + private function makeButton(_val:Object):Void { + icon_mc._alpha = initialAlpha; + shine_mc._alpha = initialShine; + title_mc.title_txt.text = _val.name.toLowerCase(); + + var c:String = _val.name.charAt(0); // b + var cc:String = _val.name.charAt(1); // u + var u:String = c.toUpperCase(); // B (if b) + var uu:String = cc.toLowerCase(); // u (if U) + var tmp:String = u.concat (uu); // Bu + + element_mc.element_txt.text = tmp; + + elementSymbol = tmp; + + + var tmpColor:Number = hashColor ( _val.color.toString() ); + element_mc.element_txt.textColor = tmpColor; // &= 0x7F7F7F; + setPosition(); + } + + private function setPosition():Void { + _x = Math.round ( (gridObj.grid_x * _width) + (gridObj.horizSpace * gridObj.grid_x)); + _y = Math.round ( ((gridObj.grid_y-1) * _height) + (gridObj.vertSpace * (gridObj.grid_y-1))); + + installedX = _x; + installedY = _y; + } + + private function handleRollOver():Void { + var tTween = new Tween(icon_mc, "_alpha", Regular.easeOut, icon_mc._alpha, 100, 1, true); + var shineTween = new Tween(shine_mc, "_alpha", Regular.easeOut, shine_mc._alpha, 0, .2, true); + } + + private function handleRollOut():Void + { + if(visited) { var fadeVal:Number = initialAlpha; } + else { var fadeVal:Number = initialAlpha; } + + var tTween = new Tween (icon_mc, "_alpha", Regular.easeOut, icon_mc._alpha, initialAlpha, 1, true); + var shineTween = new Tween (shine_mc, "_alpha", Regular.easeOut, shine_mc._alpha, initialShine, .2, true); + } + + public function setSelected():Void + { + } +} \ No newline at end of file -- cgit v1.2.3-70-g09d2