Introduction:
ActionScript was developed for its flash product by Macromedia (which has been acquired by Adobe). It was initially a simple scripting language. The latest version 3.0 is a completely object-orientedProgramming LanguagePowerful, rich class libraries, similar to JavaScript syntax, mostly used for flash interactive, entertaining, and practical development, web page creation and RIA applicationsProgramDevelopment.
ActionScript is an ecmascript-based scripting language that can be used to compile Adobe Flash animations and applications. Since both ActionScript and JavaScript are based on the ecmascript syntax, theoretically they can be smoothly translated from one language to another. However, JavaScript's Document Object Model (DOM) is based on browser windows, documents and forms, while the Document Object Model (DOM) of ActionScript is based on SWF animation, which can include animation, audio, text and event processing.
Development Platform: Adobe Flash CS3, (Adobe Flash CS2 only supports ActionScript 1.0 and ActionScript 2.0 ).
Example:
After making a button, the screen displays "Hello World ". 1. Open Flash CS3 and create a new "Flash file (ActionScript 3.0 )". 2. Press Ctrl + F7 to open the "components" Panel, find the label and button controls in "User Interface", and place them in the work zone. 3. Name lable and button respectively "mylable and mybutton ". 4. Select the current frame and press F9 to open the action panel. (If the frame is selected correctly, the title of the open action panel is "action-frame ") 5. Write control statements on the Action panel.
// Declare a string variable and assign a value
VaR STR: String = " Hello World " ;
// Declare a mouse event
VaR Myclick: Function = Function (EVT: mouseevent)
{
Mylable. Text = STR;
}
// Add a click event to mybutton
Mybutton. addeventlistener ( " Click " , Myclick );
6. Press Ctrl + enter to view the running effect.
Extension:Display HTML with lableCode.The control statement is changed:
// Declare a string variable and assign a value
VaR Strhtml: String = " <Font color = '# ff0000' size = '24'> <a href = \ " HTTP: // Www.isdata.cn \ "> click I to enter the isdata homepage </a> </font> ";
// Declare a mouse event
VaR Myclick: Function = Function (EVT: mouseevent)
{
Mylable.html text = Strhtml; // Note: It is the htmltext attribute of lable.
}
// Add a click event to mybutton
Mybutton. addeventlistener ( " Click " , Myclick );
Press Ctrl + enter to view the running effect.Running Effect