Accessing instances on second frame

Hi,

I can’t seem to access instances in a movie clip that aren’t on the first frame of a parent movie clip even if I tell flash to go to that frame before I attempt to reference the instance in the actionscript.

Actually this works in flash player 10 but not 9. I could just export for flash player 10 but I would rather know the answer than just avoid it and of course for better compatibility reasons.

I’ve attached an fla example with source code to show the problem. I’m using CS4 and programming in classes in as3 as you will be able to see from the example.

Any help from anyone who knows how to do this properly would be greatly appreciated.

Thanks.

P.S: the example is saved in CS3 so more people can open it.

Here’s the code:

package src
{
	import flash.display.MovieClip;
	import flash.events.*;
	
	public class Main extends MovieClip
	{
		public function Main()
		{
			//Setting the beggining state
			movieClipHolder.gotoAndStop(1);
			
			//The event Listeners
			button.addEventListener(MouseEvent.CLICK, playAnimation);
			addEventListener(Event.ENTER_FRAME, checkAnimation);
		}
		
		private function playAnimation(e:Event)
		{
			movieClipHolder.gotoAndStop(2);
		}

		private function checkAnimation(e:Event)
		{
			if(movieClipHolder.currentFrame == 2)
			{
				if(movieClipHolder.animation.currentFrame == movieClipHolder.animation.totalFrames)
				{
					movieClipHolder.gotoAndStop(1);
				}
			}
		}
	}
}