zoukankan      html  css  js  c++  java
  • flash lite as2.0水平移动方法

    var movespeed = 8;//移动速度
    //mc 移动的影片
    //long 移动距离
    //posx 原始x坐标
    function leftbody(mc:MovieClip, long:Number, posx:Number) {
        var old = posx;
        this.onEnterFrame = function() {
            if ((mc._x-(old-long))>movespeed) {
                mc._x = mc._x-movespeed;
            } else if ((mc._x-(old-long))>0) {
                mc._x = mc._x-(mc._x-(old-long));
            } else {
                this.onEnterFrame = null;
                delete this.onEnterFrame;
            }
            //trace(mc._x);
        };
    }
    function rightbody(mc:MovieClip, long:Number, posx:Number) {
        var old = posx;
        this.onEnterFrame = function() {
            if (((old+long)-mc._x)>movespeed) {
                mc._x = mc._x+movespeed;
            } else if (((old+long)-mc._x)>0) {
                mc._x = mc._x+((old+long)-mc._x);
            } else {
                this.onEnterFrame = null;
                delete this.onEnterFrame;
            }
            //trace(mc._x);
        };
    }
  • 相关阅读:
    Python之datetime模块
    PEP8规范 Python
    redis操作命令
    Django之Cookie、Session和自定义分页
    登录之验证码相关实现
    装饰器进阶
    js中的cookie使用和vue-cookie的使用
    vue-cli的安装使用
    Django之进阶相关操作
    PyMySQL模块的使用
  • 原文地址:https://www.cnblogs.com/skyblue/p/1679326.html
Copyright © 2011-2022 走看看