FLASHMX Tutorial-load Movie

Source: Internet
Author: User
Tags empty
The tutorial, translated from ActionScript, focuses on the fact that when you click on the menu button, load a small movieclip with the load movie to let the user know that the program is running. The original text of this tutorial is explained in Flash 5.0 as an example, The Semitic empire adapted it to flash MX ...

This is my translation from the ActionScript article, now take out to share with you, the wrong place please point out, loadmovie question many people ask, do the site is often used, so I chose such an article to translate (but the focus of this tutorial is, Some of the Flash site button in the click will occur stagnation, although rare, but also happened, this tutorial in the middle of a initializing SWF, very interesting and practical), the shortcomings of the master guidance

Since the original tutorial did not provide the original file, here is a point I do this download

When I started building a flash site and animated the different menus, I noticed that occasionally (but not always) there would be a bit of stagnation when clicking on a menu button, even with a preload program that sometimes still exists, I personally think that this stagnation (perhaps because of the Internet connection) will lead to our viewers, and even our customers have the question: "What's wrong with this site?" I clicked on the button, but nothing happened?! "However, if they can wait long enough, some changes may occur, and the movie that the menu button is connected to will appear sooner or later, won't it?" But we can't rely on customers to wait, and we have no reason to let them do it! So, I conceived a "initializing fragment", a small movieclip will appear in front of the viewer, regardless of any stagnation. In this way, the audience can know that there are programs running. This is not the original intention of the author, and I certainly have countless ways to solve this problem, but this is at least a relatively simple and effective way.

1, first, create the main scene movie Main, this is the basic scene, all the other fragments will be loaded into the top of the main scene, the selection of background color will determine the background of the rest of the fragment. Of course you can put anything you want to put in this video, logos or other pictures, but now, just a few words to go up.

2, Next, create a second layer on the main movie, right-click on the first frame, and choose Open the Action panel from the Drop-down menu. Click Browser/network, then double-click Load Movie, enter "interface.swf" in the URL bar, enter 3 in the level, code as follows:

Loadmovienum ("interface.swf", 3);

  
Code explanation: You are asking Flash to upload a movie named interface at a depth of 3 (we'll make it in the next few steps), which will be the SWF fragment we made here at the highest level of depth.

3, now, Define and create a new one with a size of the same size. fla file, named Interface.fla, we will load it into the main.swf at the highest level of depth so that it can be at the top of the final movie's main scene, and will always be present in front of the viewer (for the navigation bar). First, create an image panel (like a console?). Make it at the top of the movie, and if you want, you can type the word "Interface" on it and give it a different color than the main scene.

  
4, create a new layer in the INTERFACE.FLA and name it "actions", right-click on the first frame to open the Action panel, click Browser/network, and then double-click Load Movie to enter the URL bar. Initializingmovie.swf ", the depth is 2, the code is as follows:

Loadmovienum ("initializingmovie.swf", 2);

Code explanation: Upload a movie named Initializingmovie at a depth of 2 level (we'll make it next).

5, create a simple button on the current layer, in this step, we just need to create the simplest button, named "One"; (Of course, when you create your own page, you'll set up many menu buttons in your navigation bar) put this button on the interface panel.

6, right click on the button to open the Action panel, in movie control double-click ' on ', enter the following code:

On (release) {  _root._level2.gotoandplay (2);} On (release) {   loadmovienum ("movieone.swf", 1);}

Code explanation: When the user clicks the button (whichever movie fragment is in Level2), it will run from the second frame. Just as you would see in the following steps, the first frame of the load movie (initializing Movie-next creation) is an empty frame, so by ordering it to play the second frame, we can produce and make it visible, remember that it has been interface Movie loaded ...

7, now we should create the loaded movie, create the third. fla file with the same size, and save it as "Initializingmovie" (note no spaces). Create three layers with two keyframes per layer. Two of these layers are used to place your image elements. At the bottom, empty out the first keyframe, create a simple image in the second frame; in the middle tier, also empty the first frame regardless of it, create the text "initializing" in the second frame, and if you want, you can make it change; Top (third), join in two keyframes

Stop ();

8, now create a new. fla file of the same size, which is your menu and content movie, saved as "Movieone". Of course, the actual page will contain some exciting images and a pleasing interface for the viewer, but this is just an exercise, just put in some pictures and text, which allows you to see their effects immediately in the preview.

9, the most important step is to give the key action to let the initializing movie "Go Away and disappear", so enter the following code as the first frame of action in the new layer: The most important step is to give the key action to get the initializing movie " Go away and disappear. "Therefore, enter the following code as the first frame of action in the new layer:

Root._level2.gotoandplay (1);

When "Movie One" starts playing, the code above triggers, telling the initializing Movie-level 2 's only movie to go back to the first frame, because the first frame of initializing is blank, so it becomes invisible! (In the example, there is an extra scene in the Movieone, which only works to simulate network latency and does not need to exist in your formal assignments!) If there is no delay in the real environment, then the loading of the movie will disappear as soon as the content movie appears. But if there is no content, then your excellent loading video will make the viewer confident that the background is running.

10, now publish your. swf file and test your results, and if there are any mistakes, verify your. fla filename and the spelling of the grammar in action scripts is correct, if there is a point where there is a mistake, or the space should not appear, Then the entire program will not run properly. Also confirm that all files are in a directory or folder.

11, don't forget that your loading video can do anything you want it to do, flashing, dancing, spinning, or even being dragged. But don't make it too big, because it's going to be loaded and displayed right away.

[Flash Empire Note: This tutorial is based on Flash 5.0 as an example, the Semitic Empire adapted it for Flash MX, the part as code and the legend has been modified. Thanks for the blue ideal to provide the original.



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.