tailieunhanh - Building Continuous-Feedback Buttons

Xây dựng liên tục-Thông tin phản hồi Buttons Đó là đôi khi hữu ích để có hành động thực hiện liên tục trong khi đang được một nút bấm. Một nút thiết lập để cho phép thực hiện liên tục được biết đến như là một thông tin phản hồi liên tục nút-và một nút di chuyển (trọng tâm của tập thể dục này) là một ví dụ hoàn hảo. | Building Continuous-Feedback Buttons It s sometimes useful to have actions executed continually while a button is being clicked. A button set up to enable continuous execution is known as a continuous-feedback button and a scroll button the focus of this exercise is a perfect example. If you wanted to scroll through a list of information in a window you would quickly become frustrated if you had to click a button every time you wanted to make the information scroll up or down. Far less frustrating is a button that needs to be clicked just once to scroll continuously until the button is released. In Flash you can create this type of functionality by using the onEnterFrame clip event with a button as we ll soon demonstrate. In this exercise you ll add scrolling buttons to the list you built in the previous exercises. 1. Open . In this exercise you ll add ActionScript to Frame 1 of the Actions layer in the main timeline to the scroll buttons themselves and to the clips that contain the scroll buttons. You ll build the function that performs the actual scrolling then you ll add the commands to the required areas so that the function is called. Remember that there s a movie clip instance called list_mc inside the display_mc clip. All the attached infoBar movie clip instances that we create will exist inside the list_mc instance. We ll set up our scrolling function to move the list_mc movie clip instance up and down to achieve the effect of scrolling through the list of items. NOTE When we use the term scrolling in this exercise we re talking about increasing or decreasing the _y property value of the list_mc movie clip instance to move it up or down onscreen. 2. With the Actions panel open select Frame 1 of the Actions layer and then add the following line of script just below the line that creates the list array 3. 4. var startingY Number 5. With scrolling you must establish maximum and minimum vertical locations y to which the .