flash on 2010-4-30
♥0 |
Line 24 |
Modified 2011-05-20 16:30:57 |
MIT License
archived:2017-03-20 13:35:51
Related images
ActionScript3 source code
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7Ety
*/
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.utils.ByteArray;
import flash.errors.IOError;
import flash.events.IOErrorEvent;
import flash.text.TextField;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var ldr:Loader = new Loader;
var ba:ByteArray = new ByteArray;
ba.writeUTF('不正な形式');
ba.position = 0;
var tf:TextField = new TextField;
addChild(tf);
ldr.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (e:IOErrorEvent):void {
tf.appendText(e.text.replace(/Error #\d+:/,""));
tf.width = tf.textWidth + 4;
tf.height = tf.textHeight + 4;
});
ldr.loadBytes(ba);
}
}
}