flash on 2010-2-2
♥0 |
Line 50 |
Modified 2010-02-02 21:18:03 |
MIT License
archived:2017-03-20 00:42:08
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/7RDX
*/
package{
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
public class Main extends Sprite {
public function Main() {
var queArray:Array = ['おはようを英語で言うと?', 'こんにちはを英語で言うと?', 'こんばんはを英語で言うと?', 'おやすみを英語で言うと?']
var ansArray:Array = ['Good Morning', 'Good Afternoon', 'Good Evening', 'Good Night'];
for (var j:uint = 0; j < 4; j++) {
queTextField(queArray[j],50,100+(j*50));
}
for(var i:uint=0;i<4;i++){
ansTextField(ansArray[i],300,100+(i*50));
}
}
public function queTextField(str:String, _x:Number, _y:Number):void {
var fld:TextField;
fld = new TextField();
fld.text = str;
fld.x = _x;
fld.y = _y;
fld.wordWrap = true;
fld.width = 200;
fld.height = 18;
addChild(fld);
}
public function ansTextField(str:String, _x:Number,_y:Number):void {
var fld:TextField;
fld = new TextField();
fld.text = "";
fld.x = _x;
fld.y = _y;
fld.width = 100;
fld.height = 18;
fld.border = true;
addChild(fld);
fld.addEventListener(MouseEvent.ROLL_OVER , answer);
fld.addEventListener(MouseEvent.ROLL_OUT , erace);
function answer(event:MouseEvent):void {
fld.background = true;
fld.backgroundColor = 0xff6666;
fld.text = str;
}
function erace(event:MouseEvent):void {
fld.text = "";
fld.background = false;
}
}
}
}