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

Adobe flash cs4 as3 button question

Guest
Jan 25, 2010 Jan 25, 2010

Hi,

I just wonder that how can i write this code  that means if the "specific" button is clicked(i mean if the homebutton is clicked=true) like this..

and how can i refer a button that in main stage while in an another clip's substage..

ty all

TOPICS
ActionScript
750
Translate
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
LEGEND ,
Jan 25, 2010 Jan 25, 2010

A button beiong clicked is an event, not a persistent state, so if you want to have some conditional outside of the button's normal event listening/handling code, then you would need to create such a property/variable.  So you could create a variable: var homeClicked:Boolean = false;  and when the button gets clicked, your event handler function could assign: homeClicked = true.  You could then use something like...

if(homeClicked){

     // do whatever you intend

}

To refer to an object in the parent timeline you can use: MovieClip(this.parent).objectName

Translate
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
Guest
Jan 25, 2010 Jan 25, 2010

so how can i write the code of   "when the button gets clicked" part?

and pls assume button name is "Home" so i can clearly understand. İf it is not appropiate sorry but if you can show me a full example i will really appreciate.

Translate
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
LEGEND ,
Jan 25, 2010 Jan 25, 2010
LATEST

As far as I can tell I did write all the code needed to answer your question--you could plug it in and it would work, so long as you understand what I explained.  You just need to fill in the part inside the " // do whatever you intend " part.

It is possible you mean something else which might be done differently.  So I did what I could to try to interpret your request.

Translate
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