what's being output is correct. you must remember that the onProgress method will keep triggering until it's finished, hence those traces will be repeated until the loading process is complete.
cubical38
ASKER
That what I was thinking, but I am getting an error. Below is the code that I have to load in 3 different swfs, yet on the third click I receive the always unpopular TypeError: Error #1009: Cannot access a property or method of a null object reference at Hilti_fla::MainTimeline/onProgress()
Each swf has a preloader, but it is the same code as above for each...
Maybe you can see something I am overlooking...
Thanks...
var myTimer:Timer = new Timer(2000, 1);myTimer.addEventListener(TimerEvent.TIMER, GetOut);myTimer.start();function GetOut(event:TimerEvent):void { TweenLite.to(rotate_mc, .9, {alpha: 0, ease:Back.easeInOut}); 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(); 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 { 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))); }}
I know its kind of tricky to explain as everything is working fine I just keep getting this error in my output window:
#1009: Cannot access a property or method of a null object reference at Hilti_fla::MainTimeline/onProgress()
the code at the top of the page is my preloader, which is on frame 1...
the next snippet of code is my array for loading in the 3 swfs, which also has some button functionality, which also all works.
once i test the movie everything loads fine, i click the first button and load in another swf, which works fine.
Now when I try and click on another button, everything fires as it should yet within my out put I receive the above mentioned error...
I have traced every function in the piece but all are firing at the correct time and local...
This may just be a bug with the classes I am using... I wish AS3 had better debugging capabilities...
If this still makes little sense as it does to me, no worries, the piece works, so... I just hate output errors especially this one...
Thanks for taking a look...
blue-genie
okay its a tad difficult for me to try stuff without being able to replicate it. but why are you removing your mouselistener everytime you call btnClick?
that might be a problem.
a cheat i implement - whoever is throwing the null reference error i always just put in a check that if its not null then do whatever - that prevents the runtime error message.
cubical38
ASKER
Do you mean trace the error, when you say "check"?