flash on 2012-1-24
♥0 |
Line 32 |
Modified 2012-01-24 12:01:06 |
MIT License
archived:2017-03-30 03:00:04
ActionScript3 source code
/**
* Copyright tepe ( http://wonderfl.net/user/tepe )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/kLE2
*/
package {
import flash.display.Sprite;
import flash.text.*;
import flash.events.*;
import flash.net.*;
public class FlashTest extends Sprite {
public function FlashTest(){
var list:TextField = new TextField();
list.autoSize = TextFieldAutoSize.LEFT;
list.multiline = true;
list.htmlText = "<a href=\"event:http://www.yahoo.jp\">Yahoo</a><br>";
list.htmlText += "<a href=\"event:http://google.co.jp\">google</a><br>";
addEventListener(TextEvent.LINK, linkHandler);
addChild(list);
}
private function linkHandler(e:TextEvent):void {
var url:URLRequest = new URLRequest(e.text);
navigateToURL(url);
}
public function FlashTest2():void{
// write as3 code here..
var t:TextField = new TextField();
t.y =50;
t.htmlText = "<a href= \"http://www.yahoo.co.jp\" >Yahoo Japan</a>";
//t.text = "yahoo Japan";
addChild(t);
t.addEventListener(MouseEvent.CLICK,onClick);
}
private function onClick(e:MouseEvent):void{
var url:URLRequest = new URLRequest("http://www.yahoo.co.jp");
navigateToURL(url);
}
}
}