6 Replies - 1442 Views - Last Post: 20 May 2011 - 11:57 AM

#1 signedoutz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 11-January 09

Problem with Movie Clip control - [AS3]

Posted 19 May 2011 - 05:14 PM

I'm having a problem at the moment with a flash button, I'm trying to make a button which when pressed will change the current frame of a movieclip on the stage.

to try and explain a bit better,

there's a movieclip on the stage which 10 frames in, and there's a button on the stage, when the button is pressed i want the movieclip to change to the second frame.

here's the code I've got at the moment

stop();

import flash.events.MouseEvent;
home_button.addEventListener(MouseEvent.MOUSE_DOWN, homeclick);
challenge_button.addEventListener(MouseEvent.MOUSE_DOWN,challengeclick);


function homeclick (event:MouseEvent) {
	gotoAndPlay("1");
}

function challengeclick (event:MouseEvent) {
	gotoAndPlay ("2");
}


Anyway, if anyone knows how to solve this problem, please help,

Thanks,
Arthur

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with Movie Clip control - [AS3]

#2 eddiehm  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 76
  • Joined: 09-March 10

Re: Problem with Movie Clip control - [AS3]

Posted 19 May 2011 - 05:24 PM

What type of error are you getting?
Was This Post Helpful? 1
  • +
  • -

#3 signedoutz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 11-January 09

Re: Problem with Movie Clip control - [AS3]

Posted 19 May 2011 - 05:26 PM

Its not an error as such, I dont think I explained it well enough, reading it back now it doesn't make alot of sense to me

the button is inside a movieclip, and when I click it it starts the movieclip with the button in again, I want it to control another movieclip on the stage
Was This Post Helpful? 0
  • +
  • -

#4 eddiehm  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 76
  • Joined: 09-March 10

Re: Problem with Movie Clip control - [AS3]

Posted 19 May 2011 - 05:35 PM

If you are not using frame labels you will want to remove the quotes from gotoAndPlay so it should be

gotoAndPlay(2);



rather then

gotoAndPlay("2");


Was This Post Helpful? 1
  • +
  • -

#5 signedoutz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 11-January 09

Re: Problem with Movie Clip control - [AS3]

Posted 19 May 2011 - 05:42 PM

still having the same problem,

do I need something like this maybe?:

gotoandplay:(movieclip1)(1);
Was This Post Helpful? 0
  • +
  • -

#6 eddiehm  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 76
  • Joined: 09-March 10

Re: Problem with Movie Clip control - [AS3]

Posted 19 May 2011 - 06:29 PM

sorry about that I forgot something what you are going to need will be
MovieClip(parent).gotoAndPlay(2);



basically what is happening is your not getting out of the MovieClip you are in so you need to go out to its parent and then go to the frame you want.
Was This Post Helpful? 0
  • +
  • -

#7 chinchang  Icon User is offline

  • Indie Game Developer
  • member icon

Reputation: 192
  • View blog
  • Posts: 725
  • Joined: 22-December 08

Re: Problem with Movie Clip control - [AS3]

Posted 20 May 2011 - 11:57 AM

View Postsignedoutz, on 20 May 2011 - 06:12 AM, said:

still having the same problem,

do I need something like this maybe?:

gotoandplay:(movieclip1)(1);


I guess you have a separate movieclip that you want to control with the button.
Suppose your movieclip is called movieclip1, then you need to write :


movieclip1.gotoAndPlay(1);

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1