flash on 2009-10-12
/**
* Copyright mozart ( http://wonderfl.net/user/mozart )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/zkfV
*/
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.*;
import flash.ui.Keyboard;
import flash.events.*;
public class FlashTest extends Sprite {
public var loader:Loader = new Loader();
public var url1 = "http://www.google.co.jp/intl/ja_jp/images/logo.gif";
public var url2 = "http://k.yimg.jp/images/top/sp/logo.gif";
public var check:int = 0;
public function FlashTest() {
loader.load(new URLRequest(url2));
loader.x = 100;
loader.y = 100;
addChild(loader);
stage.addEventListener(KeyboardEvent.KEY_DOWN, move_gif);
}
public function move_gif(e:KeyboardEvent):void{
if(e.keyCode == Keyboard.UP){
loader.y -= 2;
}else if(e.keyCode == Keyboard.DOWN){
loader.y += 2;
}else if(e.keyCode == Keyboard.RIGHT){
loader.x += 2;
}else if(e.keyCode == Keyboard.LEFT){
loader.x -= 2;
}else if(e.keyCode == Keyboard.PAGE_UP){
if(loader.alpha <= 1){
loader.alpha += 0.1;
}
}else if(e.keyCode == Keyboard.PAGE_DOWN){
if(loader.alpha >= 0){
loader.alpha -= 0.1;
}
}else if(e.keyCode == Keyboard.ENTER){
if(check == 0){
loader.load(new URLRequest(url1));
check = 1;
} else {
loader.load(new URLRequest(url2));
check = 0;
}
}
}
}
}