• 图案设计的素材


    图案设计中用到的一个素材,用鼠标拖动看效果:

    //2008.9
    //
    =================================色模块开始===========================
    import fl.controls.ColorPicker;
    import fl.events.ColorPickerEvent;
    myColorPicker.colors 
    = [ 0x0000000xFF00000x00FF000x0000FF0xFFFF000x00FFFF0xFF00FF];
    myColorPicker.showTextField
    =false;

    //=================================色模块结束===========================
    var drag_i:uint;
    var old_num:uint=0;
    var num:uint;
    var clockTimer:Timer;
    var dian_zx:Point=new Point(stage.stageWidth/2,stage.stageHeight/2);
    var dian_0:Point;
    var R_distance:Number;
    var gong_x:MovieClip;

    myokPicker.addEventListener(MouseEvent.MOUSE_DOWN,start_Draw);


    function start_Drag(e:MouseEvent):void {
        drag_i
    =Number(e.currentTarget.name.charAt(5));

        
    for (var i:uint=0; i<Number(mynumPicker.selectedItem.data); i++) {
            
    if (i!=Number(e.currentTarget.name.charAt(5))) {
                getChildByName(
    "gong_" + i).addEventListener(Event.ENTER_FRAME, baidong);
            }
        }
        e.currentTarget.startDrag();
        stage.addEventListener(MouseEvent.MOUSE_UP,stop_Drag);
    }

    function stop_Drag(e:MouseEvent):void {
        stopDrag();
        
    for (var i:uint=0; i<Number(mynumPicker.selectedItem.data); i++) {
            
    if (i!=drag_i) {

                getChildByName(
    "gong_" + i).removeEventListener(Event.ENTER_FRAME, baidong);
            }
        }
        stage.removeEventListener(MouseEvent.MOUSE_UP,stop_Drag);

    }

    function baidong(e:Event):void {
        
        
    var i:Number=Number(e.currentTarget.name.charAt(5));
        
    if (i>drag_i) {
            i
    =i-drag_i;
        } 
    else {
            i
    =i-drag_i+Number(mynumPicker.selectedItem.data);
        }
        
    var jiao:Number=Math.atan((getChildByName("gong_" + drag_i).y-stage.stageHeight/2)/(getChildByName("gong_" + drag_i).x-stage.stageWidth/2));
        if (getChildByName("gong_" + drag_i).x-stage.stageWidth/2<0) {
            jiao=Math.PI+jiao;
        }
        dian_0
    =new Point(getChildByName("gong_" + drag_i).x,getChildByName("gong_" + drag_i).y);
        R_distance
    =Point.distance(dian_zx,dian_0);

        e.currentTarget.x
    =Point.polar(R_distance,jiao+((360/Number(mynumPicker.selectedItem.data))*i/180)*Math.PI).x+stage.stageWidth/2;//R_distance*Math.cos(((60*i)/180)*Math.PI+j);
        e.currentTarget.y
    =Point.polar(R_distance,jiao+((360/Number(mynumPicker.selectedItem.data)*i/180))*Math.PI).y+stage.stageHeight/2;//R_distance*Math.sin(((60*i)/180)*Math.PI+j)+gong_6.y;

    }
    function start_Draw(e:MouseEvent):void {
        
    //=================================清空模块开始===========================
        try {
            
    if (old_num!=0) {trace(old_num);
                
    for (var i:uint=0; i<old_num; i++) {
                    removeChild(getChildByName(
    "gong_" + i))
                    
                }
                gong_x
    =null
                
            }
        } 
    catch (e:Error) {
        }
        
    //=================================清空模块结束===========================
        //=================================时间模块开始===========================
        old_num=Number(mynumPicker.selectedItem.data)
        num
    =0;
        clockTimer
    =new Timer(500,Number(mynumPicker.selectedItem.data));
        clockTimer.addEventListener(TimerEvent.TIMER,timerFunction);
        clockTimer.addEventListener(TimerEvent.TIMER_COMPLETE ,time_Complete);
        clockTimer.start();
    //开始运行计时器
        //=================================时间模块结束===========================

        
    }
    function timerFunction(event:TimerEvent):void {
        mytime();
    //每秒更新钟面
    }
    function time_Complete(event:TimerEvent):void {
        clockTimer.removeEventListener(TimerEvent.TIMER,timerFunction);
    }
    function mytime() {//每秒画一个图形

        gong_x
    =new g_base();
        
    var colorInfo:ColorTransform = gong_x.transform.colorTransform;
        colorInfo.color 
    =myColorPicker.selectedColor;
        gong_x.transform.colorTransform 
    = colorInfo;
        
    //gong_6.transform.colorTransform = colorInfo;
        gong_x.gotoAndStop(Number(mybasePicker.selectedItem.data));
        gong_x.rotation
    =(360/Number(mynumPicker.selectedItem.data))*num;

        gong_x.x
    =Point.polar(80,((360/Number(mynumPicker.selectedItem.data))*num/180)*Math.PI).x+stage.stageWidth/2;
        gong_x.y=Point.polar(80,((360/Number(mynumPicker.selectedItem.data))*num/180)*Math.PI).y+stage.stageHeight/2;
        gong_x.addEventListener(MouseEvent.MOUSE_DOWN,start_Drag);
        gong_x.buttonMode
    =true;
        addChild(gong_x);
        gong_x.name
    ="gong_"+num;
        num
    ++;

    }
  • 相关阅读:
    再度学习MYSQL-----(1.基础)
    GIL解释器锁(进程与线程的应用场景)
    Django学习三有关表的创建查询类
    Django学习二模板
    Django学习一
    JQuery学习一
    前端基础学习之css二
    前端基础之css一
    mysql----单表多表查询
    MySQL-----表操作
  • 原文地址:https://www.cnblogs.com/ddw1997/p/1552040.html
Copyright © 2020-2023  润新知