Smart Hip-Hop power The key part of my music making

Source: Internet
Author: User
Tags implement variables relative time interval

   Smart Hip-Hop Power (MAGIC HIP-HOP FORCE) website
The key part of my Music production (MUSICROOM.FLA)

   /uploadpic/2007-7/200778121359727.swf

  source File Download

The main syntax involved:

1.loadMovie ("url", level/target[, variables])

The absolute or relative URL of the SWF file or JPEG file to be loaded by the URL. The relative path must be relative to the SWF file at level 0. The URL must be in the same subdomain as the current URL of the movie. In order to use the SWF file in Flash Player or test the SWF file in test mode of the Flash authoring application, all SWF files must be stored in the same folder, and their filename cannot contain a folder or disk drive description.

Target points to the path of the target movie clip. The target movie clip will be replaced with a loaded movie or image. You can specify only one of the level of the target movie clip or the target movie, not both.

Levels An integer that specifies the level to which the movie will be loaded in Flash Player. When you load a movie or image to a level, the Loadmovie action in the Actions panel in standard mode switches to Loadmovienum, and in expert mode you must specify Loadmovienum or select it from the Actions Toolbox.

Variables an optional parameter that specifies the HTTP method used to send the variable. The argument must be a string get or POST. If there are no variables to send, this argument is omitted. The Get method appends a variable to the end of the URL, which is used to send a small number of variables. The POST method sends a variable in a separate HTTP header, which is used to send a long variable string.

2. With (object) {statement (s);}

An instance of the object action script or movie clip.

An action or a set of actions contained in a statement (s) Curly brace

3. StartDrag (Target,[lock, left, top, Right,bottom])

Target path of the movie clip to which target will drag.

Lock A Boolean value that specifies whether the drag movie clip is locked to the center of the mouse position (true) or to the position where the user first clicks on the movie clip (false). This parameter is optional.

The values of left, top, right, and bottom relative to the movie clip's parent coordinates, which specify the constraint rectangle for the movie clip. These parameters are optional.

Causes the target movie clip to be dragged during movie playback. You can drag only one movie clip at a time. After you perform the StartDrag action, the movie clip remains dragged until it is explicitly stopped by the Stopdrag action, or until the StartDrag action is invoked for another movie clip.

First, click on the CD box pop-up menu production steps:


(Figure 1)

First of all, we have to put all the items in the room in place, such as (Figure 1)

Next, make the CD cartridge on the Chair (Figure 2) out of the menu effect


Figure (2)

To achieve the mouse click on this CD box, talk about the CD song menu.

1. First, draw the CD box. Turn it into a movie clip, just put it aside

2. Then make the CD menu, the menu processed beautifully after the same conversion to the movie clip, the instance name named "EZ2", and then leave the first frame of the movie clip as a blank frame. Place the made menu in frame 110th (why on frame 110th: This movie clip includes all of my music menu, so 110 frames were left blank to put the other menu)

3. Add action script at first blank frame

Stop ();

The frame shown in the menu also adds a stop ();

Another button is returned in this frame, and the button script is:

gotoAndPlay (1);

Return to the first frame to turn off this menu effect

Then the movie clip shows a white spot in the home scene.

4. Next we go back and edit the DEEP SOLO CD movie clip, and create a new layer in this movie clip named "Press Ashamed (Figure 3)


(Figure 3)

5. Make an orange-red pressed cow on the button layer and cover over the CD case (Figure 4)


(Figure 4)

To add an action script to a button:

On (release) {with (_ROOT.EZ2) {gotoandplay (110);}}
When the mouse clicks this button, specifies that a movie clip with the instance named "EZ2" jumps to generation 110 frame and runs

Set the Button property to "Alpha" to "0" (figure 4-1) so it's transparent and you can't see anything.


(Figure 4-1)

6. OK, one click on the CD box pop-up menu effect is done. You can try the effect.

As you can see in the original file, the CD menu pops up when you click on the CD box, and there is a small, blank window to drag (Figure 5), which is the display window when playing music. This window is also a separate movie clip that is used to load external SWF music and graphics, and here's how to make this part of loading an external SWF file


(Figure 5)

Make a movie clip that you can drag to display a window

1. First draw the appropriate size of the white square, converted into a movie clip, I named it instance name "WBBF", edit this clip. Create three layers "load movie window", "Close Window", "drag button" (Figure 6)

2. Also vacated the first frame for blank frame plus action Script stop (), second frame plus stop ();

3. The 2nd frame to make a button, put in the "drag and drop Press ashamed" layer (used to drag)

Add action Script on this button:

On (Press) {StartDrag ("_ROOT.WBBF");}
When the mouse presses the button to achieve drag and drop effect
On (dragout) {Stopdrag ();}
Stop dragging when the mouse moves away from the button

4. "Close button" layer put a Return button button script:

gotoAndPlay (1);
Go back to the first frame to get the effect off this window

5. In the "Load movie window" layer, we convert the previously painted white square to the movie clip instance name named "Dxx" (Figure 7)


(Figure 6)


(Figure 7)

5. Back to the main scene to see, this clip is also the white dots displayed, right click on the white Dot add action script:

Onclipevent (enterframe) {
if (_x>500) {
SetProperty (This, _x, "435.1");
SetProperty (This, _y, "111.1");
}
When the x-axis of this clip is greater than 500, place the clip where the x-coordinate is 453.1 and the Y coordinate is 111.1 (the original position where the window appears)
if (_x<0) {
SetProperty (This, _x, "435.1");
SetProperty (This, _y, "111.1");
}
When the x-axis of this clip is less than 0, place this clip where the x-coordinate is 453.1 and the Y coordinate is 111.1 (the original position where the window appears)
if (_y>300) {
SetProperty (This, _x, "435.1");
SetProperty (This, _y, "111.1");
}
When the y-axis of this clip is greater than 300, place the clip where the x-coordinate is 453.1 and the Y coordinate is 111.1 (the original position where the window appears)
if (_y<100) {
SetProperty (This, _x, "435.1");
SetProperty (This, _y, "111.1");
}
When the y-axis of this clip is less than 100, place the clip where the x-coordinate is 453.1 and the Y coordinate is 111.1 (the original position where the window appears)
}
Onclipevent (mouseUp) {
Stopdrag ();
}
Stop dragging when the mouse is open

The script above is to not let the display window drag out of the screen

OK, the display window is finished, the following will do the loading part pull, how to load the external SWF file to this window?

1. Edit the previous menu, the menu should be divided into three layers: "Text", "button", "Background map" three layer, the text layer is the song name of the CD, the button layer is placed below the text layer, each song under the name of the song each put a stealth button

2. Let's take the first song "Intro/0:43" as an example (Figure 8)


(Figure 8)

Add action Script to the button below this song name:

On (release) {
With (_ROOT.WBBF) {
gotoAndStop (2);
}
When the mouse clicks this button, specify a movie clip with the instance named "WBBF" (the display window that you just made)
Jump to frame 2nd and stop
Loadmovie ("music/deep/intro.swf", _root.wbbf.dxx);
Load an external file intro.swf to a movie clip with the instance named "Dxx" (White square)
}

"Music/deep/intro.swf" is the relative path of the SWF file to load.

"_root." The meaning of the top of the global.

"Intro.swf" is a well prepared SWF file

3. The rest of the song to load the words on the above method can be, as long as each button script to modify the loading path can be.

This is where the CD part has been completed. If you want to increase the CD, follow the steps above can do a few more CDs, hehe.

Two. WINDOWS Simulation section:

In addition, when you click on the computer on the table switch will open the screen, and then click on the screen again will enter the Windows simulation animation (Figure 9)


(Figure 9)

In fact, this is not difficult to do, the computer on the table is a film clip, placed in its interior, such as two frames. The first frame is the screen when the computer closes, the 2nd frame is the screen when the computer is opened and a button is added to the open computer screen to turn on the animation that simulates windows. The movie clip instance of Windows animation in the original file is named "WinXP"

This part of the main key part is the implementation of double click Open Folder, then how to implement the mouse double-click open folder it?

Here's how to use ActionScript to implement

The basic principle is this, when the mouse is pressed, record the time, the mouse again press the time, and then record the time, compared to two times the mouse time interval, if the interval is longer, the decision is two clicks, a short interval between the decision to double-click, triggering events

Take a folder in the original file as an example (Figure 10)


(Figure 10)

Implementation effect: When the mouse is moved to a folder and can be dragged, when you double-click the folder to enter the animation page inside this folder

First click on the 2nd frame of the main scene to add the mouse double-click check code (Figure 11):


Mouse.doubleclick=function (clicktime) {
if (!clicktime) {clicktime = 270;}
if (mouse.lastclicktime-(Mouse.lastclicktime=gettimer ()) +clicktime>0) {
return true;
}
};

Description: Clicktime is the time difference between the first click and the second click

When calling the DoubleClick () method, you can set the double-click time through the parameter clicktime, where the value is set to

270, the default setting is 500, which is 500/1000s=0.5s.

Mouse.lastclicktime is the first time to click

Mouse.lastclicktime=gettime () is the second time of click

Two-phase subtraction, plus clicktime. Double-click If the result is greater than 0, and return the information that the double-click is True

This checks the mouse to double-click the code is complete.

The next step is to add code to the folder so that the results are achieved.

Right-click the folder movie and add the action code:

Onclipevent (MouseDown) {
if (This.hittest (_root:_xmouse,_root:_ymouse,true)) {
if (Mouse.doubleclick ()) {
With (_ROOT.WINXP) {
gotoAndStop (5);
}
} else {
if (This.hittest (_root:_xmouse, _root:_ymouse)) {
SetProperty (This, _alpha, "50");
StartDrag (this);
}
}
}
}
Onclipevent (mouseUp) {
SetProperty (this, _alpha, 100);
Stopdrag ();
}

Description: When the mouse is pressed (mouseDown) if this movie clip (this), touches the mouse's x and y coordinates

(_root._xmouse,_root._ymouse) If you check for a mouse double-click (if (mouse DoubleClick ()), the movie clip that specifies the instance named "WinXP" jumps to frame 5th and stops (frame 5th is the animated page inside the secondary folder)

If the mouse does not double-click (else), if this movie clip (this) touches the mouse's x-coordinate and y-coordinate, the Set folder's properties are Semitransparent (SetProperty (this, alpha, ";)"

The _alpha value of 0 is completely transparent, and a value of 100 is a normal state

Trigger Drag (StartDrag (this);)

When the mouse is open (mouseUp)

Set the folder properties to Normal (SetProperty (this, alpha, ";)")

Stop dragging (Stopdrag ();)

ok! " My Music Room "part of all the key places have been completed, the other places the effect is similar to the above said, do yourself a try!"



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.