/*---------------- FILE HEADER --------------------------------------- This file is part of Geoide. Copyright (C) 2005-2006 by: IDgis B.V. http://www.idgis.nl This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: Herman Assink IDgis bv P.O. Box 15 7450 AA Holten The Netherlands E-Mail: herman.assink@idgis.nl * @version 1.4.0 * @author IDgis team * ------------------------------------------------------------------------*/ class nl.idgis.giclient.framework.bars.Bar extends MovieClip { private var name:String = null; // Set by init object. private var xRel:Number = 0; // Stage-relative position of the bar. Set by init object. private var yRel:Number = 0; // Stage-relative position of the bar. Set by init object. private var width:Number = 8 + 40 + 8; // Total width of the bar, excluding the shades. For positioning this one is used, instead of _width, because shades must not be taken into account. private var height:Number = 40; // Total height of the bar, excluding the shades. For positioning this one is used, instead of _height, because shades must not be taken into account. var backGround:Boolean = true; function onLoad():Void { Stage.addListener(this); if(backGround){ loadBarBackGround(); } } function loadBarBackGround(){ var initObject:Object = {bar: this}; attachMovie("BarBackGround", "backGround", 0, initObject); } function onLoadBarBackGround():Void { setLocation(xRel, yRel); } function onResize():Void { setLocation(xRel, yRel); } function getName():String { return name; } private function setWidth(width:Number):Void { this.width = width; this["backGround"].setWidth(); setLocation(xRel, yRel); } private function setLocation(xNew:Number, yNew:Number):Void { var absX:Number = 0; var absY:Number = 0; var stageWidth:Number = Stage.width; var stageHeight:Number = Stage.height; absX = (stageWidth * xNew / 100) - (width / 2); absY = (stageHeight * yNew / 100) - (height / 2); if (absX < 0) { absX = 0; } else if (absX + width > stageWidth) { absX = stageWidth - width; } if (absY < 0) { absY = 0; } else if (absY + height > stageHeight) { absY = stageHeight - height; } _x = absX; _y = absY; this.xRel = xNew; this.yRel = yNew; this["backGround"].setShadesAndColors(); } }