Interaction between AS and. net -- load xml on the web

Source: Internet
Author: User

I recently launched a private activity, and I need to use as to load the xml of a website. However, I am not a good user of as. I just want to see how to play it. It is quite simple after reading it. For business complexity, let's just give a small example. Most of the time, to make the page area more flexible, vivid, and attractive, flash should be used more or less. If flash cannot be exchanged with the outside world, the flash function will be greatly limited, this is no fun. on many websites, we can see that flash is used to display the current number of online users, flash is used to show the number of current user participants, or the current winning list is displayed in a rolling manner. Because it is purely teaching, the business is very simple, and the number of current user participation is dynamically displayed. However, the good thing is that after many programs get a benchmark, they no longer turn to the server for training, instead, random numbers are used in flash to simulate the dynamic increase and decrease, which is used to cheat participants... I. the xml file is simple. Only one benchmark participant is placed: <? Xml version = "1.0" encoding = "UTF-8"?> <Project> <joins> <nums> 20 </nums> </joins> </project> 2: Request the xml as code import flash.net on the web. URLLoader; import flash.net. URLRequest; import flash. events. event; import flash. text. textField; import flash. utils. timer; import flash. events. timerEvent; var myxml: XML; // request xmlvar url on the web =" http://localhost:25212/test.xml "; Var req: URLRequest = new URLRequest (url); var loader: URLLoader = new URLLoader (req); var lab: TextField = new TextField (); var timer: timer = new Timer (1000); var joinScale: int loader. addEventListener (Event. COMPLETE, onComplete); function onComplete (e: Event): void {myxml = new XML (loader. data); joinScale = myxml. joins. nums var output = "current number of participants:" + joinScale trace (output); lab. text = output lab. width = 200; lab. x = 100; lab. y = 100; addChild (lab); timer. addEventListener (TimerEvent. TIMER, setText); timer. start ();} function setText (e: TimerEvent) {// reduce joinScale = joinScale + (10 * Math. random ()-3 lab. text = "currently involved:" + joinScale}

Related Article

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.