flash on 2010-9-11
♥0 |
Line 51 |
Modified 2010-09-11 20:18:19 |
MIT License
archived:2017-03-20 03:27:16
ActionScript3 source code
/**
* Copyright Caiim. ( http://wonderfl.net/user/Caiim. )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/4uOt
*/
package {
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.display.Shape;
import flash.display.SimpleButton;
import flash.text.TextFormat;
import flash.text.TextField;
import flash.display.Graphics;
import flash.display.MovieClip;
import flash.display.Sprite;
[SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]
public class FlashTest extends Sprite {
private var txt:TextField = null;
private var btn:SimpleButton = null;
private var okay:Boolean = true;
public function FlashTest() {
// write as3 code here..
var w:int = 100, h:int = 25;
btn = new SimpleButton(getBox(0xffdddd, w, h), getBox(0xeeeeee, w, h), getBox(0xcccccc, w, h), getBox(0x000000,w,h));
btn.x = stage.stageWidth-btn.width;
addChild(btn);
txt = new TextField();
txt.width = stage.stageWidth-btn.width;
txt.text = "http://1.bp.blogspot.com/_VVCdFsnptws/SaddcPKPqmI/AAAAAAAAABo/AIXoEuXjCcg/s1600/HamsterREX_468x362.jpg";
txt.selectable = true;
txt.setTextFormat(new TextFormat(null, 20, 0xffffff));
addChild(txt);
btn.addEventListener(MouseEvent.CLICK, animatePicture);
}
function animatePicture(e:MouseEvent):void
{
if(okay)
{
var url:URLRequest = new URLRequest(txt.text);
}
}
function getBox(c:uint, w:int, h:int):MovieClip
{
var s:MovieClip = new MovieClip();
s.graphics.beginFill(c);
s.graphics.drawRect(0,0,w,h);
s.graphics.endFill();
var txt:TextField = new TextField();
txt.text = "Submit";
txt.height=h;
txt.width=w;
txt.setTextFormat(new TextFormat(null, 20, 0xffffff-c, null, null, null, null, null, "center"));
s.addChild(txt);
return s;
}
}
}