I can't get this ActionScript 3.0 for a Play Button to work in Flash CS4.?

Vaati

New member
When I try to play my movie I get this message:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at bdaypresent_fla::MainTimeline/frame2()
at flash.display::MovieClip/gotoAndStop()
at bdaypresent_fla::MainTimeline/loaderF()

(bdaypresent is the name of the file).

I used this ActionScript for the Preloader/Loading Bar which happens before the Play Button appears:

stop();

addEventListener(Event.ENTER_FRAME, loaderF);

function loaderF(e:Event):void{
var toLoad:Number = loaderInfo.bytesTotal;
var loaded:Number = loaderInfo.bytesLoaded;
var total:Number = loaded/toLoad;
if(loaded == toLoad){
removeEventListener(Event.ENTER_FRAME, loaderF);
gotoAndStop(2);
} else {
preloader_mc.preloaderFill_mc.scaleX = total;
}
}

And this ActionScript for the Play Button:

stop()
Butn.addEventListener(MouseEvent.CLICK,mouseClick);
function mouseClick(event:MouseEvent):void {
gotoAndPlay(3);
}

Thanks, If you need any more information just say so.
 
Back
Top