My original code enables me to play another frame once the user has clicked on the object-as seen in the code;

stop();
btn1.addEventListener 
	(MouseEvent.CLICK, onClick); 

function onClick
( event:MouseEvent):void 

{
gotoAndPlay("8") 
}

However, when i replace gotoAndPlay with 'gotoAndStop' it doesnt work?

Recommended Answers

All 2 Replies

My original code enables me to play another frame once the user has clicked on the object-as seen in the code;

stop();
btn1.addEventListener 
	(MouseEvent.CLICK, onClick); 

function onClick
( event:MouseEvent):void 

{
gotoAndPlay("8") 
}

However, when i replace gotoAndPlay with 'gotoAndStop' it doesnt work?

Do you have a call to play() in the actionscript in the timeline on frame 8 of your clip? (click on frame 8 and look in the actionscript window)
That is the most likely cause of this problem......

Changing the gotoAndPlay in the code you posted to a gotoAndStop should cause your clip to go to frame 8 and stop.
But an explicit call to play() in the AS on the timeline of your clip at frame 8 would cause playback to continue..

Remove any call to Play() from the AS for frame 8. Don't replace it with a stop() as that would cause any gotoAndPlay(8) calls to fail....

Give that a go and let me know how you get on.

Cheers for now,
Jas.

I must say your very helpful and i really appreciate your response to my problem m8. But very silly of me, i made a simple mistake. What happen was i was playing frame 8 which i thought was the last frame but was actually playing the frame that i was currently on. Therefore it appear not to change when i clicked the button since it was playing the same frame i was on .
so thanks anyway m8.

But i counted wrongly for a reason, this is because in the preview it doesnt play the first frame, so i believed that all the other frames became a previous frame.(just so you think im not retarded hehe).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.