• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Actionscript 3 Class Not Running More Than Once After Using The GoToAndStop function

New Here ,
Sep 04, 2014 Sep 04, 2014

Copy link to clipboard

Copied

I'm having a strange issue, and I am sure it's due to my lack of knowledge about how classes fully work in Adobe AIR (Flash CC). I've created a login button that is connected to a function, and based on a set of conditions it will take you to a different frame with the GoToAndStop function. I've created a logout button that is suppose to take you "back" to the login frame (that has the login button) if you click the logout button using the GoToAndStop function. Up to this point, everything works until I try to click the Login button again, it does not do anything. It's like it does not even try to execute my class file anymore.

Does the class file only run at startup and never runs again, and if so, how can I create a section of code that is constantly monitoring what the user is doing no matter what frame you are on and no matter if I use the GoToAndStop function or not?

Thanks

TOPICS
Development

Views

283

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2014 Sep 04, 2014

Copy link to clipboard

Copied

Hi there, try using gotoAndPlay to get to the frame, and the first line you have in the actionscript of that frame would be stop().

Here is another guess, without seeing your code, is that you are using a Boolean variable for the login button that is initially set to true...then when you go to other frame (logout frame), that login button Boolean variable has not been reset back to true to allow you to use the login button once again.

Justin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 04, 2014 Sep 04, 2014

Copy link to clipboard

Copied

If your second guess is correct, how would I reset a button?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2014 Sep 04, 2014

Copy link to clipboard

Copied

LATEST

Based on your qyestion, I think I was wrong with my second guess.

When I want to create a button, what I do is draw a bitmap that looks like a button and then use a mouse event listener that looks for any part of the stage that is clicked.  You would use the same code for touch as well.  As3 will return the x.y. coordinate of the area that was clicked or touched.  When the xy coordinate is known, if it corrseponds to the area where the button is, I code the appropriate response.  Hence, I only use one event listener for all my buttons, as long as thet involve simple clicks or taps of the screen.

Good luck, Justin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines