troubleshooting Question

AS3: TypeError: Error #1009... Can someone look at my code and see where this error is coming from?

Avatar of cubical38
cubical38 asked on
Adobe Flash
5 Comments1 Solution355 ViewsLast Modified:
I know from the output window that it is on frame 2 yet I have been unable to find the source of this all-so-generic and seemingly pointless error.  Code posted below:

The only thing I can see that looks suspicious is this piece of code that has no listener, yet it still functions properly:

initSite();

Can anyone see any discrepancies that my weary eyes are overlooking?

Thanks again...
stop();
try {
	//TweenLite.to(pre_mc, .5, {y: "-100", ease:Back.easeIn});
	trace("see ya pre");
 
	var myTimer:Timer = new Timer(2500, 1);
	myTimer.addEventListener(TimerEvent.TIMER, ToolGone);
	myTimer.start();
	function ToolGone(event:TimerEvent):void {
		TweenLite.to(rotate_mc, .9, {alpha: 0, ease:Back.easeInOut});
	}
 
	var myTimer2:Timer = new Timer(2000, 1);
	myTimer2.addEventListener(TimerEvent.TIMER, GetOut);
	myTimer2.start();
	function GetOut(event:TimerEvent):void {
 
		trace("uh oh! the timer has begun");
 
		var buttons:Array =[moreInfo_btn,rotate_btn,magnify_btn];
 
		var links:Array =["HiltiCallouts.swf","Hilti-Rotation.swf","Hilti-Magnify.swf"];
 
		var hotspotY:Array =[20,40,0];
 
		var link = String(links[0]);
		var currentBtn:MovieClip;
		var previousBtn = MovieClip(buttons[0]);
		var hotspot:Loader = new Loader();
		addChild(hotspot);
 
		function initSite():void {
 
			for (var i:Number = 0; i < buttons.length; i++) {
 
				buttons[i].id = i;
				buttons[i].alpha = .2;
				buttons[i].buttonMode = true;
				buttons[i].mouseChildren = false;
				buttons[i].addEventListener(MouseEvent.MOUSE_OVER, btnOver);
 
			}
			previousBtn.mouseEnabled = false;
			previousBtn.alpha = 1;
			hotspot.y = hotspotY[0];
			hotspot.load(new URLRequest(link));
			trace("link");
			trace(link);
		}
		initSite();
		trace ("initSite");
 
		function btnOver(e:MouseEvent):void {
			e.target.alpha = 1;
			e.target.addEventListener(MouseEvent.MOUSE_OUT, btnOut);
			e.target.addEventListener(MouseEvent.CLICK, btnClick);
		}
 
		function btnOut(e:MouseEvent):void {
			e.target.alpha = .2;
		}
 
		function btnClick(e:MouseEvent):void {
			try {
				link = String(links[ e.target.id ]);
				hotspot.y = Number(hotspotY[ e.target.id ]);
				trace(link, hotspot.y);
				e.target.removeEventListener(MouseEvent.MOUSE_OUT, btnOut);
				e.target.removeEventListener(MouseEvent.CLICK, btnClick);
				currentBtn = MovieClip(buttons[ e.target.id ]);
				currentBtn.alpha = 1;
				previousBtn.alpha = .2;
				currentBtn.mouseEnabled = false;
				previousBtn.mouseEnabled = true;
				previousBtn = currentBtn;
				hotspot.load(new URLRequest(String(link)));
			} catch (error:TypeError) {
				trace("IOTypeError catch: " + error);
			} finally {
				trace("Finally!");
			}
		}
 
	}
} catch (error:TypeError) {
	trace("IOTypeError catch: " + error);
} finally {
	trace("Finally!");
}
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. 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