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

rotationYで裏表がある風の回転

角度見てvisible切り替えが簡単
(`・ω・´)(´・ω・`)ネー
Get Adobe Flash player
by undo 11 Apr 2011

    Tags

    3D
    Embed
package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;

    [SWF(width="465", height="465", frameRate="60", backgroundColor="0xffffff")]

    public class Main extends Sprite
    {
        
        private var _c:Card;
        
        public function Main()
        {
            init();
        }

        private function init():void
        {
            _c = addChild(new Card()) as Card;
            _c.x = _c.y = 230;
            
            var tPos:TextField = new TextField();
            var tPas:TextField = new TextField();
            tPos.autoSize = TextFieldAutoSize.LEFT;
            tPas.autoSize = TextFieldAutoSize.LEFT;
            var tfPos:TextFormat = new TextFormat();
            tfPos.font = '_sans';
            tfPos.size = 50;
            tfPos.color = 0xff0000;
            tfPos.bold = true;
            tPos.defaultTextFormat = tfPos;
            var tfPas:TextFormat = new TextFormat();
            tfPas.font = '_sans';
            tfPas.size = 50;
            tfPas.color = 0x0000ff;
            tfPas.bold = true;
            tPas.defaultTextFormat = tfPas;
            
            tPos.text = '(`・ω・´)';
            tPas.text = '(´・ω・`)';
            
            _c.positive.addChild(tPos);
            _c.passive.addChild(tPas);
            tPos.x = -tPos.width/2;
            tPos.y = -tPos.height/2;
            tPas.x = -tPas.width/2;
            tPas.y = -tPas.height/2;
            
            addEventListener(Event.ENTER_FRAME, onEnter);
        }
        
        private function onEnter(evt:Event):void
        {
            _c.cardRotationY += 5;
        }
    }
    
}


import flash.display.Sprite;

class Card extends Sprite
{
    private var _positive:Sprite;
    private var _passive:Sprite;
    
    public function Card()
    {
        init();
    }
    private function init():void
    {
        _positive = addChild(new Sprite()) as Sprite;
        _passive = addChild(new Sprite()) as Sprite;
        
        this.cardRotationY = 0;
    }
    
    
    public function get cardRotationY():Number
    {
        return this.rotationY;
    }
    public function set cardRotationY(value:Number):void
    {
        this.rotationY = value%360;
        
        if(this.rotationY < 90 || this.rotationY > 270)
        {
            this._positive.visible = true;
            this._passive.visible = false;
        }
        else
        {
            this._positive.visible = false;
            this._passive.visible = true;
        }
    }
    
    
    
    

    public function get passive():Sprite
    {
        return _passive;
    }

    public function set passive(value:Sprite):void
    {
        _passive = value;
    }

    public function get positive():Sprite
    {
        return _positive;
    }

    public function set positive(value:Sprite):void
    {
        _positive = value;
    }


}