flash on 2009-9-11
♥0 |
Line 53 |
Modified 2009-09-11 19:27:59 |
MIT License
archived:2017-03-20 10:15:01
ActionScript3 source code
/**
* Copyright ta1 ( http://wonderfl.net/user/ta1 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/xDLN
*/
package {
import flash.display.Sprite;
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
import flash.filters.*;
public class FlashTest extends Sprite {
public function FlashTest() {
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xFF0000);
circle.graphics.drawCircle(230,230,50);
this.addChild(circle);
var filter:DropShadowFilter = new DropShadowFilter();
filter.color = 0x111111;
filter.distance = 5;
filter.alpha = .70;
this.filters = [filter];
//btnの設定
this.buttonMode=true;
var btText:SimpleButton = new SimpleButton();
var txtUp:TextField = new TextField();
var txtOver:TextField = new TextField();
var txtDown:TextField = new TextField();
setBtnText(txtUp,"Click me ?",0xFF0000);
setBtnText(txtOver,"!",0xFFFF00);
setBtnText(txtDown,"THANKS",0xFF9900);
btText.upState = txtUp;
btText.overState = txtOver;
btText.downState = btText.hitTestState = txtDown;
btText.x=180;
btText.y=220;
this.addChild(btText);
function setBtnText(txt:TextField,str:String,bgCol:uint):void{
txt.text = str;
txt.width = 100;
txt.height = 20;
txt.background = true;
txt.backgroundColor = bgCol;
var tFormat :TextFormat = new TextFormat();
tFormat.align = TextFormatAlign.CENTER;
tFormat.size = 20;
txt.setTextFormat(tFormat);
}
this.addEventListener(MouseEvent.CLICK,gotoLink);
function gotoLink(event:Event):void {
//押してくれてありがとう!
trace("Thanks");
var thanks:String = "http://thx.kayac.jp/pc/";
var request:URLRequest = new URLRequest(thanks);
navigateToURL(request,"_blank");
}
}
}
}