I wrote an article "How to Implement interface code separation in Flash development" a few days ago. In the comments, Mr. G gave a better suggestion: SWC. I tried it today, it's really better than embed SWF! At the same time, I would like to express my gratitude to Mr. Xiao-G!
Take the control of the Video Player for example:
We usually put some general control buttons in the library by using the IDE interface of Flash CS.
If you follow the embed SWF method, you need to manually useCodeCreate instances of each type of Button, control the location one by one, and then addchild; in fact, this type of button always appears together in actual scenarios, it is better to put them together (like the custom controls in Asp.net) as a whole.
OK. Then, create a movieclip for controlbuttonbar in the database.
Note: In controlbuttonbar, specify a name for each button instance (so that the button can be referenced in the Code)
Export the file as a SWC File
The exported SWC file name can be written at will. I will save it as "controlbuttonbar. SWC ", the interface is partially done, you can turn off Flash CS, and then enable flex builder to create a project (I am used to using the ActionScript project ), right-click the project and choose Properties> ActionScript buildpath> libarypath> Add SWC
Select the SWC file you just exported, and click OK to observe the project. In referrnced libraries, you can see the reference to this SWC (just like viewing the reference in vs.net ).ProgramSet)
After these steps are completed, you can enjoy them in the Code:
How is it? This is no worse than vs.net.
Note: SWC feels like a user-defined control in. net.