/* This is the FlAniS -- Flash version of the AnimationS applet. This code is Copyright(C) 2008-2010 by Tom Whittaker. You may use this for any lawful purpose, and we are not responsible for what you do with it. It was developed as an outcome of the VISIT Project and uses many methods and ideas from the VISITview collaborative training / distance learning tool. */ // this is compiled with the mxmlc using the flanis.mxml template... // package { import mx.controls.Button; import mx.controls.CheckBox; import mx.controls.ComboBox; import mx.controls.Label; import mx.controls.HSlider; import mx.controls.RadioButton; import mx.controls.RadioButtonGroup; import mx.controls.ProgressBar; import mx.controls.Alert; import mx.controls.TextArea; import mx.core.*; import mx.containers.HBox; import mx.containers.VBox; import mx.containers.Canvas; import mx.containers.Panel; import mx.containers.TitleWindow; import mx.core.UIComponent; import mx.events.SliderEvent; import mx.events.ListEvent; import mx.events.CloseEvent; import mx.utils.StringUtil; import mx.formatters.NumberFormatter; import flash.display.Loader; import flash.display.Bitmap; import flash.display.Sprite; import flash.display.BitmapData; import flash.display.Graphics; import flash.display.SimpleButton; import flash.display.Shape; import flash.events.Event; import flash.events.EventPhase; import flash.events.MouseEvent; import flash.events.KeyboardEvent; import flash.events.IOErrorEvent; import flash.events.SecurityErrorEvent; import flash.events.HTTPStatusEvent; import flash.external.ExternalInterface; import flash.filters.ColorMatrixFilter; import flash.net.URLRequest; import flash.geom.Point; import flash.geom.Rectangle; import flash.geom.Matrix; import flash.geom.ColorTransform; import flash.printing.PrintJob; import flash.printing.PrintJobOptions; import flash.utils.Timer; import flash.events.TimerEvent; import flash.system.System; import flash.system.Capabilities; import flash.net.*; import flash.text.*; import flash.media.Sound; import mx.managers.PopUpManager; public class FlAniS { private var version:String; private var isDebug:Boolean; private var debugTextArea:TextArea; private var debugText:String; private var s:Array; private var background:int; private var foreground:int; private var usingIP:Boolean; private var onlyShowFirstImage:Boolean; private var quietReload:Boolean; private var quietLoadem:Boolean; private var noControls:Boolean; private var useProgressBar:Boolean; private var isLoading:Boolean; private var countFrames:int; private var doExcludeCaching:Boolean; private var excludeCaching:String; private var useCaching:Boolean; private var useAntiCaching:Boolean; private var antiCacheIndex:int; private var baseStatic:Boolean; private var baseEnhance:int; private var imageBase:String; private var startingMinute:int; private var utcOffset:int; private var tzLabel:String; private var timeColor:int; private var timeBack:int; private var timeFontSize:int; private var timeFontWeight:String; private var its:int; private var showButt:Button; private var printButt:Button; private var zoom:Button; private var zoomLabelTrue:String; private var zoomLabelFalse:String; private var zoomLabelColors:Array; private var keepZoom:Boolean; private var activeZoom:Boolean; private var zoomScale:Number; private var zoomXFactor:Number; private var zoomYFactor:Number; private var zoomFactorMax:Number; private var zoomXBase:Number; private var zoomYBase:Number; private var isZooming:Boolean; private var isInitialZoom:Boolean; private var initialZoom:Number; private var enableZooming:Boolean; private var frameLabelWidth:int; private var frameLabelField:Label; private var hasFrameLabel:Boolean; private var frameLabels:Array; private var doLayoutControls:Boolean; private var useBottomControls:Boolean; private var looprock:Button; private var looprockLabelTrue:String; private var looprockLabelFalse:String; private var looprockLabelColors:Array; private var isLoopRock:Boolean; private var loopDirection:int; private var isRocking:Boolean; private var autoOnOff:Button; private var autoOnOffLabelTrue:String; private var autoOnOffLabelFalse:String; private var autoOnOffLabelColors:Array; private var refreshRate:int; private var refreshTimer:Timer; private var autoState:Boolean; private var refresh:Button; private var isAutoRefresh:Boolean; private var showAllOnOff:Boolean; private var onOffWidth:int; private var onOffHeight:int; private var onOffSpacing:int; private var onOffState:Array; private var onOffMin:int; private var onOffMax:int; private var onOffDoingRange:Boolean; private var onOffBM:Bitmap; private var onOffRect:Rectangle; private var onOffBMD:BitmapData; private var onOffUI:UIComponent; private var onOffSprite:Sprite; private var onOffBackground:uint; private var isOnOff:Boolean; private var incFrame:int; private var stepBack:Button; private var stepForward:Button; private var isStepping:Boolean; private var stepFirst:Button; private var stepLast:Button; private var isWiping:Boolean; private var wiperButt:Button; private var wiperLabelOff:String; private var wiperLabelOn:String; private var wiperLabelColors:Array; private var wiperLine:Boolean; private var wiperLineColor:uint; private var setFrameScrollbar:HSlider; private var setFrameText:String; private var isSetFrameScrollbar:Boolean; private var setFaderScrollbar:HSlider; private var faderToggle:Button; private var setFaderText:String; private var isFader:Boolean; private var isFading:Boolean; private var numFadeSteps:int; private var faderFrame:int; private var faderImages:Array; private var isShowingFrames:Boolean; private var bgndInit:Boolean; private var ptt:Point; private var oo:int; private var scale:int; private var ptxy:Point; private var wPoint:Point; private var wRect:Rectangle; private var faderLabel:String; private var startFrame:int; private var basename:String; private var baseNumber:int; private var numFrames:int; private var currentFrame:int; private var deadFrames:int; private var firstFrame:int; private var lastFrame:int; private var endFrame:int; private var enh:Array; private var enhNames:Array; private var enhanceChoice:ComboBox; private var madeEnhBitmaps:Boolean; private var enhBitmaps:Array; private var enhOverlay:int; private var location:Array; private var lat:Number; private var lon:Number; private var isLoc:Boolean; private var is180:Boolean; private var doingLoc:Boolean; private var locLabel:Label; private var locLabelDigits:int; private var locLabelFirst:String; private var locLabelSecond:String; private var xMouse:int; private var yMouse:int; private var xProbe:int; private var yProbe:int; private var probePix:int; private var probePrecision:int; private var probeVal:Number; private var pixPrefix:String; private var pixLabel:String; private var pixUnits:String; private var locOffset:int; private var locButt:Button; private var locLabelOff:String; private var locLabelOn:String; private var locLabelColors:Array private var locLabels:Array; private var vb:VBox; private var vbc:VBox; private var hb:HBox; private var controlBox:HBox; private var overlayControlBox:Container; private var overlayControlContainer:VBox; private var speed:HSlider; private var dwell:int; private var minSpeed:int; private var maxSpeed:int; private var mySpeed:int; private var addDwell:int; private var pauseOnLast:int; private var pausePercent:int; private var startstop:Button; private var startstopLabelTrue:String; private var startstopLabelFalse:String; private var startstopLabelColors:Array; private var bm:Bitmap; private var grandma:Application; private var mom:Canvas; private var contentX:int; private var contentY:int; private var sp:Sprite; private var timer:Timer; private var fofTimer:Timer; private var isLooping:Boolean; private var wasLooping:Boolean; private var isOverlay:Boolean; private var overlay:Array; private var overlayLinks:Array; private var overlayOrder:Array; private var overlayEnhance:Array; private var overlayPreserve:Array; private var overlayHidden:Array; private var overlayStatic:Array; private var overlayZoom:Array; private var overlayTransparentAmount:Array; private var ct:ColorTransform; private var transparency:int; private var numOverlayLabels:int; private var doneOverlayMask:Array; private var overlayMask:Array; private var probeValues:Array; private var probeUnits:Array; private var probePrefixes:Array; private var probeDecimals:Array; private var probeLabels:Array; private var probeOneUnit:String; private var probeOnePrefix:String; private var probeOneDecimal:int; private var probeFontSize:int; private var probeBgColor:int; private var probeFgColor:int; private var probeFormatter:NumberFormatter; private var probe:Button; private var probeLabelColors:Array; private var isProbe:Boolean; private var probeEnabled:Boolean; private var fnList:Array; private var biList:Array; private var olList:Array; private var hiresFnList:Array; private var fnDwell:Array; private var useDwell:Boolean; private var minDwell:int; private var canResetDwell:Boolean; private var hsButton:Array; private var hsUI:UIComponent; private var hsType:Array; private var hsValue:Array; private var hsPoint:Array; private var hsPan:Array; private var hsBitmaps:Array; private var hsColor:int; private var hsImageNames:Array; private var hsLoaders:Array; private var hsLoaderInfo:Array; private var hsSimButts:Array; private var hsCan:Canvas; private var doingHotspots:Boolean; private var loadingHotspot:Boolean; private var backhsButton:Array; private var backhsType:Array; private var backhsValue:Array; private var doingBackHotspots:Boolean; private var loadingBackHotspot:Boolean; private var drawingPaper:Canvas; private var probePaper:UIComponent; private var soundClip:Sound; private var extrap:Button; private var extrapLabelTrue:String; private var extrapLabelFalse:String; private var extrapLabelColors:Array; private var extrapMode:int; private var extrapStep:Timer; private var doingExtrap:Boolean; private var isExtrap:Boolean; private var showExtrapResults:Boolean; private var extrapTimes:Array; private var minutes:Array; private var toFrom:Boolean; private var toFromLock:Boolean; private var extrapX:Array; private var extrapY:Array; private var xExtrap:int; private var yExtrap:int; private var pbar:ProgressBar; private var totalFrames:int; private var initialLoad:Boolean; private var fofErrorCount:int; private var imgList:Array; private var hiresImgList:Array; private var singleImage:Array; private var imgSmoothList:Array; private var imgUIBack:UIComponent; private var imgLoaderList:Array; private var hiresImgLoaderList:Array; private var imgLoaderInfoList:Array; private var hiresImgLoaderInfoList:Array; private var imgZoomableList:Array; private var preserve:Array; private var preserveOlay:Array; private var preRect:Rectangle; private var prePoint:Point; private var xImage:int; private var yImage:int; private var hasCoordinates:Boolean; private var distance:Number; private var distUnit:String; private var distFgColor:int; private var distBgColor:int; private var distFontSize:int; private var distPrecision:int; private var distFormatter:NumberFormatter; private var showBearing:Boolean; private var showGC:Boolean; private var bearingType:String; private var bearingTo:Number; private var bearingFrom:Number; private var mapScale:Number; private var hasScale:Boolean; private var begLat:Number; private var endLat:Number; private var begLon:Number; private var endLon:Number; private var xLineBeg:int; private var yLineBeg:int; private var xLineEnd:int; private var yLineEnd:int; private var xScreen:int; private var yScreen:int; private var xMove:int; private var yMove:int; private var bmdp:BitmapData; private var bmPal:BitmapData; private var bmBack:Bitmap; private var bmBackground:BitmapData; private var bmBackCreated:Boolean private var bmBackLoaded:Array private var bmWidth:int; private var bmHeight:int; private var userWindowSize:Boolean; private var imgWidth:int; private var imgHeight:int; private var biComp:UIComponent; private var biSprite:Sprite; private var usingBI:Boolean; private var activeKey:int; private var backSprite:Sprite; private var upperLeft:Point; private var lowerRight:Point; private var imgRect:Rectangle; private var bmRect:Rectangle; private var isDragging:Boolean; private var isDrawingLine:Boolean; private var paramNames:Array; private var paramValues:Array; private var pLabels:Array private var verLab:Label; private var DTR:Number = .01745329252; private var reBar:RegExp; // Application point of entry public static function main(defConfig:int):void { var ec:FlAniS = new FlAniS(); ec.letterroll(defConfig); } /** letterroll() * * Why did we call it this? * */ public function letterroll(defConfig:int):void { grandma = Application(Application.application); grandma.layout="absolute"; grandma.horizontalScrollPolicy=ScrollPolicy.OFF; grandma.verticalScrollPolicy=ScrollPolicy.OFF; grandma.frameRate = 1; mom = new Canvas(); mom.height = grandma.height; mom.width = grandma.width; mom.setStyle("backgroundColor", grandma.getStyle("backgroundColor")); mom.setFocus(); mom.addEventListener(KeyboardEvent.KEY_DOWN, kclick); mom.addEventListener(KeyboardEvent.KEY_UP, kclick); mom.horizontalScrollPolicy=ScrollPolicy.OFF; mom.verticalScrollPolicy=ScrollPolicy.OFF; grandma.addChild(mom); initialLoad = true; canResetDwell = false; currentFrame = 0; bmBackCreated = false; zoomXFactor = 1.0; zoomYFactor = 1.0; isZooming = false; enableZooming = false; isDragging = false; isDrawingLine = false; isOverlay = false; incFrame = 1; isFader = false; isFading = false; isWiping = false; isProbe = false; probePix = 0; probeVal = Number.NaN; probeEnabled = false; preRect = new Rectangle(); prePoint = new Point(); madeEnhBitmaps = false; locOffset = 20; hasCoordinates = false; reBar = /\|/g; fofErrorCount = 0; numFadeSteps = 10; upperLeft = new Point(0,0); lowerRight = new Point(mom.width,mom.height); // until image defined ptxy = new Point(); ct = new ColorTransform(1.0,1.0,1.0,1.0); version = "FlAniS version 2.9"; trace(version); debugText = version+"\n"; // all set up must be serialized, since there is no // other way to do it...hmmmm.... // start with the deadman timeout timer for file-of-filenames fofTimer = new Timer(2000); fofTimer.addEventListener(TimerEvent.TIMER, function(e:Event):void { fofTimer.stop(); getImageFilenames(); } ); paramNames = new Array(); paramValues = new Array(); // see if name supplied in Flashvars var cfname:String = grandma.parameters.configFilename; if (defConfig == 1) cfname = "flanis.cfg"; if (cfname == null) { debugText = debugText + "\n NO config filename!"; configParams(); } else { trace ("config filename = "+cfname); debugText = debugText +"\nConfig filename = "+cfname; if (cfname.indexOf("?") > 0) { cfname = cfname.replace(reBar,"&"); debugText = debugText + "\nPHP config = "+cfname; } //debugText = debugText + "\nIP = "+getUserIP(); isLoading = false; try { var configLoader:URLLoader = new URLLoader(); configLoader.dataFormat = URLLoaderDataFormat.TEXT; configLoader.addEventListener(Event.COMPLETE, configLoaded); configLoader.addEventListener(IOErrorEvent.IO_ERROR, errorLoadingConfigFile); var request:URLRequest = new URLRequest(cfname); // turn off caching ? request.requestHeaders.push(new URLRequestHeader("Cache-Control","no-store,max-age=0,no-cache,must-revalidate")); request.requestHeaders.push(new URLRequestHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT")); request.requestHeaders.push(new URLRequestHeader("Pragma","no-cache")); configLoader.load(request); } catch (ibce:Error) { Alert.show("Unable to load config file: "+cfname+" Error="+ibce); } } } /** configLoaded(Event) * * after getting the "configFile", parse it and create lists for * getParameter() calls... * */ private function configLoaded(event:Event) : void { trace("into configLoaded........."); var cfl:URLLoader = URLLoader(event.target); cfl.removeEventListener(Event.COMPLETE, configLoaded); cfl.removeEventListener(IOErrorEvent.IO_ERROR, errorLoadingConfigFile); var lines:Array = cfl.data.split("\n"); var eqinx:int = 0; // first, parse the basic requests for (var i:int=0; i 1) utcOffset = int( 60.*parseFloat(s[1])); if (s.length > 2) tzLabel = s[2]; if (s.length > 3) timeBack = parseInt(s[3]); if (s.length > 4) timeFontSize = parseInt(s[4]); if (s.length > 5) timeFontWeight = s[5]; } extrapTimes = new Array(); s = getParameter("times"); if (s != null) { for (i=0; i 500 || mySpeed < 1) { debug("******** Invalid value for 'rate' parameter, = "+mySpeed); mySpeed = (maxSpeed + minSpeed)/2; } if (s.length > 1) { minSpeed = parseInt(s[1]); maxSpeed = parseInt(s[2]); if (maxSpeed > 500 || maxSpeed < mySpeed) { maxSpeed = 300; debug("******** Invalid value for 'rate' maxSpeed parameter...."); } if (minSpeed < 0 || minSpeed > mySpeed) { maxSpeed = 2; debug("******** Invalid value for 'rate' minSpeed parameter...."); } } else { // compute minSpeed = mySpeed - (maxSpeed - mySpeed); if (mySpeed >= maxSpeed) { maxSpeed = mySpeed + 50; minDwell = 10000/maxSpeed; } if (maxSpeed - mySpeed > 10) minSpeed = 2*mySpeed - maxSpeed; if (minSpeed < 2) minSpeed = 2; } } dwell = 10000/mySpeed; s = getParameter("rocking"); if (s != null) { if (startsWith(s[0],"t") || startsWith(s[0],"T")) isRocking=true; } else { isRocking = false; } s = getParameter("loop"); s = getParameter("pause"); pauseOnLast = 0; if (s != null) { pauseOnLast = parseInt(s[0]); if (pauseOnLast < 0 || pauseOnLast > 20000) { pauseOnLast = 0; debug("******** Bad value for 'pause' parameter = "+pauseOnLast); } } s = getParameter("pause_percent"); pausePercent = 0; if (s != null) { pausePercent = parseInt(s[0]); if (pausePercent < 0 || pausePercent > 20000) { pausePercent = 0; debug("******** Bad value for 'pause' parameter = "+pausePercent); } } s = getParameter("transparency"); transparency = 0x00000000; if (s != null) { transparency = parseHex(s[0]); } s = getParameter("image_preserve"); if (s != null) { if (s.length % 4 != 0) { debug("******** image_preserve -- incorrect number of parameters!"); preserve = null; } else { preserve = new Array(s.length); for (i = 0; i 2 && s[2].length > 0) probeFontSize = parseInt(s[2]); if (s.length > 3 && s[3].length > 0) probeOneDecimal = parseInt(s[3]); if (s.length > 4 && s[4].length > 0) probeOneUnit = s[4]; if (s.length > 5 && s[5].length > 0) probeOnePrefix = s[5]; } s = getParameter("distance_style"); distBgColor = background; distFgColor = foreground; distFontSize = 12; distFormatter = new NumberFormatter(); distFormatter.precision = 0; distFormatter.useThousandsSeparator = false; if (s != null) { distBgColor = parseHex(s[0]); distFgColor = parseHex(s[1]); if (s.length > 2 && s[2].length > 0) distFontSize = parseInt(s[2]); if (s.length > 3 && s[3].length > 0) distFormatter.precision = parseInt(s[3]); } s = getParameter("map_scale"); hasScale = false; if (s != null) { hasScale = true; mapScale = parseFloat(s[0]); } s = getParameter("show_bearing"); showBearing = false; bearingType = ""; if (s != null && (s[0].indexOf("t") != -1 || s[0].indexOf("f") != -1) ) { showBearing = true; bearingType = s[0]; } showGC = false; //hotspot doingHotspots = false; loadingHotspot = false; s = getParameter("hotspot"); if (s == null) s = getParameter("hotspot0"); hsButton = new Array(); hsPoint = new Array(); hsType = new Array(); hsValue = new Array(); hsPan = new Array(); hsImageNames = new Array(); hsSimButts = new Array(); hsLoaders = new Array(); hsLoaderInfo = new Array(); hsBitmaps = new Array(); var hsi:int = 0; while (s != null) { doingHotspots = true; makeHotspot(s); hsi = hsi + 1; s = getParameter("hotspot"+hsi); } // background_hotspot doingBackHotspots = false; loadingBackHotspot = false; s = getParameter("background_hotspot"); if (s == null) s = getParameter("background_hotspot0"); backhsButton = new Array(); backhsType = new Array(); backhsValue = new Array(); hsi = 0; while (s != null) { doingBackHotspots = true; makeBackHotspot(s); hsi = hsi + 1; s = getParameter("background_hotspot"+hsi); } // userWindowSize userWindowSize = false; zoomXBase = 1.0; zoomYBase = 1.0; s = getParameter("image_window_size"); if (s != null) { bmWidth = parseInt(s[0]); bmHeight = parseInt(s[1]); bmRect = new Rectangle(0,0,bmWidth, bmHeight); userWindowSize = true; } contentX = 0; contentY = 3; s = getParameter("content_position"); if (s != null) { contentX = parseInt(s[0]); contentY = parseInt(s[1]); } s = getParameter("fade"); if (s != null) { isFading = true; } else { isFading = false; } s = getParameter("fade_steps"); numFadeSteps = 10; if (s != null) numFadeSteps = parseInt(s[0]); // not implemented...yet.... s = getParameter("blank_screen"); s = getParameter("overlay_locations"); s = getParameter("image_size"); // control layout must be done after the image info is available... doLayoutControls = true; // timer for animation if (timer != null) timer.removeEventListener(TimerEvent.TIMER, showFrames); timer = new Timer(50); timer.addEventListener(TimerEvent.TIMER, showFrames, false, 0, true); s = getParameter("background_image"); onOffBackground = mom.getStyle("backgroundColor"); usingBI = false; if (s != null) { debug("......doing background_image..........."); onOffBackground = 0x00000000; biSprite = new Sprite(); var biBitmap:Bitmap = new Bitmap(new BitmapData(mom.width, mom.height)); biSprite.addChild(biBitmap); biComp =new UIComponent(); biComp.addChild(biSprite); biComp.x = 0; biComp.y = 0; biComp.width = mom.width; biComp.height= mom.height; if (doingBackHotspots) { for (i=0; i -1) doEnh = true; sc = getParameter("bottom_controls"); if (sc != null && sc.indexOf("enhance") > -1) doEnh = true; sc = getParameter("overlay_enhance_table"); if (sc != null) doEnh = true; sc = getParameter("base_enhance_table"); if (sc != null) doEnh = true; sc = getParameter("base_enhance"); if (sc != null) doEnh = true; sc = getParameter("enhance_base"); if (sc != null) doEnh = true; s = getParameter("no_enh"); if (s != null || !doEnh) { trace(" s = "+s+" doEnh = "+doEnh); getImageFilenames(); } else { var enhLoader:URLLoader = new URLLoader(); enhLoader.dataFormat = URLLoaderDataFormat.TEXT; enhLoader.addEventListener(Event.COMPLETE, doneGettingEnhTab); enhLoader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void { debug("IOErrorEvent for enh.tab file"); getImageFilenames(); } ); var enhName:String = "enh.tab"; s = getParameter("enhance_filename"); if (s != null) enhName = s[0]; try { if (useAntiCaching) { antiCacheIndex = Math.random()*1677216.0; enhName = enhName+"?"+antiCacheIndex; } if (imageBase != null) enhName = imageBase+enhName; var request:URLRequest = new URLRequest(enhName); // turn off caching ? request.requestHeaders.push(new URLRequestHeader("Cache-Control","no-store,max-age=0,no-cache,must-revalidate")); request.requestHeaders.push(new URLRequestHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT")); request.requestHeaders.push(new URLRequestHeader("Pragma","no-cache")); enhLoader.load( request); } catch (ioe:Error) { debug("Other Error for enh.tab file"); Alert.show("Unable to load enhancement file: "+enhName+" Error: "+ioe); } } } /** getImageFilenames() * * come here to get the filenames (initially and/or on "refresh") * * if file_of_filenames, initiate read of that * * otherwise, just continue on.... * */ private function getImageFilenames():void { var s:Array = getParameter("file_of_filenames"); if (s != null) { fnList = new Array(); var fnLoader:URLLoader = new URLLoader(); fnLoader.dataFormat = URLLoaderDataFormat.TEXT; fnLoader.addEventListener(Event.COMPLETE, doneGettingFilenames ); fnLoader.addEventListener(IOErrorEvent.IO_ERROR, errorLoadingFilenames); var fofName:String = s[0]; try { if (fofName.indexOf("?") > 0) { fofName = fofName.replace(reBar,"&"); debugText = debugText + "\nPHP file-of-filenames = "+fofName; } else if (useAntiCaching) { antiCacheIndex = Math.random()*1677216.0; fofName = StringUtil.trim(s[0])+"?"+antiCacheIndex; } if (imageBase != null) fofName = imageBase+fofName; var request:URLRequest = new URLRequest(fofName); // turn off caching ? request.requestHeaders.push(new URLRequestHeader("Cache-Control","no-store,max-age=0,no-cache,must-revalidate")); request.requestHeaders.push(new URLRequestHeader("Expires","Mon, 26 Jul 1997 05:00:00 GMT")); request.requestHeaders.push(new URLRequestHeader("Pragma","no-cache")); fnLoader.load( request); } catch (ioe:Error) { Alert.show("Unable to load configuration file: "+s[0]+" Error: "+ioe); } } else { doneGettingFilenames(null); } } /** doneGettingFilenames(Event) * * handler for file_of_filenames * * if called from elsewhere, just continue on to getImages() * */ private function doneGettingFilenames(event:Event) : void { frameLabels = getParameter("frame_label"); hasFrameLabel = false; var doTimes:Boolean = false; if (event != null) { fofErrorCount = 0; if (extrapTimes == null) extrapTimes = new Array(); if (frameLabels == null) frameLabels = new Array(); var fnl:URLLoader = URLLoader(event.target); fnl.removeEventListener(Event.COMPLETE, doneGettingFilenames); fnl.removeEventListener(IOErrorEvent.IO_ERROR, errorLoadingFilenames); var lines:Array = fnl.data.split("\n"); var firstTime:Boolean = true; var firstHotspot:Boolean = true; // first push for background ([0]) fnList.push(new Array()); for (var i:int=0; i= 0) { endindex = lines[i].lastIndexOf("]"); if (endindex < begindex) { debug("******** Error processing frameDwell in "+lines[i]); fnDwell.push(300); } else { fnDwell.push(parseInt(lines[i].substring(begindex+2,endindex))); useDwell = true; } lines[i] = (lines[i].substring(0,begindex)+lines[i].substring(endindex+1)); } // look for extrap_time {time} begindex = lines[i].indexOf(" {"); if (begindex >= 0) { endindex = lines[i].lastIndexOf("}"); if (endindex < begindex) { debug("******** Error processing extrap_time in "+lines[i]); extrapTimes.push(300); } else { extrapTimes.push(parseInt(lines[i].substring(begindex+2,endindex))); doTimes = true; } lines[i] = (lines[i].substring(0,begindex)+lines[i].substring(endindex+1)); } //debug("now lines = "+lines[i]); lines[i] = StringUtil.trim(lines[i]); var inx:int = lines[i].indexOf(" "); if (inx > 0) { var leftHand:String = StringUtil.trim(lines[i].substring(0,inx)); var rightHand:String = StringUtil.trim(lines[i].substring(inx)); fnList[0].push(leftHand); var lt:Array = rightHand.split("="); if (lt.length != 2) { debug("******** Error processing overlay= in "+lines[i]); } // comma-separated list of overlay names for this frame... if (StringUtil.trim(lt[0]) == "overlay") { var olnames:Array = lt[1].split(","); for (var k:int = 0; k 2) { frameLabelField.setStyle("fontSize",parseInt(fls[2])); } if (fls.length > 3) { frameLabelField.height = parseInt(fls[3]); } } else { frameLabelField.opaqueBackground = background; frameLabelField.setStyle("color",foreground); } frameLabelField.graphics.lineStyle(1,foreground); frameLabelField.graphics.drawRect(0,0,frameLabelWidth,frameLabelField.height); frameLabelField.text = " "; hasFrameLabel = true; if (tips != null) frameLabelField.toolTip = tips[cn]; controlBox.addChild(frameLabelField); gotControls = true; } else if (s[cn] == "looprock") { looprock = new Button(); pLabels = getParameter("looprock_labels"); if (pLabels == null) { looprockLabelTrue = "Loop"; looprockLabelFalse = "Rock"; } else { looprockLabelTrue = pLabels[0]; looprockLabelFalse = pLabels[1]; if (pLabels.length == 3) { looprock.width = parseInt(pLabels[2]); } } looprockLabelColors = getLabelColors("looprock"); if (isRocking) { looprock.label = looprockLabelTrue; setLabelColors(looprock, looprockLabelColors, true); } else { looprock.label = looprockLabelFalse; setLabelColors(looprock, looprockLabelColors, false); } looprock.addEventListener(MouseEvent.CLICK, bclick); isLoopRock = true; if (tips != null) looprock.toolTip = tips[cn]; controlBox.addChild(looprock); gotControls = true; } else if ( (s[cn].indexOf("autotoggle") == 0) || (s[cn].indexOf("autorefresh") == 0) ) { autoOnOff = new Button(); pLabels = getParameter("autotoggle_labels"); if (pLabels == null) pLabels = getParameter("autorefresh_labels"); if (pLabels == null) { autoOnOffLabelTrue = "Auto On "; autoOnOffLabelFalse = "Auto Off"; } else { autoOnOffLabelTrue = pLabels[0]; autoOnOffLabelFalse = pLabels[1]; if (pLabels.length == 3) { autoOnOff.width = parseInt(pLabels[2]); } } autoOnOffLabelColors = getLabelColors("autotoggle"); if (!isAutoRefresh) { refreshRate = 1; refreshTimer = new Timer(refreshRate*60*1000); refreshTimer.addEventListener(TimerEvent.TIMER, refreshImages, false, 0, true); isAutoRefresh = true; } if (s[cn].indexOf("/off") > 0) { autoOnOff.label = autoOnOffLabelTrue; setLabelColors(autoOnOff, autoOnOffLabelColors, false); autoState = false; refreshTimer.stop(); } else { autoOnOff.label = autoOnOffLabelFalse; setLabelColors(autoOnOff, autoOnOffLabelColors, true); autoState = true; } if (tips != null) autoOnOff.toolTip = tips[cn]; autoOnOff.addEventListener(MouseEvent.CLICK, bclick); controlBox.addChild(autoOnOff); gotControls = true; } else if (s[cn] == "refresh") { refresh = new Button(); pLabels = getParameter("refresh_label"); if (pLabels == null) { refresh.label = "Refresh"; } else { refresh.label = pLabels[0]; if (pLabels.length == 2) { refresh.width = parseInt(pLabels[1]); } } refresh.addEventListener(MouseEvent.CLICK, bclick); if (tips != null) refresh.toolTip = tips[cn]; controlBox.addChild(refresh); gotControls = true; } else if (s[cn] == "location" || s[cn] == "location/on") { locButt = new Button(); locLabels = getParameter("location_labels"); if (locLabels == null) { locLabelOff = "Show Location"; locLabelOn = "Hide Location"; locButt.width = 100; } else { locLabelOff = locLabels[0]; locLabelOn = locLabels[1]; if (locLabels.length == 3) { locButt.width = parseInt(locLabels[2]); } } locLabelColors = getLabelColors("location"); if (s[cn] == "location/on") { isLoc = true; locLabel.visible = true; locButt.label = locLabelOn; } else { isLoc = false; locLabel.visible = false; locButt.label = locLabelOff; } setLabelColors(locButt, locLabelColors, isLoc); locButt.addEventListener(MouseEvent.CLICK, bclick); if (tips != null) locButt.toolTip = tips[cn]; controlBox.addChild(locButt); gotControls = true; } else if (s[cn] == "probe" || s[cn] == "probe/on") { probe = new Button(); pLabels = getParameter("probe_label"); if (pLabels == null) { probe.label = "Probe"; } else { probe.label = pLabels[0]; if (pLabels.length == 2) { probe.width = parseInt(pLabels[1]); } } probeLabelColors = getLabelColors("probe"); probe.addEventListener(MouseEvent.CLICK, bclick); if (tips != null) probe.toolTip = tips[cn]; controlBox.addChild(probe); isProbe = true; probeEnabled = false; if (s[cn] == "probe/on") probeEnabled = true; setLabelColors(probe, probeLabelColors, probeEnabled); gotControls = true; } else if (s[cn] == "show") { debug("Making show button...."); if (ExternalInterface.available) { debug("External interface available..."); showButt = new Button(); showButt.label = "Show"; var sbl:Array = getParameter("show_label"); if (sbl != null) showButt.label = sbl[0]; showButt.addEventListener(MouseEvent.CLICK, bclick); if (tips != null) showButt.toolTip = tips[cn]; if (isLooping) { showButt.enabled = false; } else { showButt.enabled = true; } controlBox.addChild(showButt); gotControls = true; } else { debug("External Interface is NOT availble - so no Show Button!") } } else if (s[cn] == "wiper") { wiperButt = new Button(); wiperButt.label = " Wiper "; isWiping = false; var wbl:Array = getParameter("wiper_labels"); if (wbl != null) { wiperLabelOff = wbl[0]; wiperLabelOn = wbl[1]; } else { wiperLabelOff = " Wiper "; wiperLabelOn = "Cancel"; } wiperLabelColors = getLabelColors("wiper"); wiperButt.label = wiperLabelOff; setLabelColors(wiperButt, wiperLabelColors, false); wiperButt.addEventListener(MouseEvent.CLICK, bclick); if (tips != null) wiperButt.toolTip = tips[cn]; controlBox.addChild(wiperButt); gotControls = true; } else if (s[cn] == "print") { printButt = new Button(); printButt.label = "Print"; var pbl:Array = getParameter("print_label"); //if (pbl == null) pbl = getParameter("show_label"); if (pbl != null) printButt.label = pbl[0]; printButt.addEventListener(MouseEvent.CLICK, bclick); if (tips != null) printButt.toolTip = tips[cn]; if (isLooping) { printButt.enabled = false; } else { printButt.enabled = true; } controlBox.addChild(printButt); gotControls = true; } else if (s[cn] == "step") { stepBack = new Button(); stepBack.label="<"; stepBack.width=20; stepBack.addEventListener(MouseEvent.CLICK, bclick); stepForward = new Button(); stepForward.label=">"; stepForward.width=20; stepForward.addEventListener(MouseEvent.CLICK, bclick); isStepping = true; if (tips != null) stepBack.toolTip = tips[cn]; if (tips != null) stepForward.toolTip = tips[cn]; controlBox.addChild(stepBack); controlBox.addChild(stepForward); gotControls = true; } else if (s[cn] == "firstlast") { stepFirst = new Button(); stepFirst.label = "<|"; stepFirst.width = 30; stepFirst.addEventListener(MouseEvent.CLICK, bclick); stepLast = new Button(); stepLast.label = "|>"; stepLast.width = 30; stepLast.addEventListener(MouseEvent.CLICK, bclick); if (tips != null) stepFirst.toolTip = tips[cn]; if (tips != null) stepLast.toolTip = tips[cn]; controlBox.addChild(stepFirst); controlBox.addChild(stepLast); gotControls = true; } else if (s[cn] == "setframe") { setFrameScrollbar = new HSlider(); var sft:Array = getParameter("setframe_label"); setFrameText = "Set Frame *"; if (sft != null) setFrameText = StringUtil.trim(sft[0]); setFrameScrollbar.setStyle("labelOffset",0); //setFrameScrollbar.height=40; setFrameScrollbar.showDataTip = false; setFrameScrollbar.maximum = numFrames - 1; setFrameScrollbar.minimum = 0; setFrameScrollbar.value = startFrame; setFrameScrollbar.liveDragging = true; setFrameScrollbar.addEventListener(SliderEvent.CHANGE,changeFrame); if (tips != null) setFrameScrollbar.toolTip = tips[cn]; //setFrameScrollbar.labels = [" ",setFrameText," "]; changeFrame(null); controlBox.addChild(setFrameScrollbar); gotControls = true; } else if (s[cn].indexOf("toggle") == 0) { var toggles:Array = getParameter("toggle_size"); if (s[cn].toLowerCase().indexOf("/showall") != -1) { showAllOnOff = true; } else { showAllOnOff = false; } onOffDoingRange = false; onOffMin = 0; onOffMax = numFrames-1; onOffWidth = 10; onOffHeight = 10; onOffSpacing = 3; if (toggles != null) { onOffWidth = parseInt(toggles[0]); onOffHeight = parseInt(toggles[1]); if (toggles.length > 2) onOffSpacing = parseInt(toggles[2]); } onOffBMD = new BitmapData(numFrames*(onOffSpacing+onOffWidth), onOffHeight+3, true, onOffBackground); onOffBM = new Bitmap(onOffBMD); onOffSprite = new Sprite(); onOffSprite.addChild(onOffBM); onOffRect = new Rectangle(0,0,onOffWidth, onOffHeight); onOffUI = new UIComponent(); onOffUI.addChild(onOffSprite); onOffUI.height = onOffHeight+3; onOffUI.width = (onOffSpacing+onOffWidth)*numFrames; var togonoff:Array = getParameter("toggle_onoff"); onOffState =new Array(); for (var nof:int = 0; nof 0) { rbgIndex = parseInt(olr[i].substring( olr[i].indexOf("/")+1)); } if (rbg[rbgIndex] == null) { rbg[rbgIndex] = new RadioButtonGroup(); } if (!hiddenState) overlay[i+1].group = rbg[rbgIndex]; } else { overlay[i+1] = new CheckBox(); } } else { overlay[i+1] = new CheckBox(); } if (oltips != null) { overlay[i+1].toolTip = oltips[i]; } overlay[i+1].selected = initState; if (olct != null) { overlay[i+1].setStyle("color",parseHex(olct[i])); } if (olmoct != null) { overlay[i+1].setStyle("textRollOverColor",parseHex(olmoct[i])); } if (olbold != null) { if (startsWith(olbold[i],"t") || startsWith(olbold[i],"T") || startsWith(olbold[i],"b") || startsWith(olbold[i],"B") ) overlay[i+1].setStyle("fontWeight","bold"); } if (!hiddenState) { if (olspacer != null) { var olspval:int = parseInt(olspacer[i]); if (olspval !=0) { var olspace:UIComponent = new UIComponent(); olspace.height = 10; olspace.width = olspval; overlayControlBox.addChild(olspace); } } if (olloc != null) { var locs:Array = olloc[i].split("&"); trace("olloc = "+olloc[i]); trace("locs = "+locs); overlay[i+1].x = parseInt(locs[0]); overlay[i+1].y = parseInt(locs[1]); } overlay[i+1].label = ols[i]; overlay[i+1].addEventListener(MouseEvent.CLICK, cbclick); overlayControlBox.addChild(overlay[i+1]); } overlayPreserve[0] = -1; if (olprl == null || preserveOlay == null) { overlayPreserve[i+1] = -1; } else { if (startsWith(olprl[i],"t") || startsWith(olprl[i],"T")) { overlayPreserve[i+1] = olprecount; olprecount = olprecount + 1; } else { overlayPreserve[i+1] = -1; } } if (olta == null) { overlayTransparentAmount[i+1] = 100; } else { overlayTransparentAmount[i+1] = parseInt(olta[i]); } overlayLinks[0] = 0; if (oll == null) { overlayLinks[i+1] = 0; } else { overlayLinks[i+1] = parseInt(oll[i]); } overlayEnhance[0] = -1; if (olenh == null) { overlayEnhance[i+1] = -1 } else { overlayEnhance[i+1] = parseInt(olenh[i]) - 1; } overlayOrder[0] = 0; if (olzo == null) { overlayOrder[i+1] = i + 1; } else { var zo:int = parseInt(olzo[i]); overlayOrder[zo+1] = i + 1; } if (olst == null) { overlayStatic[i+1] = false; } else { if (startsWith(olst[i],"t") || startsWith(olst[i],"T") || startsWith(olst[i],"y") || startsWith(olst[i],"Y") || startsWith(olst[i],"1")) { overlayStatic[i+1] = true; } else { overlayStatic[i+1] = false; } } overlayStatic[0] = baseStatic; imgZoomableList[0] = true; if (olzm != null) { if (startsWith(olzm[i], "f") || startsWith(olzm[i], "F") || startsWith(olzm[i], "n") || startsWith(olzm[i], "N")) { imgZoomableList[i+1] = false } else { imgZoomableList[i+1] = true; } } imgSmoothList[0] = false; if (olsmoo != null) { if (startsWith(olsmoo[i], "t") || startsWith(olsmoo[i], "T") || startsWith(olsmoo[i], "y") || startsWith(olsmoo[i], "Y")) { imgSmoothList[i+1] = true } else { imgSmoothList[i+1] = false; } } } // fix up hidden overlay initial states..... for (var n:int=0; n 0) { for (var m:int=0; m 0) { for (var k:int = 0; k 0) { for (k = 0; k wf) { onOffState[i] = -1; } } onOffDoingRange = false; } else { // do the low end; enable all above onOffMin = wf; for (i = 0; i= 0) { setFrameScrollbar.labels = [" ", (setFrameText.substring(0,inx)+(Math.round(setFrameScrollbar.value)+1)+setFrameText.substring(inx+1)), " "]; } stopLooping(); setCurrentFrame(true, Math.round(setFrameScrollbar.value), false); } /** changeSpeed(SliderEvent) * * handle events for the speed changer Slider * */ private function changeSpeed(event:SliderEvent): void { if (event.currentTarget != speed) return; //dwell = 1000 + minDwell - speed.value; dwell = 10000/speed.value; if (canResetDwell) timer.delay = dwell; } /** changeFade(SliderEvent) * * handle events for the fader Slider * */ private function changeFade(event:SliderEvent): void { if (event.currentTarget != setFaderScrollbar) return; timer.stop(); // no longer needed.... setCurrentFrame(false, 0, false); if (!isShowingFrames) showFrames(null); } /** bdrag(MouseEvent) * * handle mouse drag events. * * if roaming, then cause the image to (xy)Move * * if drawing The Line, just define the endpoints */ private function bdrag(event:MouseEvent) : void { xMouse = event.localX; yMouse = event.localY; if (probeEnabled) { xProbe = event.stageX - imgUIBack.x - contentX; yProbe = event.stageY - imgUIBack.y - contentY; } if (isExtrap) return; //debug("Event="+event+" Target = "+event.target+" CurTaget="+event.currentTarget); //if (event.target != drawingPaper) return; if (event.buttonDown == true) { if (event.shiftKey) { //xLineEnd = event.localX; //yLineEnd = event.localY; xLineEnd = event.stageX - imgUIBack.x - contentX; yLineEnd = event.stageY - imgUIBack.y - contentY; if (xLineEnd < 0 || yLineEnd < 0 || xLineEnd > bmWidth || yLineEnd > bmHeight) { isDrawingLine = false; if (!isShowingFrames) showFrames(null); return; } if (hasCoordinates) { endLat = DTR * (location[0] - ( (location[0] - location[2])* (yLineEnd-yMove) )/bmHeight/zoomYFactor); endLon = DTR * (location[1] - ( (location[1] - location[3])* (xLineEnd-xMove) )/bmWidth/zoomXFactor); if (distUnit == "pixel") { distance = Math.sqrt( (endLat-begLat)/DTR*(endLat-begLat)/DTR + (endLon-begLon)/DTR*(endLon-begLon)/DTR ); } else { distance = Math.pow(Math.sin( (endLat-begLat)/2.),2) + Math.cos(begLat)*Math.cos(endLat)* Math.pow(Math.sin( (endLon-begLon)/2.),2) ; //var ddd:Number = 6367.*2.*Math.atan2(Math.sqrt(distance), Math.sqrt(1. - distance)); distance = 6367.* 2.* Math.asin(Math.min(1.0, Math.sqrt(distance))); if (distUnit == "mi") distance = distance * 0.621371192; if (distUnit == "nmi") distance = distance * 0.539956803; if (showBearing) { bearingTo = ( Math.atan2( Math.sin(endLon - begLon)* Math.cos(endLat), Math.cos(begLat)*Math.sin(endLat) - Math.sin(begLat)*Math.cos(endLat)* Math.cos(endLon - begLon)) / DTR + 360.) % 360.;; bearingFrom = ( Math.atan2( Math.sin(begLon - endLon)* Math.cos(begLat), Math.cos(endLat)*Math.sin(begLat) - Math.sin(endLat)*Math.cos(begLat)* Math.cos(begLon - endLon)) / DTR + 360.) % 360.;; //debug("bearingTo = "+bearingTo+" from="+bearingFrom); } } isDrawingLine = true; if (isLoc) updateLocation(event); if (!isShowingFrames) showFrames(null); } else if (hasScale) { distance = mapScale * Math.sqrt( (yLineEnd - yLineBeg)*(yLineEnd - yLineBeg) /zoomYFactor/zoomYFactor + (xLineEnd - xLineBeg)*(xLineEnd - xLineBeg) /zoomXFactor/zoomXFactor ); isDrawingLine = true; if (isLoc) updateLocation(event); if (!isShowingFrames) showFrames(null); } return; } if (event.target != drawingPaper) return; if (!isWiping && (zoomXFactor <= zoomXBase)) return; if ( isDragging || ( (Math.abs(event.localX - xScreen) > 3)) || ( (Math.abs(event.localY - yScreen) > 3)) ) { xScreen = event.localX; yScreen = event.localY; xMove = Math.round(xScreen - xImage*zoomXFactor); yMove = Math.round(yScreen - yImage*zoomYFactor); isDragging = true; } } if (isLoc) updateLocation(event); if (!isShowingFrames) showFrames(null); } /** updateLocation() * * update the Location readout, if active... */ private function updateLocation(event:MouseEvent) : void { var xLoc:Number = event.stageX - imgUIBack.x - contentX; var yLoc:Number = event.stageY - imgUIBack.y - contentY; if (xLoc < 0 || xLoc > bmWidth) return; if (yLoc < 0 || yLoc > bmHeight) return; lat = (location[0] - ( (location[0] - location[2])* (yLoc-yMove) )/bmHeight/zoomYFactor); lon = (location[1] - ( (location[1] - location[3])* (xLoc-xMove) )/bmWidth/zoomXFactor); if (is180 && lon > 180.0) lon = lon-360.0; if (lon > 360.0) lon = lon - 360.0; locLabel.text = locLabelFirst+lat.toFixed(locLabelDigits)+" "+locLabelSecond+lon.toFixed(locLabelDigits); locLabel.height = locLabel.measureText(locLabel.text).height + 3; locLabel.width = locLabel.measureText(locLabel.text).width + 5; if (xLoc+locOffset + locLabel.width > bmWidth) { locLabel.x = bmWidth - locLabel.width; } else { locLabel.x = xLoc+locOffset; } if (yLoc + locOffset + locLabel.height > bmHeight) { locLabel.y = bmHeight - locLabel.height; } else { locLabel.y = yLoc + locOffset; } locLabel.invalidateSize(); } /** resetZoom() * * reset the zoom factor to the default. Reset the pointers * for offset displays of the image */ private function resetZoom(): void { zoomXFactor = zoomXBase; zoomYFactor = zoomYBase; isZooming = false; if (zoom != null) { zoom.label = zoomLabelTrue; setLabelColors(zoom, zoomLabelColors, false); enableZooming = false; } xImage = xScreen; yImage = yScreen; xMove = 0; yMove = 0; } /** bclick(MouseEvent) * * handle button clicking events */ private function bclick(event:MouseEvent): void { //debug("Event="+event+" Target = "+event.target+" CurTaget="+event.currentTarget); if (event.target == startstop) { if (isLooping) { timer.stop(); stopLooping(); } else { startLooping(); timer.start(); } } else if (event.target == showButt) { try { var fnshow:String = fnList[0][currentFrame]; if (imageBase != null) fnshow = imageBase+fnList[0][currentFrame]; debug("calling ExInt with fn = "+fnshow); ExternalInterface.call("flanis_show", fnshow); } catch (e:Error) { debug("ExternInterface error = "+e); } } else if (event.target == wiperButt) { isWiping = !isWiping; if (isWiping) { wiperButt.label=wiperLabelOn; setLabelColors(wiperButt, wiperLabelColors, true); wasLooping = isLooping; stopLooping(); backSprite.useHandCursor = true; } else { wiperButt.label=wiperLabelOff; setLabelColors(wiperButt, wiperLabelColors, false); if (wasLooping) startLooping(); backSprite.useHandCursor = false; } } else if (event.target == printButt) { try { var pj:PrintJob = new PrintJob(); var pjo:PrintJobOptions = new PrintJobOptions(); pjo.printAsBitmap = true; pj.start(); pj.addPage(backSprite, null, pjo); pj.send(); pj = null; } catch (e:Error) { debug("printButt error = "+e); } } else if (event.target == stepForward) { loopDirection = 1; setCurrentFrame(false, loopDirection, true); } else if (event.target == stepBack) { loopDirection = -1; setCurrentFrame(false, loopDirection, true); } else if (event.target == stepFirst) { stopLooping(); setCurrentFrame(true, 0, true); } else if (event.target == stepLast) { stopLooping(); setCurrentFrame(true, lastFrame, true); } else if (event.target == extrap) { if (isExtrap) { isExtrap = false; drawingPaper.graphics.clear(); drawingPaper.removeAllChildren(); showExtrapResults = false; extrap.label = extrapLabelTrue; setLabelColors(extrap, extrapLabelColors, false); if (zoom != null) { zoom.enabled = true; zoom.label = zoomLabelTrue; setLabelColors(zoom, zoomLabelColors, false); } enableZooming = activeZoom; if (startstop != null) startstop.enabled=true; isLooping = wasLooping; } else { isExtrap = true; isDrawingLine = false; showExtrapResults = false; extrap.label = extrapLabelFalse; setLabelColors(extrap, extrapLabelColors, true); extrapX = new Array(); extrapY = new Array(); for (var i:int=0; i setFaderScrollbar.maximum) v = 0; setFaderScrollbar.value = v; setCurrentFrame(false, 0, false); if (!isShowingFrames) showFrames(null); } else if (event.target == locButt) { if (isLoc) { isLoc = false; locButt.label = locLabelOff; setLabelColors(locButt, locLabelColors, false); locLabel.visible = false; } else { isLoc = true; locButt.label = locLabelOn; setLabelColors(locButt, locLabelColors, true); locLabel.visible = true; } } else { if (!event.shiftKey) { if (doingHotspots && (event.type == "click") ) { for (var n:int = 0; n 0) { var endindex:int = pop.indexOf("]"); if (endindex > begindex) { var poop:String = pop.substring(begindex+1,endindex); debug("poop = "+poop); var pps:Array = poop.split("/"); if (startsWith(pps[0],"+") || startsWith(pps[0],"-") ) { x = x + parseInt(pps[0]); } else { x = parseInt(pps[0]); } if (startsWith(pps[1],"+") || startsWith(pps[1],"-") ) { y = y + parseInt(pps[1]); } else { y = parseInt(pps[1]); } if (pps.length > 2) { w = parseInt(pps[2]); h = parseInt(pps[3]); } } } //offset for "mom" coordinates x = x + imgUIBack.x + contentX; y = y + imgUIBack.y + contentY; if (x < 0) x = 0; if (y < 0) y = 0; if (x > mom.width) x = mom.width; if (y > mom.height) y = mom.height; var hsTW:TitleWindow = new TitleWindow(); hsTW.horizontalScrollPolicy = "auto"; hsTW.verticalScrollPolicy = "auto"; hsTW.layout = "vertical"; hsTW.showCloseButton = true; hsTW.width = w; hsTW.height = h; hsTW.x = x; hsTW.y = y; hsTW.validateNow(); hsTW.addChild(hotspotText); PopUpManager.addPopUp(hsTW, grandma, false); hsTW.addEventListener(CloseEvent.CLOSE, function (e:Event): void { PopUpManager.removePopUp(hsTW); mom.setFocus(); }, false,0,false); } /** kclick() * * handler for key clicks * */ private function kclick(e:KeyboardEvent):void { //debug("keyboard...keyCode="+e.keyCode+" charCode="+e.charCode); if (e.type == "keyUp") { activeKey = -1; return; } activeKey = e.keyCode; // back arrow...or "b" key if (e.keyCode == 37 || e.keyCode == 66) { // back one setCurrentFrame(false, -1, true); // forward arrow...or "a" key } else if (e.keyCode == 39 || e.keyCode == 65) { // forward one setCurrentFrame(false, 1, true); // X marks the spot! } else if (e.keyCode == 88) { extrapX[currentFrame] = xMouse; extrapY[currentFrame] = yMouse; showExtrapResults = false; // new points showFrames(null); // R to reset.... } else if ( (e.keyCode == 82) || (e.keyCode == 114) ) { resetZoom(); } } /** drawOnOff() * * draw the "toggle boxes" -- just set their colors based on onOffState * values. * */ private function drawOnOff():void { for (var nof:int = 0; nof endFrame) { if (isRocking && !isButton) { currentFrame = endFrame - incFrame; if (currentFrame < firstFrame) currentFrame = firstFrame; loopDirection = -loopDirection; value = -value; } else { currentFrame = firstFrame; } } else if (currentFrame < firstFrame) { if (isRocking && !isButton) { currentFrame = firstFrame + incFrame; loopDirection = -loopDirection; value = -value; } else { currentFrame = endFrame; } } if (!isOnOff) break; if (onOffState[currentFrame] != -1) break; deadFrames = deadFrames + 1; if (deadFrames > (2*numFrames) ) { currentFrame = 0; break; } } } if (isOnOff) { onOffState[currentFrame] = 1; drawOnOff(); } if (hasFrameLabel && (frameLabels != null) && (frameLabelField != null)) { frameLabelField.text = frameLabels[currentFrame]; } addDwell = 0; if (useDwell) { dwell = fnDwell[currentFrame]; } else { if (currentFrame == (numFrames - 1)) { if (pausePercent > 0) { addDwell = (dwell * pausePercent) / 100; } else { addDwell = pauseOnLast; } } } if (canResetDwell) timer.delay = (dwell + addDwell); if (!isLooping && !isShowingFrames) showFrames(null); } /** showFrames(TimerEvent) * * the workhorse * * may be called on a timer event or asynchronously -- thus the * "isShowingFrames" global. * */ private function showFrames(event:TimerEvent): void { //debug("show Frames, Timer count="+timer.currentCount+" delay="+timer.delay+" frame="+currentFrame+" mem="+System.totalMemory); if (!bmBackCreated) return; isShowingFrames = true; if (event != null && isLooping) setCurrentFrame(false,loopDirection,false); // initialize the background bgndInit = true; var mat:Matrix = new Matrix(); mat.scale (zoomXFactor, zoomYFactor); mat.translate (xMove, yMove); //trace("zoomfX="+zoomXFactor+" xMove="+xMove+" yM="+yMove); // check to see if they dragged too far.... ptt = mat.transformPoint(upperLeft); if (ptt.x > 0) { mat.translate(-ptt.x,0); xMove = xMove - ptt.x; } if (ptt.y > 0) { mat.translate(0, -ptt.y); yMove = yMove - ptt.y; } ptt = mat.transformPoint(lowerRight); if (ptt.x < bmWidth) { mat.translate(bmWidth - ptt.x,0); xMove = xMove + (bmWidth - ptt.x); } if (ptt.y < bmHeight) { mat.translate(0,bmHeight - ptt.y); yMove = yMove + (bmHeight - ptt.y); } if (doingHotspots ) { for (var m:int=0; m imgList[oo].length-1) its = imgList[oo].length - 1; if (bmBackLoaded[oo][its] == false) continue; if (bgndInit) { bmBack.bitmapData.fillRect(bmRect,mom.getStyle("backgroundColor") ); bgndInit = false; } canResetDwell = true; if (i == 0 || ( (oo != 0) && isOverlay && overlay[oo].selected == true)) { // masking...not used any more (?) if (overlayMask[oo] && !doneOverlayMask[oo][its] && bmBackLoaded[oo-1][its]) { var bmdm:BitmapData = imgList[oo-1][its].clone(); var knt:int = bmdm.threshold(imgList[oo][its], imgRect, upperLeft, "!=", 0xffffffff, 0x00000000, 0x00ffffff, false); imgList[oo][its] = bmdm; doneOverlayMask[oo][its] = true; } // if zoomable, apply zoom and pan; otherwise, just do it... if (imgZoomableList[oo] == true) { if (imgList[oo][its] != null) if (overlayEnhance != null && overlayEnhance[oo] != -1) { bmPal.fillRect(bmRect,transparency); bmPal.draw(imgList[oo][its],mat, null,null,bmRect,imgSmoothList[oo]); if (probeEnabled) { probePix = bmPal.getPixel(xProbe, yProbe) & 0xff; probeVal = probeValues[overlayEnhance[oo]][probePix]; pixUnits = probeUnits[overlayEnhance[oo]][probePix]; pixLabel = probeLabels[overlayEnhance[oo]][probePix]; pixPrefix = probePrefixes[overlayEnhance[oo]][probePix]; probePrecision = probeDecimals[overlayEnhance[oo]][probePix]; } bmPal.paletteMap(bmPal, bmRect, upperLeft, enh[overlayEnhance[oo]][0], enh[overlayEnhance[oo]][1], enh[overlayEnhance[oo]][2], enh[overlayEnhance[oo]][3]); bmBack.bitmapData.copyPixels(bmPal, bmRect, upperLeft); } else { bmBack.bitmapData.draw(imgList[oo][its],mat, null,null,bmRect,imgSmoothList[oo]); } } else { if (imgList[oo][its] != null) bmBack.bitmapData.draw(imgList[oo][its],null, null,null,bmRect,imgSmoothList[oo]); } } } // now do any image preserves.... if (preserve != null || preserveOlay != null) { for (i=0; i imgList[oo].length-1) its = imgList[oo].length - 1; if (bmBackLoaded[oo][its] == false) continue; if (i == 0 || ( (oo != 0) && isOverlay && overlay[oo].selected == true)) { // if part is preserved, draw it.... if ( i == 0 && preserve != null && imgList[oo][its] != null) { for (var p:int=0; p 1.0) { sumdt = sumdt + dt; sumdx = sumdx + (extrapX[m] - extrapX[last]) / dt; sumdy = sumdy + (extrapY[m] - extrapY[last]) / dt; last = m; count = count + 1.0; } } } if (count > 1.0 && sumdt != 0.0 && sumdx != 0.0 && sumdy != 0.0) { var gotX:int = 0; var gotY:int = 0; var accumTime:int = minutes[last] ; // at last image var dxdt:Number = sumdx/count; var dydt:Number = sumdy/count; //debug("dxdt = "+dxdt+" dydt="+dydt); var nmin:int = Math.round(Math.abs((timeFontSize+4)*4/dxdt)); // approx 14pt x 4 digits var tmin:int = Math.round(Math.abs((timeFontSize+4)*2/dydt)); // approx 14pt x 2 height //debug("nmin = "+nmin+" tmin = "+tmin); if (tmin < nmin) nmin = tmin; if (nmin > 120) { nmin = 120*int(nmin/120)+60; } else if (nmin > 90) { nmin = 120; } else if (nmin > 60) { nmin = 90; } else if (nmin > 30) { nmin = 60; } else if (nmin > 15) { nmin = 30; } else if (nmin > 10) { nmin = 15; } else if (nmin > 5) { nmin = 10; } else if (nmin > 2) { nmin = 5; } else { if (nmin == 0) nmin = 1; } tmin = (accumTime/nmin*nmin) + nmin; //debug("after....nmin = "+nmin+" tmin = "+tmin); var sign:int = 1; if (toFrom) sign = -1; var endX:int = Math.round(x + sign*(dxdt*(tmin - accumTime))); var endY:int = Math.round(y + sign*(dydt*(tmin - accumTime))); drawingPaper.graphics.moveTo(x,y); drawingPaper.graphics.beginFill(0xffffff); drawingPaper.graphics.drawRect(x-2, y-2, 5, 5); drawingPaper.graphics.endFill(); drawingPaper.graphics.moveTo(x,y); var xInc:Number = dxdt * nmin; var yInc:Number = dydt * nmin; accumTime = tmin; // fillRect(x-2,y-2,5,5) for (var gasp:int=0; gasp < 300; gasp++) { // tiny increments? if (endX < 3 || (endX+3) > drawingPaper.width || endY < 3 || (endY+3) > drawingPaper.height) break; drawingPaper.graphics.lineStyle(3,0x000000); drawingPaper.graphics.lineTo(endX, endY); drawingPaper.graphics.drawRect(endX-2, endY-2, 5, 5); drawingPaper.graphics.moveTo(x,y); drawingPaper.graphics.lineStyle(1,0xffffff); drawingPaper.graphics.lineTo(endX, endY); drawingPaper.graphics.drawRect(endX-2, endY-2, 5, 5); drawingPaper.graphics.moveTo(endX, endY); var hm:int = startingMinute + accumTime; hm = 100*int(hm/60) + (hm % 60); hm = hm % 2400; var shm:String = hm+" "; if (hm < 1000) shm = "0"+hm; if (hm < 100) shm = "00"+hm; if (hm < 10) shm = "000"+hm; var lab:Label = new Label(); lab.setStyle("color", timeColor); if (timeBack >= 0) { lab.opaqueBackground = timeBack; } lab.setStyle("fontSize", timeFontSize); lab.setStyle("fontWeight", timeFontWeight); lab.text = StringUtil.trim(shm+" "+tzLabel); lab.x = endX+3; lab.y = endY-4; if (lab.y < 5) lab.y = 5; drawingPaper.addChild(lab); lab.height = lab.measureText(lab.text).height + 3; lab.width = lab.measureText(lab.text).width + 5; if ( (lab.x + lab.width) > drawingPaper.width) { lab.x = drawingPaper.width - lab.width - 4; } if ( (lab.y + lab.height) > drawingPaper.height) { lab.y = drawingPaper.height - lab.height - 3; } x = endX; y = endY; endX = Math.round(x + sign*xInc); endY = Math.round(y + sign*yInc); accumTime = accumTime + nmin; } } } else { drawingPaper.graphics.clear(); drawingPaper.removeAllChildren(); drawingPaper.graphics.lineStyle(3,0x000000); for (var ls:int=0; ls < 2; ls++) { drawingPaper.graphics.moveTo(extrapX[0], extrapY[0]); for (var ks:int=0; ks <= currentFrame; ks++) { if (extrapX[ks] >= 0) drawingPaper.graphics.lineTo(extrapX[ks], extrapY[ks]); } drawingPaper.graphics.lineStyle(1,0xffffff); } if (extrapX[currentFrame] >= 0) { drawingPaper.graphics.lineStyle(3,0x000000); for (ls=0; ls<2; ls++) { drawingPaper.graphics.moveTo(extrapX[currentFrame]-10, extrapY[currentFrame]); drawingPaper.graphics.lineTo(extrapX[currentFrame]+10, extrapY[currentFrame]); drawingPaper.graphics.moveTo(extrapX[currentFrame], extrapY[currentFrame]-10); drawingPaper.graphics.lineTo(extrapX[currentFrame], extrapY[currentFrame]+10); drawingPaper.graphics.lineStyle(1,0xffffff); } } } } // when will probes every be enabled, eh? if (probeEnabled) { drawingPaper.removeAllChildren(); drawingPaper.graphics.clear(); var labVal:Label = new Label(); labVal.opaqueBackground = probeBgColor; labVal.setStyle("color", probeFgColor); labVal.setStyle("fontSize", probeFontSize); probeFormatter.precision = probePrecision; if (pixLabel != null && pixLabel != "") { labVal.text = pixLabel; } else if (isNaN(probeVal)) { labVal.text = "No Data"; } else { labVal.text = pixPrefix+" " + probeFormatter.format(probeVal)+" "+pixUnits; } labVal.x = xProbe -50; labVal.y = yProbe +20; if (labVal.x < 2) labVal.x = 2; if (labVal.y < 2) labVal.y = 2; drawingPaper.addChild(labVal); labVal.height = labVal.measureText(labVal.text).height + 3; labVal.width = labVal.measureText(labVal.text).width + 5; if ( (labVal.x + labVal.width) > bmWidth) { labVal.x = bmWidth - labVal.width - 2; } if ( (labVal.y + labVal.height) > bmHeight) { labVal.y = bmHeight - labVal.height - 2; } } // if drawing the "distance" line if (isDrawingLine) { drawingPaper.graphics.clear(); drawingPaper.removeAllChildren(); if (showGC) { /* and if we ever want to plot values along a great circle arc... lat2 = asin(sin(lat1)*cos(d/R) + cos(lat1)*sin(d/R)*cos(bearingFrom)) lon2 = lon1 + atan2(sin(bearingFrom)*sin(d/R)*cos(lat1), cos(d/R)-sin(lat1)*sin(lat2)) d/R is the angular distance (in radians), where d is the distance travelled and R is the earth's radius */ } else { drawingPaper.graphics.lineStyle(3,0x000000); drawingPaper.graphics.moveTo(xLineBeg, yLineBeg); drawingPaper.graphics.lineTo(xLineEnd, yLineEnd); drawingPaper.graphics.lineStyle(1,0xffffff); drawingPaper.graphics.moveTo(xLineBeg, yLineBeg); drawingPaper.graphics.lineTo(xLineEnd, yLineEnd); } // label for showing the distance values var labdist:Label = new Label(); labdist.opaqueBackground = distBgColor; labdist.setStyle("color", distFgColor); labdist.setStyle("fontSize", distFontSize); labdist.text = distFormatter.format(distance) +" "+distUnit; //labdist.text = String(Math.round(distance)+" "+distUnit); if (showBearing) { if (bearingType.indexOf("t") != -1 && bearingType.indexOf("f") != -1) { labdist.text = labdist.text+" ("+(Math.round(bearingTo))+"\xB0/"+ (Math.round(bearingFrom))+"\xB0)"; } else if (bearingType.indexOf("t") != -1) { labdist.text = labdist.text+" ("+(Math.round(bearingTo))+"\xB0)"; } else { labdist.text = labdist.text+" ("+(Math.round(bearingFrom))+"\xB0)"; } } labdist.x = xLineEnd + 10; labdist.y = yLineEnd - 5; if (labdist.y < 1) labdist.y = 5; drawingPaper.addChild(labdist); labdist.height = labdist.measureText(labdist.text).height + 3; labdist.width = labdist.measureText(labdist.text).width + 5; if ( (labdist.x + labdist.width) > bmWidth) { labdist.x = bmWidth - 2*labdist.width; } if ( (labdist.y + labdist.height) > bmHeight) { labdist.y = bmHeight - 2*labdist.height; } } mat = null; event = null; isShowingFrames = false; } /** getImages() * * continue the chain of events in setting this up. * * here, create the Loaders and begin the loading operations * * event handler is called "doneLoading" */ public function getImages() :void { var fName:String = " "; totalFrames = 0; isLoading = true; countFrames = 0; faderImages = null; for (var i:int=0; i 3) ) { //trace("would read hires = "+hiresFnList[i]); } } } loadingHotspot = false; } /** errorLoadingFilenames(IOErrorEvent) * * come here if there is a problem reading file_of_filenames * */ public function errorLoadingFilenames(e:IOErrorEvent) : void { if (fofErrorCount < 20) { fofErrorCount = fofErrorCount + 1; debug("File_of_Filenames read error, count="+fofErrorCount); fofTimer.start(); } else { fofTimer.stop(); isLoading = false; if (refresh != null) refresh.enabled = true; Alert.show("Could not load file_of_filenames!! "+e); } } /** errorLoadingConfigFile(IOErrorEvent) * * come here if there is a problem reading file_of_filenames * */ public function errorLoadingConfigFile(e:IOErrorEvent) : void { Alert.show("Could not read config file! Error="+e); } /** errorLoading(IOErrorEvent) * * if there was an error loading images, come here -- * * null out the BitmapData reference */ public function errorLoading(e:IOErrorEvent) : void { for (var i:int=0; i= 0) { debug(" baseEnhance = "+baseEnhance); madeEnhBitmaps = true; enhBitmaps[k] = imgList[i][k].clone(); imgList[i][k].paletteMap(enhBitmaps[k], imgRect, upperLeft, enh[baseEnhance][0], enh[baseEnhance][1], enh[baseEnhance][2]); } // if first image, then make a UIComponent & Sprite for it if (k == 0) { lowerRight = new Point(imgWidth, imgHeight); if (backSprite != null) { backSprite.removeChild(bmBack); backSprite.removeEventListener(MouseEvent.MOUSE_DOWN, bclick); backSprite.removeEventListener(MouseEvent.MOUSE_UP, bclick); } debug("defined bmBack "+i+" width="+bmBack.bitmapData.width); backSprite = new Sprite(); backSprite.addChild(bmBack); if (imgUIBack != null) vb.removeChild(imgUIBack); imgUIBack = new UIComponent(); imgUIBack.height = bmHeight; imgUIBack.width = bmWidth; imgUIBack.addChild(backSprite); backSprite.addEventListener(MouseEvent.MOUSE_DOWN, bclick); backSprite.addEventListener(MouseEvent.MOUSE_UP, bclick); backSprite.addEventListener(MouseEvent.MOUSE_MOVE, bdrag); // now add background image... //drawingPaper = new UIComponent(); if (drawingPaper != null) { drawingPaper.removeAllChildren(); drawingPaper.removeEventListener(MouseEvent.MOUSE_DOWN, bclick); drawingPaper.removeEventListener(MouseEvent.MOUSE_UP, bclick); drawingPaper.removeEventListener(MouseEvent.MOUSE_MOVE, bdrag); } drawingPaper = new Canvas(); drawingPaper.x = 0; drawingPaper.y = 0; drawingPaper.width = bmWidth; drawingPaper.height = bmHeight; drawingPaper.addEventListener(MouseEvent.MOUSE_DOWN, bclick, false,0,true); drawingPaper.addEventListener(MouseEvent.MOUSE_UP, bclick, false,0,true); drawingPaper.addEventListener(MouseEvent.MOUSE_MOVE, bdrag, false,0,true); imgUIBack.addChild(drawingPaper); probePaper = new UIComponent(); probePaper.x = 0; probePaper.y = 0; probePaper.width = bmWidth; probePaper.height = bmHeight; imgUIBack.addChild(probePaper); if (doingLoc) imgUIBack.addChild(locLabel); if (doingHotspots) { if (hsCan != null) hsCan.removeAllChildren(); hsCan = new Canvas(); hsCan.width = bmWidth; hsCan.height = bmHeight; hsCan.autoLayout = false; hsCan.clipContent = true; hsCan.horizontalScrollPolicy = "off"; hsCan.verticalScrollPolicy = "off"; ////// maybe the UIComp needs to have its location fixed.... debug("...ADDING hotspots to new bgnd....."+hsButton.length); for (var m:int = 0; m 0) && (StringUtil.trim(s).lastIndexOf(match) == (StringUtil.trim(s).length - match.length))); } /** getNamesUsingBaseName(String, int) * * from this wild-carded list of basenames, this creates actual file * names by replacing the * or ? with monotonically increasing numbers. * */ private function getNamesUsingBaseName(fn:String, count:int): Array { var filenames:Array = new Array(count); for (var i:int=0; i= 0) { filenames[i] = fn.replace("*",String(val)); } else if (fn.indexOf("?") >= 0) { var substitute:String = fn; var li:int; while ( (li=substitute.lastIndexOf("?")) >= 0) { var ts:String = substitute.substring(0,li)+(val % 10) + substitute.substring(li+1); substitute = ts; val = val /10; } filenames[i] = substitute; } else { filenames[i] = fn+i; } } return filenames; } /** doneGettingEnhTab(Event) * * This event handler is called when the file (enh.tab) containing the * enhancement tables is read. It parses this file and populates * the Combobox list as well as creating the RGB look-up tables. * */ private function doneGettingEnhTab(event:Event) : void { var fne:URLLoader = URLLoader(event.target); fne.removeEventListener(Event.COMPLETE, doneGettingEnhTab); var lines:Array = fne.data.split("\n"); var stuff:Array = new Array(); var m:int; var ienh:int = -1; enh = new Array(); enhNames = new Array(); probeValues = new Array(); probeUnits = new Array(); probePrefixes = new Array(); probeDecimals = new Array(); probeLabels = new Array(); var re:RegExp = / +/; debug("......Done loading enh table...."); var gotAlpha:Boolean = false; var gotValues:Boolean = false; var valUnits:String = probeOneUnit; var valPrefixes:String = probeOnePrefix; var valDecimals:int = probeOneDecimal; var valLabels:String=""; for (var i:int=0; i 0) lines[i] = lines[i].substring(0,m); if (startsWith(lines[i],"*")) { // if the previous table had no alpha info, null it out... if (ienh != -1 && !gotAlpha) enh[ienh][3] = null; gotAlpha = false; ienh = ienh + 1; enh[ienh] = new Array(4); probeValues[ienh] = new Array(256); probeUnits[ienh] = new Array(256); probePrefixes[ienh] = new Array(256); probeDecimals[ienh] = new Array(256); probeLabels[ienh] = new Array(256); enhNames[ienh] = StringUtil.trim(lines[i].substring(1)); for (var k:int=0; k<4; k++) { enh[ienh][k] = new Array(256); for (var n:int=0; n<256; n++) { if (k == 3) { enh[ienh][k][n] = 0; // make sure all zeroes... } else { enh[ienh][k][n] = n<<(8*(2-k)); } } } } else { // inLo inHi rL rH gL gH bL bH [aL aH] [value = beg,end[,unit]] var valInx:int = lines[i].indexOf("value"); if (valInx < 0) valInx = lines[i].indexOf("probe"); var valString:String = ""; var bval:Number = 0; var eval:Number = 0; var valinc:Number = 1; gotValues = false; if (valInx > 0) { valString = lines[i].substring(valInx+1,lines[i].length); lines[i] = lines[i].substring(0,valInx); debug("lines = "+lines[i]); var inxEq:int = valString.indexOf("="); valString = valString.substring(inxEq+1, valString.length); var valItems:Array = valString.split(","); if (valItems.length == 1) { valLabels = StringUtil.trim(valItems[0]); gotValues = false; } else { bval = parseFloat(valItems[0]); eval = parseFloat(valItems[1]); if (valItems.length > 2) { valDecimals = parseInt(valItems[2]); } if (valItems.length > 3) { valUnits = StringUtil.trim(valItems[3]); } if (valItems.length > 4) { valPrefixes = StringUtil.trim(valItems[4]); } gotValues = true; } } var vx:Array = StringUtil.trim(lines[i]).split(re); var a:Array = new Array(); for (k=0; k 0. && location[3] < 0.) { is180 = true; location[3] = location[3] + 360.0; } if (location[1] > location[3]) location[3] = location[3] + 360.0; locLabelFirst="Lat="; locLabelSecond="Lon="; var ls:Array = getParameter("coordinates_style"); if (ls != null) { locLabel.opaqueBackground = parseInt(ls[0] ); locLabel.setStyle("color", parseInt(ls[1]) ); if (ls.length > 2) { if (ls[2].length > 0) locLabel.setStyle("fontSize", parseInt(ls[2]) ); if (ls.length > 3) { locLabelFirst = ls[3]; locLabelSecond = ls[4]; if (ls.length > 5) locLabelDigits = parseInt(ls[5]); } } } locLabel.visible = true; } } } /** makeHotspot(String[]) * * make a hotspot and add to list * * hsButton, hsType, hsValue are all defined prior to calling this!! * * hotspot = x,y, w, h, pan, type, value * hotspot = x,y,icon,filename, pan, type, value [,tooltip] */ private function makeHotspot(s:Array) : void { hsPan.push(StringUtil.trim(s[4])); hsType.push(StringUtil.trim(s[5])); hsValue.push(StringUtil.trim(s[6])); var hsb:SimpleButton; if (StringUtil.trim(s[2]).toLowerCase() == "icon") { var gotit:Boolean = false; /* for (var i:int = 0; i'; return ip"; var userIPInfo:String=ExternalInterface.call(js).toString(); return userIPInfo; } /** debug(String) * * append the string onto the debugTextArea.text preceded by "\n" * * also, trace the string */ private function debug(s:String):void { if (isDebug) { debugTextArea.text = debugTextArea.text + "\n"+s; trace(s); } } } }