Coding of Flash cs4/5 and flex/flash Builder

Source: Internet
Author: User

Note: For convenience, flash cs4/5 is short for flash and flex/flash builder is short for flex.

Generally, you can use flash to create resource files (SWC/SWF) for flex.

I. src directory

In Flex, the source code is generally stored in the src directory.

The project directory in Flash is the source code (class) directory.

For unification, You 'd better change it.

Modification method:

1. Open project properties:

2. Set the source code location (. indicates the current directory)

3. Set the source code location of the component link class in the library

Open the Setting Dialog Box in ActionScript 3.0, and change. To./src,

Ii. Export SWC

Select "Export SWC" in "Release Settings" to facilitate flex

3. Reference SWC In Flex

Go to project properties, and click the <G id = "1"> ActionScript build path </G> Add SWC... -> Find the SWC generated by flash and click OK.

Note: I am using flash Builder 4 + Flash CS 5. You can directly create a flash project in Flash builder. Flex will automatically re-compile the project when it is released in flash, which is more convenient.

4. Create Resources

To create the required resources (components) in the Flash library, you need to specify a link class for it if it needs to be called in Flex (you can leave the link class empty, flash is automatically generated for you. If you need additional functions, you can write them yourself ),

You can also use AI or relevant graphs to copy them directly to flash.

5. Call the created Resource

After the SWC call is linked in flex, It will be written to the commonCodeSame:

Package com. loveqipai. DDZ
{
..........
Import com. loveqipai. DDZ. res. customnumber;

Public class xxxxtest extends Sprite
{
..........
Public Function xxxmethod ():Void{........ VaR num: customnumber = new custoaddmnumber; addchild (Num );........}..........}}

The general steps are as follows, which is relatively simple.

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.