In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2009-4-15

作成中
Get Adobe Flash player
by Nao_u 16 Apr 2009

    Tags

    fun
    Embed
// 
// 作成中
// 
package {   
    import flash.display.Sprite;   
    import flash.events.*;   
    [SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="60")]    
      
    public class FlashTest extends Sprite {   
        public function FlashTest() {   
            Main = this;   
            initialize();   
            stage.addEventListener(Event.ENTER_FRAME,update);    
            stage.addEventListener(KeyboardEvent.KEY_UP,   keyCheckUp);    
            stage.addEventListener(KeyboardEvent.KEY_DOWN, keyCheckDown);    
            stage.addEventListener(MouseEvent.MOUSE_UP,    MouseCheckUp);    
            stage.addEventListener(MouseEvent.MOUSE_DOWN,  MouseCheckDown);    
        }   
    }   
}           
  
import flash.display.Sprite;    
import flash.events.Event;   
import flash.events.KeyboardEvent;    
import flash.events.MouseEvent;    
import flash.ui.Keyboard;    
import flash.text.TextField;   
var Main:Sprite;   
var SCREEN_W:Number = 465;  
var SCREEN_H:Number = 465;  
var Text:TextField  

var Func:Object; 
var FuncNo:int = 0; 
var FUNC_MAX:int = 2;

var Step:Number = 2.0 * Math.PI / 30; 
var Scale:Number = 200.0; 

function initialize():void{   
    Text = new TextField();   
    Text.text = "----"; 
    Text.autoSize = "left"; 
    Main.addChild(Text);    
     
    graphicClear(); 
}   

var Cnt0:Number = 0;
var Cnt1:Number = 0;
var Cnt2:Number = 0;
var Cnt3:Number = 0;
function update(e :Event):void{   
    graphicClear(); 

    var bx:Number = 0.0;
    var by:Number = 0.0;
    var t:Number = -1.00;
    var rot:Number = 0;//3.14*0.5;
    var size:Number = 10.5;
    var col:Number = 1.0;

    var a:Number = 1.1;
    var b:Number = 0.5;

    Cnt0 += 0.020;
    Cnt1 = Cnt0 + 0.7 * Math.sin( 0.33 * Cnt0 * Math.PI*0.5);
    Cnt2 = Cnt0 + 0.7 * Math.sin( 0.33 * Cnt0 * Math.PI*1.0 );
    Cnt3 = Cnt0 + 0.7 * Math.sin( 0.33 * Cnt0 * Math.PI*1.5 );
    var bAdd0:Number = 4.0 * Math.sin( Cnt0 + Math.PI*0.00  );    
    var bAdd1:Number = 4.0 * Math.sin( Cnt0 + Math.PI*0.00  );    
    var bAdd2:Number = 4.0 * Math.sin( Cnt0 + Math.PI*0.00  );    
    var bAdd3:Number = 4.0 * Math.sin( Cnt0 + Math.PI*0.00  );    

    drawRec( 200, a, b+bAdd0*0.1, bx, by, t+0.3, Math.PI*0.0+Cnt0, size, col );
    drawRec( 200, a, b+bAdd1*0.1, bx, by, t+0.3, Math.PI*0.5+Cnt1, size, col );
    drawRec( 200, a, b+bAdd2*0.1, bx, by, t+0.3, Math.PI*1.0+Cnt2, size, col );
    drawRec( 200, a, b+bAdd3*0.1, bx, by, t+0.3, Math.PI*1.5+Cnt3, size, col );
}

function drawRec( cnt:int, a:Number, b:Number, bx:Number, by:Number, t:Number, rot:Number, size:Number, col:Number ):void{

    var r:Number = a * Math.pow( b, t );
    var x:Number = bx + r * Math.cos( t+rot );
    var y:Number = by + r * Math.sin( t+rot );
    
    var t2:Number = t + 0.20;
    var r2:Number = a * Math.pow( b, t2 );
    var ex:Number = bx + r2 * Math.cos( t2+rot );
    var ey:Number = by + r2 * Math.sin( t2+rot );

    if( cnt > 0 ){
        drawLine( x, y, ex, ey, size, col );
//        drawCircle( x, y, size*0.1, col );
        size *= 0.985;
        drawRec( cnt-1, a, b, bx, by, t2, rot, size, col*0.985 );
        
        if( cnt > 10 && (cnt%35)==10 ){
        //    drawRec( cnt-15, a, b, bx+x, by+y, 0, t+rot, size*0.9, col );
        }
    }
}


function graphicClear():void{ 
    Main.graphics.clear();  
    Main.graphics.lineStyle(1.2,0xd0d000);      
    Main.graphics.moveTo( SCREEN_W/2,          0 );      
    Main.graphics.lineTo( SCREEN_W/2,   SCREEN_H );         
    Main.graphics.moveTo(          0, SCREEN_H/2 );      
    Main.graphics.lineTo(   SCREEN_W, SCREEN_H/2 );         
} 



function drawLine( sx:Number, sy:Number, ex:Number, ey:Number, size:Number, col:Number ):void{   
    var c0:int = 240 * (col*col); 
    var c1:int = 240 * (col); 
    var cc:int = (c0<<16) + (c1<<8); 
    Main.graphics.lineStyle(size,cc);      
    Main.graphics.moveTo( Scale * sx + SCREEN_W/2, Scale * sy + SCREEN_H/2 );      
    Main.graphics.lineTo( Scale * ex + SCREEN_W/2, Scale * ey + SCREEN_H/2 );         
}  

function drawCircle( x:Number, y:Number, size:Number, col:Number ):void{   
    var c:int = 200 * col; 
    var cc:int = (c<<16) + (c<<8); 
    Main.graphics.beginFill( cc, 1 );   
    Main.graphics.drawCircle( Scale*x+SCREEN_W/2, Scale*y+SCREEN_H/2, Scale*size );   
    Main.graphics.endFill();   
}  

var KEY_UP:int    = 0x01;   
var KEY_DOWN:int  = 0x02;   
var KEY_LEFT:int  = 0x04;   
var KEY_RIGHT:int = 0x08;   
var KeyData:int;   
function keyCheckDown(event:KeyboardEvent):void {    
    switch (event.keyCode){    
        case Keyboard.UP:      KeyData |= KEY_UP; break;   
        case Keyboard.DOWN:    KeyData |= KEY_DOWN; break;   
        case Keyboard.LEFT:    KeyData |= KEY_LEFT; break;   
        case Keyboard.RIGHT:   KeyData |= KEY_RIGHT; break;   
    }   
}    
function keyCheckUp(event:KeyboardEvent):void {    
    switch (event.keyCode){    
        case Keyboard.UP:      KeyData &= ~KEY_UP; break;   
        case Keyboard.DOWN:    KeyData &= ~KEY_DOWN; break;   
        case Keyboard.LEFT:    KeyData &= ~KEY_LEFT; break;   
        case Keyboard.RIGHT:   KeyData &= ~KEY_RIGHT; break;   
    }   
}    

var MOUSE_LEFT:int = 0x01;   
var MOUSE_LEFT_TRG:int = 0x02;   
var MouseData:int;   
function MouseCheckDown(event:MouseEvent):void{   
    MouseData |= MOUSE_LEFT;   
    MouseData |= MOUSE_LEFT_TRG;   
}            

function MouseCheckUp(event:MouseEvent):void{   
    MouseData &= ~MOUSE_LEFT;   
}            

function MouseUpdate():void{   
    MouseData &= ~MOUSE_LEFT_TRG;   
}