How to use Flash MX to make a drag-suspended window
Source: Internet
Author: User
We usually talk about the floating window that can be dragged. The author takes Flash MX as courseware making platform, which will be shared with everyone.
This method uses only one SWF file, and both the main scene and the suspension window are included in the same file. First, the suspension window is hidden, when the main scene of the button press, the suspension window display, so that the floating window can be dragged.
1. Set a good background in the home scene, make a personalized button, right-click on the button, select "Action", add the following code:
on (release) {
setProperty ("/windows", _visible, True);
}
where "SetProperty (/windows, _visible, True)" is to set the visibility of the movie instance windows, displaying the movie instance Windows when this button is pressed. (3lian material net)
2. Make a movie clip of a floating window: Insert new component/Movie clip, draw a semi-transparent box in the scene, and enter the specific content you want to display. Make a button above the box, called "Drag", and make a button on the top right, called "CloseWindow".
then right click on the Drag button, select "Action" and add the following code:
on (Drag over, Drag out)
Start Drag ("/windows")
End on
on (release, release Outside)
Stop Drag
End on
first "on ..." End on means to have instance Windows follow the mouse when the Drag button is pressed (note that do not tick "Lock Mouse to center" when you select "Start Drag"). The second "on ..." End on means stop dragging when the mouse button is released.
Right-click on the CloseWindow button, select "Action" and add the following code:
on (release) {
setProperty ("/windows", _visible, false);
}
at this point, when the CloseWindow button is pressed, let instance windows hide, that is, close the window.
3. Go back to the main scene, open the "gallery", drag the MC that you just made to the scene, and define the instance name of the MC as Windows (consistent with the instance name in the setproperty sentence). To make the window not appear at the beginning, add a layer to the home scene, right-click on the first frame, select "Action" and add the following code:
setProperty ("/windows", _visible, false);
OK, now you can test the film. Press the button in the main scene, the original hidden window is displayed. In this way, a removable suspension window is made.
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.