AS3 Test Code

Source: Internet
Author: User

package{import flash.display.sprite;import flash.events.event;import  flash.external.externalinterface;import flash.text.textfield;import flash.text.textfieldautosize; import flash.utils.setinterval;import flash.utils.settimeout; [SWF (framerate= ",  width=", " height=",  backgroundcolor= "0xFFFFFF")]public class  main extends sprite{private var _txt:textfield;public function main () {This . _txt = new textfield (); This.addchild (_txt);this._txt.autosize =  textfieldautosize.left;this._txt.multiline = true;this._txt.text =  "Test data receive example, External methods Please use: Externalfunction "; This._txt.appendtext (" \ n \ nthe start run, not join the display list "); This.addeventlistener (Event.added_to_stage, Addtostage);} Private function addtostage ($evt: Event): Void{this.removeeventlistener (Event.added_to_stage, Addtostage), This._txt.appendtext ("\ n already added to the display list"), if (externalinterface.available) {this._txt.appendtext ("\ n player isIn the container for external interfaces "); Externalinterface.addcallback ("Externalfunction", callback); Externalinterface.call ("Callbackbridge");} Else{this._txt.appendtext ("\ n the player is not in the container of the external Interface");}} Private function callback ($param: Object): Void{this._txt.appendtext ("\ n received parameter" +string ($param)); this._ Txt.appendtext ("\ n Test succeeded! ");}}}


AS3 Test Code

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.