Home > php教程 > PHP开发 > flex actionScript read file sample code

flex actionScript read file sample code

高洛峰
Release: 2016-12-27 17:03:30
Original
1180 people have browsed it

import flash.events.Event;
 import flash.net.URLLoader;
 import flash.net.URLRequest;
 import flash.net.URLVariables;
  
 public class TxtLoader
 {
 private var setTxt:Function = null;
 public function TxtLoader()
 {
 }
  
 public function loadTxt(fileName:String, setTxt:Function):void {
  this.setTxt = setTxt;
  var urlRequest:URLRequest = new URLRequest(fileName);
  var urlLoader:URLLoader = new URLLoader();
  urlLoader.addEventListener(Event.COMPLETE, complete);
  urlLoader.load(urlRequest);
 }
  
 private function complete(event:Event):void {
  var urlLoader:URLLoader = event.currentTarget as URLLoader;
  setTxt.call(null, urlLoader.data);
 }
 }
 
-----------------调用的方法-------------------------------------------------------------   
 
new TxtLoader().loadTxt('readme.txt', function(txt:String):void { 
 
         Alert.show( txt); 
 
    });
Copy after login

For more flex actionScript reading file sample code related articles, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template