Obtain external button method [AS2.0]

Source: Internet
Author: User

Because the event of the button element does not stop except the pop-up, you need to make the component yourself. Then, you need to determine if you have clicked on yourself. -- That's simple
Production process:
1. Draw a shape image you like as a button in the scenario. Select this image and press F8 to convert it into a video clip component. Insert a key frame at 2nd, and change the color (or shape ). Create a layer. Stop () at 1-2 times ()
2. Right-click the component in the library and select "link". A link name is displayed after the identifier. Here, "FANG" is selected"
3. Return to the main scenario. Write code in the first frame:

Var zt: Number;
For (I = 0; I <7; I ++ ){
_ Root. attachMovie ("fang", "fang" + I, I );
_ Root ["fang" + I]. _ x = 55 + I * 45;
_ Root ["fang" + I]. _ y = Stage. height/2;
_ Root ["fang" + I]. sz = I;
_ Root ["fang" + I]. onPress = function (){
H = 0;
Zt = this. sz;
};
_ Root ["fang" + I]. onMouseDown = function (){
This. onEnterFrame = function (){
Trace (this. onEnterFrame );
If (this. sz = zt ){
This. gotoAndStop (2 );
} Else {
This. gotoAndStop (1 );
                        }
};
};
_ Root ["fang" + I]. onMouseUp = function (){
Delete this. onEnterFrame;
Trace (this. onEnterFrame );
};
}

-----------------------------------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.