flash on 2010-4-26
♥0 |
Line 47 |
Modified 2010-04-26 19:26:23 |
MIT License
archived:2017-03-20 00:40:07
ActionScript3 source code
/**
* Copyright 084 ( http://wonderfl.net/user/084 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/engl
*/
package {
import flash.accessibility.AccessibilityImplementation;
import flash.display.Sprite;
import flash.display.SimpleButton;
import flash.events.TextEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class Extra3 extends Sprite {
private var icon:SimpleButton = new SimpleButton();
public function Extra3() {
var upImg:Sprite = upIcon();
var overImg:Sprite = upIcon();
var label:TextField = makeLabel();
overImg.addChild(label);
icon.upState = upImg;
icon.overState = overImg;
icon.downState = overImg;
icon.useHandCursor = true;
icon.hitTestState = upImg;
addChild(icon);
icon.x = 300;
icon.y = 180;
}
private function upIcon():Sprite {
var Img:Sprite = new Sprite();
Img.graphics.lineStyle(1, 0xff6600);
Img.graphics.beginFill(0xff6600);
Img.graphics.drawCircle(0, -60, 60);
Img.graphics.endFill();
return Img;
}
private function makeLabel():TextField {
var tf:TextField = new TextField();
tf.text = "アイコン";
tf.width = 120;
tf.x = -60;
tf.y = -140;
var fmt:TextFormat = new TextFormat();
fmt.color = 0x000000;
fmt.size = 12;
fmt.align = TextFormatAlign.CENTER;
tf.setTextFormat(fmt);
return tf;
}
}
}