flash on 2011-1-29
♥0 |
Line 29 |
Modified 2011-01-29 01:05:46 |
MIT License
archived:2017-03-20 03:27:09
ActionScript3 source code
/**
* Copyright Caiim. ( http://wonderfl.net/user/Caiim. )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2wE8
*/
package {
import flash.text.TextFormat;
import flash.text.TextField;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.Loader;
import flash.display.Sprite;
public class FlashTest extends Sprite {
var _txt:TextField = new TextField();
public function FlashTest() {
addChild(_txt);
_txt.x = stage.stageWidth/2;
_txt.y = stage.stageWidth/2;
_txt.setTextFormat(new TextFormat(null, 30));
var load:Loader = new Loader();
load.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
load.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
load.load(new URLRequest("http://2.bp.blogspot.com/_FgnzqerL3aU/TKnGNjdsFgI/AAAAAAAAAQk/cTcLsk5cwiI/s1600/free-cute-dog-.jpg"));
}
public function progress (e:ProgressEvent):void{
trace("Downloaded " + e.bytesLoaded + " out of " + e.bytesTotal + " bytes");
}
public function done(e:Event):void
{
addChild(e.target.content);
}
}
}