flash on 2012-4-13
/**
* Copyright hacker_cobulht0 ( http://wonderfl.net/user/hacker_cobulht0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3duH
*/
package {
import flash.display.Sprite;
import flash.events.*;
import flash.filters.BlurFilter;
[SWF(width = "465", height = "465", backgroundColor = 0xffffff, frameRate = "60")]
public class Hello_World_flash extends Sprite{
static const _R:uint=100;
private var _prog:String="_circle";
private var strList:Array = new Array();
static const hellowList:Array= ["H","e","l","l","o","_","W","o","r","l","d","!"];
static const delayList:String = "abcdefghijklmnopqrstuvwxyz";
private var _prog_cnt:uint=0;
static const _prog_cnt_max:uint=250;
static const ballMax:uint=8;
private var ballList:Array=new Array();
public function Hello_World_flash(){
if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );
}
public function init(ev:Event = null){
removeEventListener( Event.ADDED_TO_STAGE, init ) ;
var bg:back_ground=new back_ground();
addChildAt(bg,0);
ready1();
}
private function ready1(){
for (var q:uint= 0; q < ballMax; q++) {
var _ball:Balls=new Balls();
var _radius=360/ballMax*q;
_ball.x=465/2+5;
_ball.y=465/2+5;
_ball.radius=_radius;
addChild(_ball);
ballList.push(_ball);
}
ready2();
}
private function ready2(){
//Hello_World!
for (var q:uint= 0; q < hellowList.length; q++) {
var _strobj:StrObj=new StrObj();
_strobj._delay=q*10;
_strobj._str=hellowList[q];
_strobj.myText.text="";
_strobj.x=115+q*20;
_strobj.y=220;
_strobj._myn=q;
addChild(_strobj);
strList.push(_strobj);
}
addEventListener(Event.ENTER_FRAME, _EF);
}
private function _EF(ev){
if(_prog=="_circle"){
for (var q:uint= 0; q < ballList.length; q++) {
var _ball=ballList[q];
_ball.x+=(_R*Math.cos(_ball.radius*Math.PI/180)+465/2+5-_ball.x)/10;
_ball.y+=(_R*Math.sin(_ball.radius*Math.PI/180)+465/2+5-_ball.y)/10;
_prog_cnt++;
if(_prog_cnt>_prog_cnt_max){_prog="_hellow";};
}
}else if(_prog=="_hellow"){
for (q= 0; q < ballList.length; q++) {
_ball=ballList[q];
_ball.radius++;
_ball.alpha=0.7;
_ball.x=_R*Math.cos(_ball.radius*Math.PI/180)+465/2+5;
_ball.y=_R*Math.sin(_ball.radius*Math.PI/180)+465/2+5;
_ball.filters = [ new BlurFilter(10,10) ] ;
}
for (var j:uint= 0; j < strList.length; j++) {
var _str=strList[j];
if(_str._cnt!=_str._delay){_str._cnt++;
_str._dstr="-";
}else if(_str._cnt==_str._delay){
_str._dstr=_str._str;
_str._lock=true;
}
_str.myText.text=_str._dstr;
}
var nm=funcNext();
if(nm<strList.length){strList[nm].myText.text=delayList.charAt(Math.floor(Math.random() * delayList.length));}
}
}
private function funcNext():uint{
var cnt:uint=0;
for (var j:uint= 0; j < strList.length; j++) {
var _str=strList[j];
if(_str._lock==true){cnt++;}
}
return cnt;
}
}//
}
import flash.display.*;
import flash.text.*;
class back_ground extends Sprite{
public function back_ground( ){
var bmp:BitmapData = new BitmapData(465*2, 465*2, false, 0xffffff);
var sh:Sprite = new Sprite();
sh.graphics.lineStyle(1,0x158078);
sh.graphics.drawRect(0,0,465,465);
sh.graphics.endFill();
for (var q:uint= 0; q < 227; q++) {
sh.graphics.lineStyle();//lineStyle中止
if(q%2==0){sh.graphics.beginFill(0x30BA8F);}else{sh.graphics.beginFill(0x45CEA2);}
sh.graphics.drawRect(5, 5+q*2, 455, 2);
sh.graphics.endFill();
}
bmp.draw(sh);
addChild(new Bitmap(bmp))
}
}
class Balls extends Sprite{
public var radius:Number;
public function Balls(){
this.graphics.beginFill(0xFFFFFF);
this.graphics.drawCircle(0,0,10);
this.graphics.endFill();
}
}
class StrObj extends Sprite{
public var _delay:uint=0;
public var _cnt:uint=0;
public var _dstr:String="_";
public var _str:String;
public var _myn:uint;
public var _lock:Boolean=false;
public var myText:TextField = new TextField();
public function StrObj(){
//テキストフォーマット作成
var fmt:TextFormat = new TextFormat();
fmt.size = 20;
fmt.align = TextFormatAlign.CENTER;
fmt.color = 0xFFFFFF;
fmt.font="Arial"
//テキストフィールド作成
myText.width=25;
myText.defaultTextFormat = fmt;
myText.selectable = false;
myText.text = "";
addChild(myText);
}
}