Several methods for using flash materials in the as program

Source: Internet
Author: User

Flash programs often use the materials provided by the artist. Over the past few years, I have summarized some experiences and found that there are still many patterns. The summary is as follows:

1. package it into a SWC Class Library:

This method is relatively simple. The procedure is as follows:

1) convert the things to be used in Flash CS into the original

2) Right-click the original in the database and select Properties

3) Select 'actions' to export

4) Fill in a class name such as loading in the class Filling Box, and click OK. The original file is found in the class library as follows:

5) Select SWC in CTR + Shift + F12 (or file -- release settings) and click release. At this time, you will find an extra SWC file in the folder of the corresponding file. Import the SWC file to your as project and use the new loading file.

(This method is quick and simple for small projects and is recommended. However, for large projects, if all the materials are packaged into SWC, it will undoubtedly increase the size of the main program and sacrifice the user experience, which is not recommended)

2. package it into SWF:

(1) directly embedded in the program:

Package is the same as 1, but it is the configuration of the deployment, directly compiled into swfsuch as loading.swf and then used in the project

[Embed (Source = 'file location/loading.swf ', symbol = 'loading')]

Public var loading: class;

You can use the new output loading directly.

This method has the same disadvantages and advantages as 1.

(2) Use loader to dynamically load the program:

The packaging method is the same as 1. You do not need to publish the settings and directly compile them into SWF. You need to use loader. Load (New URLRequest ('file location/loading.swf '));

Use

VaR display: class = loader. contentloaderinfo. applicationdomain. getdefinition ("loading") as Class

This. addchild (New Display ());

This method is a bit difficult to use in small projects, because you need to determine whether the SWF has been downloaded before proceeding with subsequent operations. However, it can be dynamically loaded when used in large programs. It is equivalent to Windows DLL. This can effectively reduce the size of the main program, thus reducing the user download wait time. Summary completed, waiting for identification!

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.