Flash imitates the interaction of desktop icons

Source: Internet
Author: User

The demo file is as follows:


Click here to download the source file

FLASH version: flash mx 2004.
Player version: 7
Actionscript: 1
Procedure:
NO.1
Create two images."Unselected icons", The other is"Selected icon"(This example uses the PHOTOSHOP icon and creates a PNG image)

No. 2
Open FLASH and create a blank document. The document contains a layer by default. We will create a new layer and name the layer above it"Unselected icon", The layer that is located below is named"Selected icons"
No. 3
Import the created image in layer "unselected icon""Unselected icons"Image, convert it to a MovieClip, and name its instance nameUnselected
No. 4
Import the created image in the "selected icon" of the layer."Selected icon"Image, convert it to a MovieClip, and name its instance nameSelected
No. 5
Current status on the screen

No. 6
Enter the script section below
Select a video clip"Unselected icon"Press F9 to enter the action panel and write the following code:

OnClipEvent (load ){
_ Root. unselected. _ visible = 0;
// When a video clip is loaded, the selected icon is hidden.
}
OnClipEvent (mouseDown ){
If (this. hitTest (_ root. _ xmouse, _ root. _ ymouse, true )){
_ Root. unselected. _ visible = 1;
_ Root. unselected. _ x = this. _ x;
_ Root. unselected. _ y = this. _ y;
This. _ visible = 0;
// If you click within the video editing range, the selected icon is displayed. After the selected icon matches the coordinates of the video editing, the video editing is hidden.
} Else {
This. _ visible = 1;
This. _ x = _ root. unselected. _ x;
This. _ y = _ root. unselected. _ y;
_ Root. unselected. _ visible = 0;
// If you click outside the video editing range, the video editing is displayed, and the coordinates overlap with the selected icon. The selected icon is hidden.
}
}

No. 7
Select a video clip"Selected icons ",Press F9 to enter the action panel and write the following code:

OnClipEvent (mouseDown ){
If (_ root. selected. _ visible = 0 ){
StartDrag ("");
// When you press the mouse, if the unselected icon is hidden, start dragging
}
}
OnClipEvent (mouseUp ){
StopDrag ();
_ Root. selected. _ x = this. _ x;
_ Root. selected. _ y = this. _ y;
// When the mouse is released, stop dragging and make the unselected icon coincide with the clip coordinate of the video.
}

No. 8
Finally, in the home scene, the coordinates of the selected icons and the two video clips that are not selected are combined to complete the production.
CTRL + ENTER to test the video
There are other more convenient methods to achieve this effect. You are welcome to post it.

OnClipEvent (mouseDown ){
If (_ root. selected. _ visible = 0 ){
StartDrag ("");
// When you press the mouse, if the unselected icon is hidden, start dragging
}
}
OnClipEvent (mouseUp ){
StopDrag ();
_ Root. selected. _ x = this. _ x;
_ Root. selected. _ y = this. _ y;
// When the mouse is released, stop dragging and make the unselected icon coincide with the clip coordinate of the video.
}

No. 8
Finally, in the home scene, the coordinates of the selected icons and the two video clips that are not selected are combined to complete the production.
CTRL + ENTER to test the video
There are other more convenient methods to achieve this effect. You are welcome to post it.

OnClipEvent (load ){
_ Root. unselected. _ visible = 0;
// When a video clip is loaded, the selected icon is hidden.
}
OnClipEvent (mouseDown ){
If (this. hitTest (_ root. _ xmouse, _ root. _ ymouse, true )){
_ Root. unselected. _ visible = 1;
_ Root. unselected. _ x = this. _ x;
_ Root. unselected. _ y = this. _ y;
This. _ visible = 0;
// If you click within the video editing range, the selected icon is displayed. After the selected icon matches the coordinates of the video editing, the video editing is hidden.
} Else {
This. _ visible = 1;
This. _ x = _ root. unselected. _ x;
This. _ y = _ root. unselected. _ y;
_ Root. unselected. _ visible = 0;
// If you click outside the video editing range, the video editing is displayed, and the coordinates overlap with the selected icon. The selected icon is hidden.
}
}

No. 7
Select a video clip"Selected icons ",Press F9 to enter the action panel and write the following code:

OnClipEvent (mouseDown ){
If (_ root. selected. _ visible = 0 ){
StartDrag ("");
// When you press the mouse, if the unselected icon is hidden, start dragging
}
}
OnClipEvent (mouseUp ){
StopDrag ();
_ Root. selected. _ x = this. _ x;
_ Root. selected. _ y = this. _ y;
// When the mouse is released, stop dragging and make the unselected icon coincide with the clip coordinate of the video.
}

No. 8
Finally, in the home scene, the coordinates of the selected icons and the two video clips that are not selected are combined to complete the production.
CTRL + ENTER to test the video
There are other more convenient methods to achieve this effect. You are welcome to post it.

OnClipEvent (mouseDown ){
If (_ root. selected. _ visible = 0 ){
StartDrag ("");
// When you press the mouse, if the unselected icon is hidden, start dragging
}
}
OnClipEvent (mouseUp ){
StopDrag ();
_ Root. selected. _ x = this. _ x;
_ Root. selected. _ y = this. _ y;
// When the mouse is released, stop dragging and make the unselected icon coincide with the clip coordinate of the video.
}

No. 8
Finally, in the home scene, the coordinates of the selected icons and the two video clips that are not selected are combined to complete the production.
CTRL + ENTER to test the video
There are other more convenient methods to achieve this effect. You are welcome to post it.

OnClipEvent (load ){
_ Root. unselected. _ visible = 0;
// When a video clip is loaded, the selected icon is hidden.
}
OnClipEvent (mouseDown ){
If (this. hitTest (_ root. _ xmouse, _ root. _ ymouse, true )){
_ Root. unselected. _ visible = 1;
_ Root. unselected. _ x = this. _ x;
_ Root. unselected. _ y = this. _ y;
This. _ visible = 0;
// If you click within the video editing range, the selected icon is displayed. After the selected icon matches the coordinates of the video editing, the video editing is hidden.
} Else {
This. _ visible = 1;
This. _ x = _ root. unselected. _ x;
This. _ y = _ root. unselected. _ y;
_ Root. unselected. _ visible = 0;
// If you click outside the video editing range, the video editing is displayed, and the coordinates overlap with the selected icon. The selected icon is hidden.
}
}

No. 7
Select a video clip"Selected icons ",Press F9 to enter the action panel and write the following code:

OnClipEvent (mouseDown ){
If (_ root. selected. _ visible = 0 ){
StartDrag ("");
// When you press the mouse, if the unselected icon is hidden, start dragging
}
}
OnClipEvent (mouseUp ){
StopDrag ();
_ Root. selected. _ x = this. _ x;
_ Root. selected. _ y = this. _ y;
// When the mouse is released, stop dragging and make the unselected icon coincide with the clip coordinate of the video.
}

No. 8
Finally, in the home scene, the coordinates of the selected icons and the two video clips that are not selected are combined to complete the production.
CTRL + ENTER to test the video
There are other more convenient methods to achieve this effect. You are welcome to post it.

OnClipEvent (mouseDown ){
If (_ root. selected. _ visible = 0 ){
StartDrag ("");
// When you press the mouse, if the unselected icon is hidden, start dragging
}
}
OnClipEvent (mouseUp ){
StopDrag ();
_ Root. selected. _ x = this. _ x;
_ Root. selected. _ y = this. _ y;
// When the mouse is released, stop dragging and make the unselected icon coincide with the clip coordinate of the video.
}

No. 8
Finally, in the home scene, the coordinates of the selected icons and the two video clips that are not selected are combined to complete the production.
CTRL + ENTER to test the video
There are other more convenient methods to achieve this effect. You are welcome to post it.

OnClipEvent (mouseDown ){
If (_ root. selected. _ visible = 0 ){
StartDrag ("");
// When you press the mouse, if the unselected icon is hidden, start dragging
}
}
OnClipEvent (mouseUp ){
StopDrag ();
_ Root. selected. _ x = this. _ x;
_ Root. selected. _ y = this. _ y;
// When the mouse is released, stop dragging and make the unselected icon coincide with the clip coordinate of the video.
}

No. 8
Finally, in the home scene, the coordinates of the selected icons and the two video clips that are not selected are combined to complete the production.
CTRL + ENTER to test the video
There are other more convenient methods to achieve this effect. You are welcome to post it.

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.