flash on 2010-4-2
♥0 |
Line 49 |
Modified 2010-04-02 10:36:16 |
MIT License
archived:2017-03-20 12:51:04
ActionScript3 source code
/**
* Copyright hacker_9p8x8mco ( http://wonderfl.net/user/hacker_9p8x8mco )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/jzJL
*/
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
[SWF(backgroundColor="0x000000")]
public class FlashTest extends Sprite {
public var ldImg:Loader = new Loader();
public var tf:TextField = new TextField();
public function FlashTest() {
// write as3 code here..
var url:String = "http://blogpress.w18.net/photos/10/03/22/s_1557.jpg";
var urlReq:URLRequest = new URLRequest(url);
this.ldImg.contentLoaderInfo.addEventListener(Event.COMPLETE,this.loadCompleted);
this.ldImg.load(urlReq);
}
public function loadCompleted(event:Event):void{
this.addChild(this.ldImg);
ldImg.x = 100;
ldImg.y = 100;
tf.textColor = 0xffffff;
tf.text = "Another Scenery\nBurning sunshine.Colorful plants and foodstuffs.\nAt one point,for me,another scenery took form.\nBreeze from Okinawa sent from my father who moved\nfrom Tokyo.";
addChild(tf);
tf.x = 100;
tf.y = 100;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.multiline = true;
tf.height = 100;
tf.width = 100;
var sw:Sprite = new Sprite();
sw.graphics.beginFill(0xFFFFFF);
sw.graphics.drawRect(298,210,9,15);
sw.graphics.endFill();
sw.buttonMode = true;
sw.alpha = 0;
addChild(sw);
sw.addEventListener(MouseEvent.CLICK,switchOn);
}
public function switchOn(event:MouseEvent):void{
if(tf.visible == false){
tf.visible = true;
}else{
tf.visible = false;
}
}
}
}