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.