The development of "Flash development" has been roughly divided into two branches: FlashDesignerAnd flashProgramEmployeeHowever, designers do not understandCodeProgrammers do not understand design. How can they combine these two roles to implement code and interface separation? The following methods may be useful to you:
Actionscript3 allows external SWF to be directly embedded into the main class with the embed mark (of course, it can also be dynamically loaded with urlloader), which means that designers canCode-independentMaterials (such as buttons, images, and small animations) are designed to be stored in the library using Flash CS in their favorite way.
Then the programmer embeds the SWF containing (skin) material into the program code and creates the corresponding instance with the Code. In this way, the programmer uses flash Builder/flashdevelop for development, designers Use Flash CS for design.
Key points:
When the designer puts the material into the library, the class name must be specified so that the code can create instances of these classes.
As shown in, three basic clips (buttons, bitmaps, and movie clips) are stored in the library, which can be processed in the Code as follows:
Package {import flash. display. sprite; import flash. display. displayobject; import flash. display. simplebutton; import flash. events. mouseevent; import flash. display. movieclip; import flash. display. bitmapdata; import flash. display. bitmap; public class demo extends movieclip {[embed (Source = "skin.swf", symbol = "buttonpause")] private var buttonpause: Class; [embed (Source = "skin.swf ", symbol = "buttonplay")] privat E var buttonplay: Class; [embed (Source = "skin.swf", symbol = "logoimage")] private var logoimage: Class; [embed (Source = "skin.swf ", symbol = "testmovie")] private var testmovie: Class; Public Function demo () {Init ();} private function Init (): void {var btntest: simplebutton = new buttonpause () as simplebutton; trace (btntest, btntest is simplebutton); // demo_buttonpause0, trueaddchild (btntest); btntest. X = btntest. Y = 50; btntest. addeventlistener (mouseevent. click, btntestclick); var btntest2: simplebutton = new buttonplay () as simplebutton; trace (btntest2); // demo_buttonplay1addchild (btntest2); btntest2.y = 50; btntest2.x= 100; btntest2.addeventlistener (mouseevent. click, btntest2click); var bone density: bitmap = new logoimage () as bitmap; trace (bone density); // demo_logoimage2addchild (bone density); bone density. X = BMI. y = 200; var testmovie: movieclip = ne W testmovie () as movieclip; addchild (testmovie); testmovie. X = testmovie. y = 180; trace (testmovie); // demo_testmovie3} private function btntestclick (E: mouseevent): void {trace ("btntest has been clicked! ");} Private function btntest2click (E: mouseevent): void {trace (" btntest2 is clicked! ");}}}