Press ctrl+l- to open the library window.
Press F9 to open the operation window.
Press ctrl+enter- to test the movie.
If a window appears but the relevant content is not displayed, you can press the button in the circle.
1. Suppose we make a button component and drag it from the library window to the scene. The following figure
2. Next, we will let this button respond to related actions when clicked. For example, open the homepage of the flash bar. Select the button to open the operation window. Enter (release) {
getURL(," _ blank ");
} as shown in the figure below
Take a look at the test film. Pressing the button will open the flash bar home page in a new window. Note: Here we add the code to the button. So we should select the button first and then add the action code.
Before adding code, you can look at the C position. It describes the object of the code you entered. Let's analyze the content of the code. Open (release) {
getURL("," _ blank ");
} has two keys, one is on (release) and the other is getURL, which means to open a web page.
On(release){} means that the code in {} is executed when the mouse is released. It is the so-called "mouse release event". Because the code is added to the button component, it can be regarded as clicking this button to execute the command in {}-that is, opening the home page of flash bar. In addition to releasing, you can also use pressing, flipping, scrolling and other operations in on (). Minutes means that the left mouse button is pressed on the button, the mouse points to the button and the mouse leaves the button. Of course, there are many incidents, so you can ask for help. These are several common events. These are the common ways to add actions to buttons. But from the programmer's point of view, it is not very recommended. Because the code is added to the button element, it is not easy for others to read. Nowadays, many people recommend writing all the code on the timeline. Although I'm not used to it, it's better to form such a habit as a beginner's friend. If we want to add code to the timeline, we must give the button element a name. Select the button, and we will enter the name of the button-Bt _ URL in the position of A in the figure (the name is optional, but we must abide by the naming rules and reading habits). Ok, now our button has an instance name bt_url. Let's click on the key frame of the timeline (Figure B). Open the operation window. input:Bt _ URL . onpress = function(){
getURL("," _ blank ");
}; This code uses the button event onPress. (mouse down), of course, you can also use onRelease (mouse release). It means that when bt_url (our button) is clicked, function () {...} is executed.
Of course, we can also ask for help to get more buttons and mouse events.
Button.onDragOut
Button.onDragOver
Button.onKeyDown
Button.onKeyUp
Button.onKillFocus
Button. onPress
Button. on release
Button.onReleaseOutside
Button.onRollOut
Button.onRollOver
Button.onSetFocus
There are so many, as for their physical meaning, the gang knows better than me, so I won't say much.