Question

AS3 error - 1180: Call to a possibly undefined method setHotspotsVisibilityIndividually.

Asked by: CurtinProp

Hi Guys,

I have another AS error:

1180: Call to a possibly undefined method setHotspotsVisibilityIndividually.

private function hotspotsListChangeHandler(event:Event):void {
			setHotspotsVisibilityIndividually(false);
			var hotspotID:String = ComboBox(event.target).selectedItem.data;
			var coords:String = viewer.getHotspot3DCoords(hotspotID);
			var firstComma:Number = coords.indexOf(",");
			var lastComma:Number = coords.lastIndexOf(",");
			var newX:Number = parseFloat(coords.slice(0, firstComma));
			var newY:Number = parseFloat(coords.slice(firstComma + 1, lastComma));
			var newZoom:Number = parseFloat(coords.slice(lastComma + 1, coords.length));
			setHotspotVisibilityIndividually(hotspotID, true);
			viewer.zoomToView(newX, newY, newZoom, 250, 10);
		}

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-03-10 at 21:22:57ID24218643
Topic

ActionScript

Participating Experts
2
Points
500
Comments
8

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Undefined class
    I have a class I created called CMyClass. In a header file, I included MyClass.h. Then I have; CMyClass classObject; The error Im getting is: 'classObject' uses undefined class 'CMyClass' The funny thing is that if I comment out the line CMyClass classObject, then compil...
  2. Undefined Index
    Hello, I got a question about and undefined index. I am trying to understand the error as this is the second time I have run across it while learning php from fixing this site. The last time I just needed to add (!isset(before the $POST[])) althought that isn't working for ...
  3. Variable Undefined
    I'm getting a variable undefined error as follows any help would be great Element VIN is undefined in QMYRECORD. The error occurred in C:\ColdFusion8\wwwroot\automotive\member\upload.cfm: line 7 5 : </cfquery> 6 : </cfif> 7 : <cfset myvin=#qMyRecord.vin#&g...
  4. Undefined method selectSingleNode
    Hello, In the following line of the code snippet attached; org.jdom.Attribute levelNode= (org.jdom.Attribute)(XPath.selectSingleNode(jdomDocument,"/catalog//journal[@title='Java Technology']//article[@date='January-2004']/@level")); I get the following error; The...
  5. AS3 error - 1119: Access of possibly undefined pro…
    1119: Access of possibly undefined property visibility through a reference with static type flash.display:Sprite.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: blue-geniePosted on 2009-03-11 at 01:09:37ID: 23854755

quite simply where is this function declared?

setHotspotsVisibilityIndividually() in relation to where you're trying to access it.

flash can't find it.

 

by: CurtinPropPosted on 2009-03-11 at 18:07:50ID: 23863876

setHotspotsVisibilityIndividually(false); Is located in a file named zoomifyhotspotviewer.as

and refers to the following function:

protected function hotspotMouseMoveTimeoutHandler(event:TimerEvent):void {
                  if(tooltipParent != null) {
                        var hotspotData:Hotspot = hotspotsMap[tooltipParent] as Hotspot;
                        if(hotspotData != null && hotspotData.tooltip != "") {
                              Tooltip.show(hotspotData.tooltip);
                        }
                  }

Which is located in a seperate file called zoomifyGrid.as

is there somewhere I have to declare an import or is there a  syntax error on my part when trying to include the function?

thanks for the time.

 

by: CurtinPropPosted on 2009-03-11 at 18:09:05ID: 23863882

My bad,

its refers to this function... in the same zoomgrid file etc:

public function setHotspotsVisibilityIndividually(visibleOrNot:Boolean):void {
   for(var i:int = 0; i <= hotspots.numChildren -1; i++) {
    var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
    hotspotSprite.visible = visibleOrNot;
  }
 }

 

by: blue-geniePosted on 2009-03-11 at 22:59:19ID: 23865182

and you've imported your zoomgrid class?

 

by: CurtinPropPosted on 2009-03-12 at 19:09:05ID: 23875595

Yeah I've added it in the package:

import zoomify.viewer.ZoomGrid;

I did a test and spelt the zoomgrid file wrong ie:

import zoomify.viewer.ZomGrid;

This brought back an error "could not find ZomGrid", I don't get any such error with the correct spelling so flash must be finding and recognising that file.

is it the way I'm calling the function?

setHotspotsVisibilityIndividually(false);

If I call the function like this I don't get an error:

setHotspotsVisibilityIndividually:visible = false;

 but oviously it not what I want to do, but it still recognises the function.... if you know what I mean?


 

by: Jones911Posted on 2009-03-13 at 06:26:24ID: 23878902

Post the ZoomGrid file here is it a class or just a collection of methods?

 

by: CurtinPropPosted on 2009-03-16 at 21:53:23ID: 23904778

yeah its basically a massive list of methods, the particular function im trying to call is at the very bottom.

"seHotspotsVisibiltyIndividually"

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// Copyright Zoomify, Inc., 1999-2008. All rights reserved.
//
// You may modify but not redistribute this source code file. Files
// created based on this source file may only be distributed in compiled
// SWF form with import protection enabled (see Adobe Flash documentation).
//
// Additional terms apply. Please see the Zoomify License Agreement
// included with this product for complete license terms.
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
package zoomify.viewer
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.events.SecurityErrorEvent;
	import flash.events.MouseEvent;
	import flash.events.EventDispatcher;
	import flash.events.TimerEvent;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.geom.Matrix;
	import flash.net.*;
	import flash.text.*;
   	import flash.utils.*;
 
	import zoomify.ZoomifyViewer;
	import zoomify.viewer.TileCache;
	import zoomify.viewer.TileDataLoader;
	import zoomify.events.TileEvent;
	import zoomify.utils.Tooltip;
	import zoomify.viewer.Hotspot;
 
	public class ZoomGrid extends EventDispatcher
	{
	
	
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//::::::::::::::::::::::::::::::::: INIT METHODS :::::::::::::::::::::::::::::::::::::
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
		public var numTiles:uint;
		public var expectedTiles:uint;
 
		private var _viewer:ZoomifyViewer;
		private var parent_mc:Sprite;
		private var canvas:Sprite;
		private var canvasSprite:Sprite;
		private var priorBitmap:Bitmap;
		private var background:Sprite; 
		private var tileCache:TileCache;
		private var hotspots:Sprite;
		private var hotspotsInUse:int = 0;
 
		private var currentTilesArray:Array;
		private var tilesToLoad:uint = 0;
		private var tilesLoaded:uint = 0;
		private var backgroundTilesToLoad:uint = 0;
		private var backgroundTilesLoaded:uint = 0;
		
		private var hotspotsMap:Dictionary;
		private var hotspotsLoadingArray:Array =  [];
		private var hotspotSpritesLoadingArray:Array =  [];
		private var hotspotsPlaceholderSprite:Sprite;
		private var hotspotsInitialVisibility:Boolean = false;
		private var hotspotsMinScale:Number = 0;
		private var hotspotsMaxScale:Number = 0;
 
		private var visWidth:Number;
		private var visHeight:Number;
		private var tileSize:uint;
		private var numTilesX:uint;
		private var numTilesY:uint;
		private var tileX:int = 0;
		private var tileY:int = 0;
		private var tier:uint = 4;
		private var maxTier:uint;
		private var fullWidth:uint;
		private var fullHeight:uint;
		private var tierWidth:Number;
		private var widthScale:Number;
		private var heightScale:Number;
		private var maxTileX:uint;
		private var maxTileY:uint;
		public var backgroundTier:int = -1;
		private var padImage:uint = 0; // Creates border for debugging.
		private var imageW:uint;
		private var imageH:uint;
		private var priorTileX:int;
		private var priorTileY:int;
		private var priorZoom:Number;
		private var scaling:Boolean = false;
		private var firstFullViewDrawn:Boolean = false;
		private var firstTileDrawn:Boolean = false;
 
		private var _enabled:Boolean = true;
 
		private var fadeInTimer:Timer;
		private var fadeInSpeed:Number = 300;
		
		private var panConstrain:Boolean = true;
		private var hotspotsVisibility:Boolean = true;
		private var eventsEnabled:Boolean = false;
		
		protected var tooltipTimer:Timer;
		protected var tooltipParent:Sprite;
		
		protected var ratioBackgroundToFullWidth:Number = 1;
		
		public function ZoomGrid(parent:Sprite, tc:TileCache):void	
		{
			tileCache = tc;
			tileCache.addEventListener(TileEvent.READY, tileLoaded, false, 0, true);
			tileCache.addEventListener(TileEvent.REMOVED, tileUnloaded, false, 0, true);
			
			currentTilesArray = [];
 
			parent_mc = parent;
			canvas = new Sprite();
			background = new Sprite();
			canvasSprite = new Sprite();
			hotspots = new Sprite();
			priorBitmap = new Bitmap();
			priorBitmap.smoothing = true;
			canvas.addChild(background);
			canvas.addChild(priorBitmap);
			canvas.addChild(canvasSprite);
			canvas.addChild(hotspots);
			hotspotsInUse = 1; // Remove this line if remove line above.
			
			canvas.buttonMode = true;
			canvas.useHandCursor = true;
			parent_mc.addChild(canvas);
			
			fadeInTimer = new Timer(50, 0);
			fadeInTimer.addEventListener("timer", fadeInTimerHandler, false, 0, true);
			fadeInTimer.start();
					
			addEventListener("viewerFirstTileDrawInternal", firstTileDrawGridInternalHandler, false, 0, true);
			addEventListener("viewerFirstFullViewDrawInternal", firstFullViewDrawGridInternalHandler, false, 0, true);
			
			tooltipTimer = new Timer(500, 1);
			tooltipTimer.addEventListener(TimerEvent.TIMER, hotspotMouseMoveTimeoutHandler);
			
			hotspotsMap = new Dictionary(true);
		}
		
		
		
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::: GET & SET METHODS ::::::::::::::::::::::::::::
		//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		
		public function get viewer():ZoomifyViewer {
			return _viewer;
		}
		
		public function set viewer(newViewer:ZoomifyViewer):void {
			_viewer = newViewer;
		}
		
		public function get x():Number {
			var mult:Number = 1 << (maxTier - tier);
			var visW:Number = visWidth * mult / canvas.scaleX;
			var relX:Number = (tileX * tileSize - (canvas.x / canvas.scaleX)) * mult;
			return relX + (visW / 2);
		}
		
		public function set x(value:Number):void {
			if(canvas) {
				var mult:Number = 1 << (maxTier - tier);
				var visW:Number = visWidth * mult / canvas.scaleX;
				value = value - (visW / 2);
				canvas.x = (value / mult - (tileX * tileSize)) * -canvas.scaleX;
			}
		}
		
		public function get y():Number {
			var mult:Number = 1 << (maxTier - tier);
			var visH:Number = visHeight * mult / canvas.scaleX;
			var relY:Number = (tileY * tileSize - (canvas.y / canvas.scaleY)) * mult;
			return relY + (visH / 2);
		}
		
		public function set y(value:Number):void {
			if(canvas) {
				var mult:Number = 1 << (maxTier - tier);
				var visH:Number = visHeight * mult / canvas.scaleX;
				value = value - (visH / 2);
				canvas.y = (value / mult - (tileY * tileSize)) * -canvas.scaleY;
			}
		}	
		
		public function get xImageSpan():Number {
			return 2 * x / fullWidth - 1;
		}
		
		public function set xImageSpan(value:Number):void {
			if(canvas) {
				var mult:Number = 1 << (maxTier - tier);
				var visW:Number = visWidth * mult / canvas.scaleX;
				value = (value * fullWidth / 2) - (visW / 2) + (fullWidth / 2);
				canvas.x = (value / mult - (tileX * tileSize)) * -canvas.scaleX;
			}
		}
		
		public function get yImageSpan():Number {
			return 2 * y / fullHeight - 1;
		}	
		
		public function set yImageSpan(value:Number):void {
			if(canvas) {
				var mult:Number = 1 << (maxTier - tier);
				var visH:Number = visHeight * mult / canvas.scaleX;
				value = (value * fullHeight / 2) - (visH / 2) + (fullHeight / 2);
				canvas.y = (value / mult - (tileY * tileSize)) * -canvas.scaleY;
			}
		}
				
		public function get scaleX():Number {
			return canvas.scaleX;
		}
				
		public function set scaleX(value:Number):void {
			if(canvas) {
				canvas.scaleX = value;
			}
		}	
				
		public function get scaleY():Number {
			return canvas.scaleY;
		}
				
		public function set scaleY(value:Number):void {
			if(canvas) {
				canvas.scaleY = value;
			}
		}
		
		public function getFadeInSpeed():Number {
			return fadeInSpeed;
		}
		
		public function setFadeInSpeed(durationInMilliseconds:Number):void {
			fadeInSpeed = durationInMilliseconds;
		}
		
		public function getPanConstrain():Boolean {
			return panConstrain;
		}
		
		public function setPanConstrain(value:Boolean):void {
			panConstrain = value;
		}
 
		public function getMousePosition():Point {
			return new Point(
				((background.mouseX * background.scaleX) / background.width),
				((background.mouseY * background.scaleY) / background.height)
			);
		}
				
		public function getCurrentTier():int {
			return tier;
		}
		
		public function getMaxTier():uint {
			return maxTier;
		}
		
		public function setMaxTier(value:uint):void {
			maxTier = value;
		}
		
		public function getCanvasWidth():Number {
			return numTilesX * tileSize;
		}
		
		public function getCanvasHeight():Number {
			return numTilesY * tileSize;
		}
		
		public function get enabled():Boolean {
			return _enabled;
		}
		
		public function set enabled(value:Boolean):void {
			canvas.buttonMode = value;
			canvas.useHandCursor = value;
			_enabled = value;
		}
		
		public function active(value:Boolean):void {
			// Toggle interactivity by setting grid's container clip visibility.
			parent_mc.visible = value;
			if(!value) {
				priorBitmap.bitmapData = null;
			}
		}
		
		public function setEventsEnabled(value:Boolean):void {
			eventsEnabled = value;
		}
		
		
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::: CORE METHODS :::::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
									
		public function configureCanvas(tlS:uint, visW:Number, visH:Number, fullW:uint, fullH:uint, t:int, tScaleDownThreshold:Number, tWidthsInTilesArray:Array, tHeightsInTilesArray:Array):void {
			visWidth = visW;
			visHeight = visH;
			tileSize = tlS;
			tier = t;
			fullWidth = fullW; 
			fullHeight = fullH; 
			// Determine max tier.
			var max:Number = Math.max(fullWidth, fullHeight) / Number(tileSize);
			for(var i:uint = 0; (1 << i) < max; i++) {
				widthScale = fullWidth / ((1 << i) * tileSize);
				heightScale = fullHeight / ((1 << i) * tileSize);
				if(max > (1 << i)) { widthScale = fullWidth / ((1 << (i + 1)) * tileSize); }
				if(max > (1 << i)) { heightScale = fullHeight / ((1 << (i + 1)) * tileSize); }
			}
			imageW = widthScale * fullWidth;
			imageH = heightScale * fullHeight;
			var r:uint;
			var c:uint;
			var n:uint = 1<<t;
			for(r = 0; r < n; r++) {
				if((r * tileSize) > (n * tileSize * widthScale)) {
					break;
				}
				maxTileX = r;
			}
			for(c = 0; c < n; c++) {
				if((c * tileSize) > (n * tileSize * heightScale)) {
					break;
				}
				maxTileY = c;
			}
			tileX = 0;
			tileY = 0;
			// Divide by scale down threshold (at 0.5 double the area is needed).
			numTilesX = Math.ceil(visWidth / tileSize) / tScaleDownThreshold + 1;
			numTilesY = Math.ceil(visHeight / tileSize) / tScaleDownThreshold + 1; 
			if(backgroundTier == -1) {
				background.graphics.clear();
				backgroundTier = Math.round(i / 3); // DEV NOTE: Round for best tier choice (not ceil, not just uint).
				if(backgroundTier > 2) {  // DEV NOTE: Using value 3 would cause avg 1MB init impact.
					backgroundTier = 2;
				} 
				var tWInT:uint = tWidthsInTilesArray[backgroundTier];
				var tHInT:uint = tHeightsInTilesArray[backgroundTier];
				for (var rowCounter:Number = 0; rowCounter <= tHInT-1; rowCounter++) {
					for (var columnCounter:Number = 0; columnCounter <= tWInT-1; columnCounter++) {
						backgroundTilesToLoad +=1;
						tileCache.loadTile(backgroundTier, rowCounter, columnCounter);
					}			
				}	
				background.scaleY = background.scaleX = (1 << tier) / Number(1 << backgroundTier);
				scaleHotspotsLayer();
			}
		}
		
		public function updateCanvas(tlS:uint, fullW:uint, fullH:uint, t:int, tWidthsInTiles:Array, tHeightsInTiles:Array):void {
			// Reset key variables.
			tileSize = tlS;
			tier = t;
			fullWidth = fullW; 
			fullHeight = fullH;			
			// Recalculate key limits.
			var max:Number = Math.max(fullWidth, fullHeight) / Number(tileSize);
			for(var i:uint = 0; (1 << i) < max; i++) {
				widthScale = fullWidth / ((1 << i) * tileSize);
				heightScale = fullHeight / ((1 << i) * tileSize);
				if(max > (1 << i)) { widthScale = fullWidth / ((1 << (i + 1)) * tileSize); }
				if(max > (1 << i)) { heightScale = fullHeight / ((1 << (i + 1)) * tileSize); }
			}
			var r:uint;
			var c:uint;
			var n:uint = 1<<t;
			for(r = 0; r < n; r++) {
				if((r * tileSize) > (n * tileSize * widthScale)) {
					break;
				}
				maxTileX = r;
			}			
			for(c = 0; c < n; c++) {
				if((c * tileSize) > (n * tileSize * heightScale)) {
					break;
				}
				maxTileY = c;
			}
		}
		
		public function updateTiles(vWidth:Number, vHeight:Number, vXIS:Number, vYIS:Number, t:uint, tWidth:Number, tHeight:Number, tWInT:uint, tHInT:uint, force:Boolean = false):void {
			tierWidth = tWidth;
			
			var otX:int = tileX;
			var otY:int = tileY;
			positionCanvas();
			positionBackground(); 
			positionHotspots();
			constrainPan();
			
			var currentZoom:Number = getCurrentTierScale() * (tWidth / fullWidth);
			priorBitmap.visible = ((priorTileX == tileX) && (priorTileY == tileY) && (currentZoom > priorZoom + 0.3));
			priorZoom = getCurrentTierScale() * (tWidth / fullWidth);
			
			selectTiles(vWidth, vHeight, vXIS, vYIS, t, getCurrentTierScale(), tWidth, tHeight, tWInT, tHInT);
			var moved:Boolean = ((otX != tileX) || (otY != tileY));
			if(force || moved) {
				renderUpdatedTiles();
			}
		}
		
		public function positionCanvas():void {
			var t:int;
			if(canvas.x > 0) {
				t = Math.ceil(canvas.x / (tileSize * canvas.scaleX));
				tileX -= t;
				canvas.x -= t * tileSize * canvas.scaleX;
			} else if((canvas.x + (getCanvasWidth() * canvas.scaleX)) < visWidth) {
				t = Math.ceil((visWidth - (canvas.x + getCanvasWidth() * canvas.scaleX)) / (tileSize * canvas.scaleX));
				tileX += t;
				canvas.x += t * tileSize * canvas.scaleX;
			} 
			if(canvas.y > 0) {
				t = Math.ceil(canvas.y / (tileSize * canvas.scaleY));
				tileY -= t;
				canvas.y -= t * tileSize * canvas.scaleY;
			} else if((canvas.y + (getCanvasHeight() * canvas.scaleY)) < visHeight) {
				t = Math.ceil((visHeight - (canvas.y + getCanvasHeight() * canvas.scaleY)) / (tileSize * canvas.scaleY));
				tileY += t;
				canvas.y += t * tileSize * canvas.scaleY;
			}
		}
		
		public function positionBackground():void {	
			background.x = -tileX * tileSize;
			background.y = -tileY * tileSize;
		}
				
		public function constrainPan():void {
			if(panConstrain){  
				var wd:Number = widthScale * (1 << tier) * tileSize * canvas.scaleX;
				var ht:Number = heightScale * (1 << tier) * tileSize * canvas.scaleY;
				if(wd > visWidth) {
					if(canvas.x - tileSize * tileX * canvas.scaleX > 0) {
						canvas.x = tileSize * tileX * canvas.scaleX;
						if(eventsEnabled) { dispatchEvent(new Event("viewerConstrainingPan")); }
					}
					if(canvas.x - tileSize * tileX * canvas.scaleX + wd < visWidth) {
						canvas.x = visWidth + (tileSize * tileX * canvas.scaleX) - wd;
						if(eventsEnabled) { dispatchEvent(new Event("viewerConstrainingPan")); }
					}
				} else {
					canvas.x = visWidth / 2 - wd / 2 + tileSize * tileX * canvas.scaleX;
				}
				if(ht > visHeight) {
					if(canvas.y - tileSize * tileY * canvas.scaleY > 0) {
						canvas.y = tileSize * tileY * canvas.scaleY;
						if(eventsEnabled) { dispatchEvent(new Event("viewerConstrainingPan")); }
					}
					if(canvas.y - tileSize * tileY * canvas.scaleY + ht < visHeight) {
						canvas.y = visHeight + (tileSize * tileY * canvas.scaleY) - ht;
						if(eventsEnabled) { dispatchEvent(new Event("viewerConstrainingPan")); }
					}
				} else {
					canvas.y = visHeight / 2 - ht / 2 + tileSize * tileY * canvas.scaleY;
				}
				canvas.x = Math.round(canvas.x);
				canvas.y = Math.round(canvas.y);
			}
		}
				
		public function selectTiles(vWidth:Number, vHeight:Number, vXIS:Number, vYIS:Number, t:uint, tScale:Number, tWidth:Number, tHeight:Number, tWInT:uint, tHInT:uint):void {
			if(eventsEnabled) { dispatchEvent(new Event("viewLoadingStart")); }
			var needLoad:Boolean = false;
			
			var viewLeft:Number = -(vWidth / 2);
			var viewRight:Number = vWidth / 2;
			var viewTop:Number = -(vHeight / 2);
			var viewBottom:Number = vHeight / 2;
			
			var scaledTileSize:Number = tileSize * tScale;
			var scaledCenterX:Number = (tWidth * tScale / 2) - (tWidth * tScale * (-vXIS/2));
			var scaledCenterY:Number = (tHeight * tScale / 2) - (tHeight * tScale * (-vYIS/2));
			
			var scaledLeft:Number = scaledCenterX + viewLeft;
			var scaledRight:Number = scaledCenterX + viewRight;
			var scaledTop:Number = scaledCenterY + viewTop;
			var scaledBottom:Number = scaledCenterY + viewBottom;
			
			var viewLeftColumn:Number = Math.floor(scaledLeft / scaledTileSize);
			var viewRightColumn:Number = Math.floor(scaledRight / scaledTileSize);
			var viewTopRow:Number = Math.floor(scaledTop / scaledTileSize);
			var viewBottomRow:Number = Math.floor(scaledBottom / scaledTileSize);
			
			if (viewLeftColumn < 0 || t == backgroundTier) { viewLeftColumn = 0; }
			if ((viewRightColumn > tWInT - 1) || t == backgroundTier) { viewRightColumn = tWInT - 1; }
			if (viewTopRow < 0 || t == backgroundTier) { viewTopRow = 0; }
			if ((viewBottomRow > tHInT - 1) || t == backgroundTier) { viewBottomRow = tHInT - 1; }
			
			if(!firstFullViewDrawn) { tilesToLoad = (viewRightColumn - viewLeftColumn + 1) * (viewBottomRow - viewTopRow + 1); }
			for (var rowCounter:Number = viewTopRow; rowCounter <= viewBottomRow; rowCounter++) {
				for (var columnCounter:Number = viewLeftColumn; columnCounter <= viewRightColumn; columnCounter++) {
					if(eventsEnabled) { dispatchEvent(new Event("viewLoadingProgress")); }
					if(tileCache.loadTile(tier, rowCounter, columnCounter)) {
						needLoad = true;
					}	
				}			
			}				
			if(eventsEnabled) { dispatchEvent(new Event("viewLoadingComplete")); }
			if(needLoad) {
				tileCache.purge();
			}
		}
		
		public function renderLoadedTile():void {	
			canvas.removeChild(canvasSprite);
			canvasSprite = new Sprite();
			canvas.addChildAt(canvasSprite, canvas.numChildren - hotspotsInUse);  // If not using hotspots, no hotspot sprite, less children.
			for(var r:int = tileY; r < tileY + numTilesY; r++) {
				for(var c:int = tileX; c < tileX + numTilesX; c++) {
					var idx:int = ((r - tileY) * numTilesX + (c - tileX));
					var tile:Bitmap = currentTilesArray[idx] as Bitmap; 
					var bmp:Bitmap = tileCache.convertTileDataToBitmap(tier, r, c);
					if(bmp == null || bmp.bitmapData == null) {
						currentTilesArray[idx] = null;
					} else {
						currentTilesArray[idx] = bmp;
						canvasSprite.addChild(bmp);
						bmp.smoothing = true;
						bmp.x = (c - tileX) * tileSize;
						bmp.y = (r - tileY) * tileSize;
						tilesLoaded += 1;
						if(!firstTileDrawn) {
							firstTileDrawn = true;
							dispatchEvent(new Event("viewerFirstTileDrawInternal"));
							if(eventsEnabled) { dispatchEvent(new Event("viewerFirstTileDraw")); }
						}
					}
				}
			}
			if((tilesLoaded >= tilesToLoad) && !firstFullViewDrawn && (backgroundTilesLoaded >= backgroundTilesToLoad)) { 
				firstFullViewDrawn = true;
				dispatchEvent(new Event("viewerFirstFullViewDrawInternal"));
				if(eventsEnabled) { dispatchEvent(new Event("viewerFirstFullViewDraw")); }
			}
		}
 
		public function renderUpdatedTiles():void {
			canvas.removeChild(canvasSprite);
			canvasSprite = new Sprite();
			canvas.addChildAt(canvasSprite, canvas.numChildren - 1);  // DEV NOTE: remove '-1' if removing hotspot sprite.
			for(var r:int = tileY; r < tileY + numTilesY; r++) {
				for(var c:int = tileX; c < tileX + numTilesX; c++) {
					var idx:int = ((r - tileY) * numTilesX + (c - tileX));
					var tile:Bitmap = currentTilesArray[idx] as Bitmap; 
					var bmp:Bitmap = tileCache.convertTileDataToBitmap(tier, r, c);
					if(bmp == null || bmp.bitmapData == null) {
						currentTilesArray[idx] = null;
					} else {
						currentTilesArray[idx] = bmp;
						canvasSprite.addChild(bmp);
						bmp.smoothing = true;
						bmp.x = (c - tileX) * tileSize;
						bmp.y = (r - tileY) * tileSize;
						tilesLoaded += 1;
					}
				}
			}
		}
		
		public function setPriorBitmap(bmp:BitmapData):void {
			priorBitmap.bitmapData = bmp;
			priorBitmap.smoothing = true;
		}
		
		public function offsetCanvas(ox:Number, oy:Number):int {
			var xO:Number = canvas.x;
			var yO:Number = canvas.y;
			canvas.x += ox;
			canvas.y += oy;
			constrainPan();
			var r:int = 0;
			if(Math.abs(canvas.x - xO - ox) >= 1) { r |= 1; }
			if(Math.abs(canvas.y - yO - oy) >= 1) { r |= 2; }
			return r;
		}
		
		public function getImageOffset():Point {
			return new Point(
				canvas.x - tileSize * tileX * canvas.scaleX,
				canvas.y - tileSize * tileY * canvas.scaleY
			);
		}
		
		public function setImageOffset(p:Point):void {
			var ts:Number = tileSize * canvas.scaleX;
			canvas.x = Math.round(p.x + tileX * ts);
			canvas.y = Math.round(p.y + tileY * ts);
			constrainPan();
		}
		
		public function getOffset():Point {
			return new Point(
				tileSize * tileX * canvas.scaleX + -canvas.x,
				tileSize * tileY * canvas.scaleY + -canvas.y
			);
		}
		
		public function setOffset(p:Point, tWidth:Number):void {
			// Determine the correct x,y.
			var ts:Number = tileSize * canvas.scaleX;
			priorTileX = tileX = Math.floor(p.x / ts);
			priorTileY = tileY = Math.floor(p.y / ts);
			canvas.x = Math.round(-((p.x / ts) - Math.floor(p.x / ts)) * ts);
			canvas.y = Math.round(-((p.y / ts) - Math.floor(p.y / ts)) * ts);
			priorBitmap.scaleY = priorBitmap.scaleX = 1 / canvas.scaleX;
			priorBitmap.x = -canvas.x * priorBitmap.scaleX;
			priorBitmap.y = -canvas.y * priorBitmap.scaleY;
			priorBitmap.visible = true;
			background.scaleY = background.scaleX = (1 << tier) / Number(1 << backgroundTier);
			scaleHotspotsLayer();
			background.x = hotspots.x = -tileX * tileSize;
			background.y = hotspots.y = -tileY * tileSize;
		}
		
		public function getCurrentTierScale():Number {
			return canvas.scaleX;
		}
 
		public function resetScale(sc:Number = 1):void {
			canvas.scaleX = canvas.scaleY = sc;	
		}
 
		public function scaleCurrentTier(sc:Number, rx:Number, ry:Number):void {
			if(tier == 0 && sc <= 0) { sc = 1; }
			var lp:Point = new Point(rx, ry);
			lp = canvas.globalToLocal(lp);
			canvas.x += lp.x * canvas.scaleX - lp.x * sc;
			canvas.y += lp.y * canvas.scaleY - lp.y * sc;
			canvas.scaleY = canvas.scaleX = sc;
			constrainPan();
		}
 
		public function scaleCurrentTierRelatively(sc:Number, rx:Number, ry:Number, center:Point):void {
			if(tier == 0 && sc < 1) { sc = 1; }
			var lp:Point = new Point(rx * background.width + background.x, ry * background.height + background.y);
			center = canvas.globalToLocal(center);
			lp.x += (lp.x - center.x) * 0.5;
			lp.y += (lp.y - center.y) * 0.5;
			canvas.x += lp.x * canvas.scaleX - lp.x * sc;
			canvas.y += lp.y * canvas.scaleY - lp.y * sc;
			canvas.scaleY = canvas.scaleX = sc;
			constrainPan();
		}
				
		
		
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//::::::::::::::::::::::::::::::::: EVENT HANDLERS :::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		
		public function tileLoaded(event:TileEvent):void {
			event.bmp.alpha = 0;
			if(event.t == backgroundTier) {
				event.loader.immortal = true;
				var bmp:Bitmap = tileCache.convertTileDataToBitmap(event.t, event.r, event.c);
				if(bmp != null) {	
					var xform:Matrix = new Matrix();
					xform.tx = event.c * tileSize;
					xform.ty = event.r * tileSize;
					background.graphics.beginBitmapFill(bmp.bitmapData, xform, false, true);
					background.graphics.drawRect(event.c * tileSize, event.r * tileSize, bmp.bitmapData.width, bmp.bitmapData.height);
					background.graphics.endFill();	
					backgroundTilesLoaded += 1;
				}
			} 
			if((tilesLoaded >= tilesToLoad) && !firstFullViewDrawn && (backgroundTilesLoaded >= backgroundTilesToLoad)) { 
				firstFullViewDrawn = true;
				dispatchEvent(new Event("viewerFirstFullViewDrawInternal"));
				if(eventsEnabled) { dispatchEvent(new Event("viewerFirstFullViewDraw")); }
			}
			if(event.t != tier) { return; }
			renderLoadedTile();
		}
		
		protected function firstTileDrawGridInternalHandler(event:Event):void {
			// Place code here to execute at scope of grid on first draw.
			removeEventListener("viewerFirstTileDrawInternal", firstTileDrawGridInternalHandler);
		}
 
		protected function firstFullViewDrawGridInternalHandler(event:Event):void {
			removeEventListener("viewerFirstFullViewDrawInternal", firstFullViewDrawGridInternalHandler);
			ratioBackgroundToFullWidth = background.width / (background.scaleX * fullWidth);
			scaleHotspotsLayer();
		}
		
		public function tileUnloaded(event:TileEvent):void {
			if(event.bmp != null) {
				for(var s:String in currentTilesArray) {
					if(currentTilesArray[s] == event.bmp) {
						currentTilesArray[s] = null;
					}
				}
				if(canvasSprite.contains(event.bmp)) {
					canvasSprite.removeChild(event.bmp);
				}
			}
		}
		
		private function fadeInTimerHandler(event:TimerEvent):void {
			for(var r:int = 0; r < numTilesY; r++) {
				for(var c:int = 0; c < numTilesX; c++) {
					var idx:int = r * numTilesX + c;
					var s:DisplayObject = currentTilesArray[idx];
					if(s == null || s.alpha == 1) { continue; }
					s.alpha += (50 / fadeInSpeed);
					if(s.alpha >= 1) {
						s.alpha = 1;
					}
				}
			}
		}
		
		
		
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//::::::::::::::::::::::::::::::: SUPPORT METHODS ::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
		public function clearHotspots() {
			for(var i:int = hotspots.numChildren - 1; i >= 0; i--) {
				var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
				delete hotspotsMap[hotspotSprite];
				hotspots.removeChildAt(i);
			}			
			hotspotsLoadingArray =  [];
			hotspotSpritesLoadingArray =  [];
		}
		
		public function clearTiles() {
			currentTilesArray =  [];
			backgroundTier = -1;	
		}
		
		// Not currently used.  Debugging tool.
		// x value is distance of left edge of image from left edge of viewer.
		// y value is distance of left edge of image from top edge of viewer.
		// Values reported in pixels. Values do not vary with zoom.
		public function getImageOffsetInView():Point {
			var adj:Number = Math.pow(2, maxTier - tier) * canvas.scaleX;
			return new Point(
				canvas.x * adj - tileX * tileSize * adj,
				canvas.y * adj - tileY * tileSize * adj
			);
		}
		
		// Debugging tool.
		override public function toString():String {
			return (
				"fullWidth/Height: " + fullWidth + " / " + fullHeight + "\n" +
				"visWidth/Height: " + visWidth + " / " + visHeight + "\n" +
				"pixelCoords: " + Math.round(x) + " / " + Math.round(y) + "\n" +
				"tilePos: " + tileX + " / " + tileY + "\n" +
				"tileSize: " + tileSize + "\n" +
				"canvasCoords: " + canvas.x + " / " + canvas.y + "\n" +
				"canvasScale: " + canvas.scaleX + "\n" + 
				"canvasSize: " + Math.round((1 << tier) * tileSize) + " / " + Math.round((1 << tier) * tileSize) + "\n" + 
				"tier: " + tier + "\n" +
				"maxtier: " + maxTier + "\n"
			);
		}		
					
		protected function indexOfContainingElement(arrayToFindIn:Array, elementToFind:String):Number {
			var elementIndex:Number = -1;
			var elmntCntr:Number = 0;
			var arrayLength:Number = arrayToFindIn.length;
			while(elmntCntr < arrayLength) {				
				if(arrayToFindIn[elmntCntr].toString().indexOf(elementToFind) != -1) {
					elementIndex = elmntCntr;
					elmntCntr = arrayLength;
				}else{
					elmntCntr++;
				}
			}
			return elementIndex;
		}
		
		
		
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//::::::::::::::::::::::::::::::: HOTSPOT METHODS ::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::: HOTSPOT INIT METHODS ::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		
		public function loadHotspots(data:Array):void {
			while(hotspots.numChildren > 0) {
				hotspots.removeChildAt(0);
			}
			for(var i:uint = 0; i < data.length; i++) {
				var hotspot:Hotspot = data[i] as Hotspot;
				if(hotspot != null) {
					addHotspot(hotspot);
				}
			}
		}
		
		
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//::::::::::::::::::: HOTSPOT GET & SET METHODS :::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
				
		public function get hotspotsInitVisibility():Boolean {
			return hotspotsInitialVisibility;
		}
		
		public function set hotspotsInitVisibility(value:Boolean):void {
			hotspotsInitialVisibility = value;
		}
		
		public function getHotspotsVisibility():Boolean {
			return hotspotsVisibility;
		}
		
		public function setHotspotsVisibility(visibilityValue:Boolean):void {
			hotspotsVisibility = visibilityValue;
			hotspots.visible = hotspotsVisibility;
		}
		
		// DEV NOTE: Modified for Hide Show One Hotspot Example.
		public function getHotspotVisibility(id:String):Boolean {
			var hotspotVisibility:Boolean;
			for(var i:int = hotspots.numChildren - 1; i >= 0; i--) {
				var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
				var hotspot:Hotspot = hotspotsMap[hotspotSprite];
				if(hotspot.id == id) {
					hotspotVisibility = hotspotSprite.visible;
					break
				}
			}	
			return hotspotVisibility;	
		}
		
		// DEV NOTE: Modified for Hide Show One Hotspot Example.
		public function setHotspotVisibility(id:String, visibility:Boolean):void {
			for(var i:int = hotspots.numChildren - 1; i >= 0; i--) {
				var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
				var hotspot:Hotspot = hotspotsMap[hotspotSprite];
				if(hotspot.id == id) {
					hotspotSprite.visible = visibility;
					break;
				}
			}		
		}
		
		public function getHotspotCoords(id:String = null):Point {
			if(id == null) {
				var mult:Number = 1 << (maxTier - tier);
				var visW:Number = visWidth * mult / canvas.scaleX;
				var visH:Number = visHeight * mult / canvas.scaleY;
				return new Point(x + (visW / 2), y + (visH / 2));
			} else {
				for(var i:int = hotspots.numChildren - 1; i >= 0; i--) {
					var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
					var hotspot:Hotspot = hotspotsMap[hotspotSprite];
					if(hotspot.id == id) {
						return new Point(hotspot.x, hotspot.y);
					}
				}
			}
			return new Point(fullWidth / 2, fullHeight / 2);
		}
		
		public function getHotspot3DCoords(id:String = null):String {
			if(id) {
				for(var i:int = hotspots.numChildren - 1; i >= 0; i--) {
					var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
					var hotspot:Hotspot = hotspotsMap[hotspotSprite];
					if(hotspot.id == id) {
						return (hotspot.x + "," + hotspot.y + "," + hotspot.zoom);
					}
				}
			} else {
				return "";
			}
			return "";
		}
		
		public function  setHotspotScaleConstraints(min:Number, max:Number):void {
			hotspotsMinScale = min;
			hotspotsMaxScale = max;
		}
				
		
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::: HOTSPOT CORE METHODS ::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
		public function addHotspot(hotspot:Hotspot):void {
			var hotspotClone:Hotspot = hotspot.clone();
			var hotspotSprite:Sprite = new Sprite();
			hotspotsMap[hotspotSprite] = hotspotClone; // Cloning allows multiple use for any hotspot media symbol/file.
			hotspotsLoadingArray.push(hotspotClone); // Allows url-based search for external media hotspot.
			hotspotSpritesLoadingArray.push(hotspotSprite); // Allows Display Object configuration for external media hotspot.
			hotspotSprite.x = hotspotClone.x;
			hotspotSprite.y = hotspotClone.y;
			hotspotSprite.scaleX = hotspotClone.xScale / 100;
			hotspotSprite.scaleY = hotspotClone.yScale / 100;
			hotspotSprite.visible = false;
			switch(hotspotClone.mediaType) {
				case Hotspot.MEDIATYPE_SYMBOL:
					var classDef:Object = null;
					try {
						classDef = getDefinitionByName(hotspotClone.media);
					} catch(e:Error) {
						try {
							classDef = _viewer.loaderInfo.applicationDomain.getDefinition(hotspotClone.media) as Object;
						} catch (e:Error) {
						}
					}
					if(classDef != null) {
						var dob:DisplayObject = (new classDef()) as DisplayObject;
						if(dob != null) {
							hotspotSprite.addChild(dob);
							configureHotspot(hotspotSprite);
						}
					}
					break;
				case Hotspot.MEDIATYPE_URL:
					var hotspotLoader:Loader = new Loader();
					hotspotLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadExternalHotspotCompleteHandler, false, 0, true);
					hotspotLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadExternalHotspotIOErrorHandler);
					hotspotLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loadExternalHotspotIOErrorHandler);
					hotspotLoader.load(new URLRequest(hotspotClone.media));
					hotspotSprite.addChild(hotspotLoader);
					break;
			}
			// DEV NOTE: 
			// For internal hotspot media, hotstpots Sprite contains hotspotSprite Sprite contains library symbol as dob DisplayObject.
			// For external hotspot media, hotspots Sprite contains hotspotSprite Sprite contains hotspotLoader Loader contains swf as Movie or jpg/png/gif as Bitmap. 
			hotspots.addChild(hotspotSprite);
		}		
		
		protected function loadExternalHotspotCompleteHandler(event:Event):void {
			var currentURLCleaned:String = event.target.url.slice(event.target.url.lastIndexOf("/")+1);
			for(var i:uint = 0; i < hotspotsLoadingArray.length; i++) {
				if(hotspotsLoadingArray[i].media.indexOf(currentURLCleaned) != -1) {
					configureHotspot(hotspotSpritesLoadingArray[i]);
					var placeholderHotspot:Hotspot = new Hotspot();
					placeholderHotspot = placeholderHotspot.convertToBlankPlaceholder();					
					hotspotsLoadingArray[i] = placeholderHotspot;
					break;	
				}
			}
		}
		
		protected function loadExternalHotspotIOErrorHandler(event:Event):void {
			// DEV NOTE: add showMessage here.
		}
 
		protected function configureHotspot(hotspotSprite:Sprite):void {
			var hotspotData:Hotspot = hotspotsMap[hotspotSprite] as Hotspot;
			var hotspotSpriteContent:DisplayObject = hotspotSprite.getChildAt(0);
			if(hotspotData && hotspotSpriteContent) {
				if(hotspotSprite.getChildAt(0) is Loader) {
					hotspotSpriteContent.x = -hotspotSpriteContent.width / 2;
					hotspotSpriteContent.y = -hotspotSpriteContent.height / 2;
				}
				if(hotspotData.url != "") {
					hotspotSprite.addEventListener(MouseEvent.CLICK, hotspotClickHandler, false, 0, true);
				}
				if(hotspotData.tooltip != "") {
					hotspotSprite.addEventListener(MouseEvent.ROLL_OVER, hotspotRollOverHandler, false, 0, true);
					hotspotSprite.addEventListener(MouseEvent.ROLL_OUT, hotspotRollOutHandler, false, 0, true);
				}
				if(hotspotData.caption != "") {
					var caption:Sprite = new Sprite();
					var tf:TextField = new TextField();
					var tfo:TextFormat = new TextFormat("_sans", 16, 0x000000, true, false, false, null, null, TextFormatAlign.CENTER);
					tf.autoSize = TextFieldAutoSize.LEFT;
					tf.multiline = true;
					tf.selectable = false;
					tf.condenseWhite = true;
					tf.defaultTextFormat = tfo;
					tf.htmlText = hotspotData.caption;
					tf.x = 5;
					tf.y = 2;
					var captionBackground:DisplayObject = _viewer.getHotspotCaptionBackground();
					if(captionBackground) {
						captionBackground.width = tf.width + 10;
						captionBackground.height = tf.height + 4;
						caption.addChild(captionBackground);
					}
					caption.addChild(tf);
					hotspotSprite.addChild(caption);				
					var hotspotSpriteContentRect:Rectangle = hotspotSpriteContent.getBounds(hotspotSprite);
					var x:Number = hotspotSpriteContentRect.x + hotspotSpriteContentRect.width / 2;
					var y:Number = hotspotSpriteContentRect.y + hotspotSpriteContentRect.height + 4;
					caption.x = x - caption.width / 2;
					caption.y = y;
				}
				if(hotspotData.rollover) { 
					hotspotSprite.alpha = 0; 
					caption.getChildAt(1).visible = false;
				}
				if(hotspotsInitialVisibility) { hotspotSprite.visible = true; }
			}
		}
				
		public function positionHotspots():void {
			hotspots.x = -tileX * tileSize;
			hotspots.y = -tileY * tileSize;
		}
 
		public function modifyHotspot(id:String, caption:String, media:String, url:String):void {
			for(var i:int = hotspots.numChildren - 1; i >= 0; i--) {
				var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
				var hotspot:Hotspot = hotspotsMap[hotspotSprite];
				if(hotspot.id == id) {
					removeHotspot(id);
					hotspot._caption = caption;
					hotspot._media = media;
					hotspot._url = url;
					addHotspot(hotspot);
					break;
				}
			}
		}
 
		public function removeHotspot(id:String):void {
			for(var i:int = hotspots.numChildren - 1; i >= 0; i--) {
				var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
				var hotspot:Hotspot = hotspotsMap[hotspotSprite];
				if(hotspot.id == id) {
					hotspots.removeChildAt(i);
					delete hotspotsMap[hotspotSprite];
					break;
				}
			}
		}
 
 
 
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//:::::::::::::::: HOTSPOT EVENT HANDLER METHODS ::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
		protected function hotspotRollOverHandler(event:MouseEvent):void {
			var hotspotSprite:Sprite = event.target as Sprite;
			if(hotspotSprite) {
				hotspotSprite.addEventListener(MouseEvent.MOUSE_MOVE, hotspotMouseMoveHandler, false, 0, true);
				tooltipParent = hotspotSprite;
				tooltipTimer.repeatCount = 1;
				tooltipTimer.reset();
				tooltipTimer.start();
				var hotspotData:Hotspot = hotspotsMap[hotspotSprite] as Hotspot;
				if(hotspotData.rollover) { 
					hotspotSprite.alpha = 100; 
					var tempSprite:Sprite = new Sprite();
					tempSprite = hotspotSprite.getChildAt(1) as Sprite;	
					tempSprite.getChildAt(1).visible = true;
				}
				dispatchEvent(new Event("hotspotRollOver"));
			}
		}
 
		protected function hotspotClickHandler(event:MouseEvent):void {
			var hotspotData:Hotspot = hotspotsMap[event.currentTarget] as Hotspot;
			if(hotspotData) {
				navigateToURL(new URLRequest(hotspotData.url), hotspotData.urlTarget);
			}
		}
 
		protected function hotspotRollOutHandler(event:MouseEvent):void {
			var hotspotSprite:Sprite = event.target as Sprite;
			if(hotspotSprite) {
				hotspotSprite.removeEventListener(MouseEvent.MOUSE_MOVE, hotspotMouseMoveHandler);
				tooltipTimer.stop();
				tooltipTimer.reset();
				Tooltip.hide();
				var hotspotData:Hotspot = hotspotsMap[hotspotSprite] as Hotspot;
				if(hotspotData.rollover) { 
					hotspotSprite.alpha = 0; 
					var tempSprite:Sprite = new Sprite();
					tempSprite = hotspotSprite.getChildAt(1) as Sprite;	
					tempSprite.getChildAt(1).visible = false;
				}
				dispatchEvent(new Event("hotspotRollOut"));
			}
		}
 
		protected function hotspotMouseMoveHandler(event:MouseEvent):void {
			tooltipTimer.reset();
			tooltipTimer.start();
			Tooltip.hide();
		}
 
		protected function hotspotMouseMoveTimeoutHandler(event:TimerEvent):void {
			if(tooltipParent != null) {
				var hotspotData:Hotspot = hotspotsMap[tooltipParent] as Hotspot;
				if(hotspotData != null && hotspotData.tooltip != "") {
					Tooltip.show(hotspotData.tooltip);
				}
			}
		}
		
		
				
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		//::::::::::::::::::::::::::::::: SUPPORT METHODS ::::::::::::::::::::::::::::::
		//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
		
		public function scaleHotspotsLayer():void {
			var newScale:Number = (((1 << tier) * ratioBackgroundToFullWidth) / Number(1 << backgroundTier));
			if(newScale !=0) { 
				hotspots.scaleX = hotspots.scaleY = newScale;
			}
		}
		
		
 
		
		public function scaleHotspots(scalingLayer:Boolean = false):void {
  if(hotspotsMinScale != 0 && hotspotsMaxScale != 0) {
   for(var i:int = 0; i <= hotspots.numChildren -1; i++) {
    var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
    var currentZoom:Number = getCurrentTierScale() * (tierWidth /
fullWidth);
    var newScale = 1 / currentZoom;
    if(newScale < hotspotsMinScale) { newScale = hotspotsMinScale; }
    if(newScale > hotspotsMaxScale) { newScale = hotspotsMaxScale; }
    hotspotSprite.scaleX = hotspotSprite.scaleY = newScale;
   }
  }
 }
		
		
 public function setHotspotsVisibilityIndividually(visibleOrNot:Boolean):void {
   for(var i:int = 0; i <= hotspots.numChildren -1; i++) {
    var hotspotSprite:Sprite = hotspots.getChildAt(i) as Sprite;
    hotspotSprite.visible = visibleOrNot;
  }
 }
 
 
 
 
 
	}
}

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611:
612:
613:
614:
615:
616:
617:
618:
619:
620:
621:
622:
623:
624:
625:
626:
627:
628:
629:
630:
631:
632:
633:
634:
635:
636:
637:
638:
639:
640:
641:
642:
643:
644:
645:
646:
647:
648:
649:
650:
651:
652:
653:
654:
655:
656:
657:
658:
659:
660:
661:
662:
663:
664:
665:
666:
667:
668:
669:
670:
671:
672:
673:
674:
675:
676:
677:
678:
679:
680:
681:
682:
683:
684:
685:
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697:
698:
699:
700:
701:
702:
703:
704:
705:
706:
707:
708:
709:
710:
711:
712:
713:
714:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
797:
798:
799:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814:
815:
816:
817:
818:
819:
820:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838:
839:
840:
841:
842:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858:
859:
860:
861:
862:
863:
864:
865:
866:
867:
868:
869:
870:
871:
872:
873:
874:
875:
876:
877:
878:
879:
880:
881:
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898:
899:
900:
901:
902:
903:
904:
905:
906:
907:
908:
909:
910:
911:
912:
913:
914:
915:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938:
939:
940:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952:
953:
954:
955:
956:
957:
958:
959:
960:
961:
962:
963:
964:
965:
966:
967:
968:
969:
970:
971:
972:
973:
974:
975:
976:
977:
978:
979:
980:
981:
982:
983:
984:
985:
986:
987:
988:
989:
990:
991:
992:
993:
994:
995:
996:
997:
998:
999:
1000:
1001:
1002:
1003:
1004:
1005:
1006:
1007:
1008:
1009:
1010:
1011:
1012:
1013:
1014:
1015:
1016:
1017:
1018:
1019:
1020:
1021:
1022:
1023:
1024:
1025:
1026:
1027:
1028:
1029:
1030:
1031:
1032:
1033:
1034:
1035:
1036:
1037:
1038:
1039:
1040:
1041:
1042:
1043:
1044:
1045:
1046:
1047:
1048:
1049:
1050:
1051:
1052:
1053:
1054:
1055:
1056:
1057:
1058:
1059:
1060:
1061:
1062:
1063:
1064:
1065:
1066:
1067:
1068:
1069:
1070:
1071:
1072:
1073:
1074:
1075:
1076:
1077:
1078:
1079:
1080:
1081:
1082:
1083:
1084:
1085:
1086:
1087:
1088:
1089:
1090:
1091:
1092:
1093:
1094:
1095:
1096:
1097:
1098:
1099:
1100:
1101:
1102:
1103:
1104:
1105:
1106:
1107:
1108:
1109:
1110:
1111:
1112:
1113:
1114:
1115:
1116:
1117:
1118:
1119:
1120:
1121:
1122:
1123:
1124:
1125:
1126:
1127:
1128:
1129:
1130:
1131:
1132:
1133:
1134:
1135:
1136:
1137:
1138:
1139:
1140:
1141:
1142:
1143:
1144:
1145:
1146:
1147:
1148:
1149:
1150:
1151:
1152:
1153:
1154:
1155:
1156:
1157:
1158:
1159:
1160:
1161:
1162:
1163:

Select allOpen in new window

 

by: CurtinPropPosted on 2009-03-31 at 18:48:02ID: 31556612

although not the solution it prompted me to look at how I was importing the supporting methods.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...