Link to home
Create AccountLog in
Scripting Languages

Scripting Languages

--

Questions

--

Followers

Top Experts

Avatar of egiaccio
egiaccio

Button inside movie clip to control main movie timeline
I have about 5 buttons within a movie clip. I would like for when one of these buttons to be clicked, for it to control the main timeline by going to a specific scene and frame label.

Thank you.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of Antonio EstradaAntonio Estrada🇲🇽

myButton.onRelease = function() {
   gotoAndStop("sceneName","labelName");
}

-V

Avatar of egiaccioegiaccio

ASKER

Do I put this on the button that is in the movie clip or in the main timeline or in the movie clip timeline?

Avatar of Antonio EstradaAntonio Estrada🇲🇽

If you have given the buttons instance names (on the properties panel) then it should go in the MovieClip timeline.

If you didn't give them instance names, you can use this code instead (which would go in the button).

on(release) {
  gotoAndStop("sceneName","labelName");
}

-V

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


This doesn't work --- I would like the buttons to control the MAIN timeline, not the timeline within the movieclip. any thoughts?

Avatar of Antonio EstradaAntonio Estrada🇲🇽

Try

on(release) {
  _root.gotoAndStop("sceneName","labelName");
}

or

myButton.onRelease = function() {
   _root.gotoAndStop("sceneName","labelName");
}

Dunno which one you're using.

-V

for some reason this is not working?

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


I tried it both on the button and in the movie clip timeline and when the button is clicked, it does not move the Main movie timeline to where it is suppose to go

Avatar of Antonio EstradaAntonio Estrada🇲🇽

That's curious.

Can you post you *.fla?

-V

I've uploaded the file : oceanp2.fla to:
eringraphics.com/oceanp2.fla

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


ASKER CERTIFIED SOLUTION
Avatar of Antonio EstradaAntonio Estrada🇲🇽

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

If you want your code to be on the main time line you should be writing the movieClipname.buttonname.onRelease

All the below will work...

myMovieClip.myButton.onRelease = function()
 {
   _root.gotoAndStop("sceneName","labelName");
}
or
myMovieClip.myButton.onRelease = function()
 {
   _root.gotoAndStop("labelName");
}
or
myMovieClip.myButton.onRelease = function()
 {
   _root.gotoAndStop("sceneName","frameNumber");
}


Regards,
John
Scripting Languages

Scripting Languages

--

Questions

--

Followers

Top Experts

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.