Adobe flash cs4 as3 button question

Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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

Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.

