package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.net.*;
public class Main extends Sprite {
public function Main ( ) {
var urlLoader:URLLoader = new URLLoader( );
urlLoader.addEventListener(Event.COMPLETE, completeListener);
urlLoader.load(new URLRequest("styles.css"));
}
private function completeListener (e:Event):void {
var styleSheet:StyleSheet = new StyleSheet( );
styleSheet.parseCSS(e.target.data);
var t:TextField = new TextField( );
t.width = 200;
t.styleSheet = styleSheet;
t.htmlText = "<p>ActionScript is fun!</p>";
addChild(t);
}
}
}
|