Skip to main content
June 12, 2010
Question

button must be clicked twice why?

  • June 12, 2010
  • 1 reply
  • 339 views

im working on a new project, and its finished - but there is one issue....

to travel to the next page, you must click the button 2 times ( even if the clicks are 30 seconds apart )....what would cause this?

the method we were asked to do was to base the page transition on the timeline rather than embeded in its own MC like previously.

that is easy, and here is my set up ( frame and actions 😞

Frame 124  // var page;

                    page = 1;

Frame 125 // stop();

               there is an MC on this line called "engage", it plays through a little bit and then in the middle of its timeline it says MovieClip(root).gotoAndPlay("unload");

stop();

unload is the frame label on frame 126, and the code on frame 126 is ( recycled, but i was allowed to do this )

if(bgloader){

   bgloader.unload();

}

on frame 131 there is this code:

var Xpos:Number=0;

var Ypos:Number=0;

var swf:MovieClip;

var bgloader:Loader = new Loader();

var bgURL

if(page==1){

bgURL=new URLRequest("pages/home.swf");

}

else if(page==2){

bgURL=new URLRequest("pages/about.swf");

}

else if(page==3){

bgURL=new URLRequest("pages/projects.swf");

}

else if(page==4){

bgURL=new URLRequest("pages/experimental.swf");

}

else if(page==5){

bgURL=new URLRequest("pages/contact.swf");

}

bgloader.load(bgURL);

bgloader.x=Xpos;

bgloader.y=Ypos;

bg.addChild(bgloader);

stop();

bgloader.contentLoaderInfo.addEventListener(Event.COMPLETE,  loaderCompleteHandler);

function loaderCompleteHandler(event:Event) {

    (event.currentTarget.content as MovieClip).addEventListener("eventTriggered", eventHandler);

}

function eventHandler(event:Event):void {

    gotoAndPlay("start");

}

and on frame 132 is the frame label "start" and this code:
engage.play();
the buttons are in their own MC on frame 125 and are coded correctly ( here is an example of btn 1 😞
function btn1Click(event:MouseEvent):void{
MovieClip(root).gotoAndPlay("trans");
MovieClip(root).page=1;
}
btn1.addEventListener(MouseEvent.CLICK, btn1Click);
btns 2, 3 and so on are written the same....
now, i get no errors, but you must click each button twice ( and if its in the middle of the transition sometimes 3 times ).....i am not sure why....it looks solid to me......
anyone ever have this prob?
This topic has been closed for replies.

1 reply

June 12, 2010

figured it out....it was becuase the layer that had the MC engage on it had keyframes all the way to the end of the timeline.....