Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

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
Avatar of blue-genie
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answers