Action script 3.0 output error please help flash pro
So, I am creating a type effect animation in flash and my code for the first frame in my time line is;
- var i=0;
- var myString:String = "Name: Earth\nDiameter: 12,756 km"
- var mytimer:Timer = new Timer(200,myString.length);
- mytimer.addEventListener(TimerEvent.TIMER, timerHandler);
- mytimer.start();
- function timerHandler(event:TimerEvent):void{
- mytext.appendText (myString.charAt(i));
- i++;
- if (i==myString.length && currentFrame == 1){ gotoAndStop(10)}
- }
My second code on the next frame is essentailly the same thing but becuase i cannot place a var again I have taken them out and put code that refs the first code;
- i=0;
- mytext.text = ""; // empty the textfield
- myString = "Name: Neptune\nDiameter: 49,532 km";
- mytimer.repeatCount = myString.length;
- mytimer.reset();
- mytimer.start();
My animation still works correctly as I wanted however if i then place the above code on another frame at time line i receive an output error code refusing it to show the third frame;
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Animation_fla::MainTimeline/timerHandler()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
What does this mean can someone explain it to me please and how I would fix ti?
Thanks
