zoukankan      html  css  js  c++  java
  • 即拷即用的loading代码

    放在第1帧即可。enjoy!

    代码:

    =========================================

    stop();
    var rect1:MovieClip = createRectangle1(150, 3, 0x000000);
    var rect2:MovieClip = createRectangle2(152, 5, 0x000000);
    rect1._x = (Stage.width - rect1._width) / 2;
    rect1._y = (Stage.height - rect1._height) / 2;
    rect2._x = (Stage.width - rect2._width) / 2;
    rect2._y = (Stage.height - rect2._height) / 2;
    onEnterFrame = function () {
    rect1._width = _root.getBytesLoaded() / _root.getBytesTotal() * 150;
    if (_root.getBytesLoaded() == _root.getBytesTotal()) {
    rect1.removeMovieClip();
    rect2.removeMovieClip();
    delete rect1;
    delete rect2;
    delete createRectangle1;
    delete createRectangle2;
    delete onEnterFrame;
    play();
    }
    };
    function createRectangle1(Number, height:Number, color:Number, scope:MovieClip):MovieClip {
    scope = (scope == undefined) ? this : scope;
    var depth:Number = scope.getNextHighestDepth();
    var mc:MovieClip = scope.createEmptyMovieClip("mc_" + depth, depth);
    mc.beginFill(color);
    mc.lineTo(0, height);
    mc.lineTo(width, height);
    mc.lineTo(width, 0);
    mc.lineTo(0, 0);
    return mc;
    }
    function createRectangle2(Number, height:Number, color:Number, scope:MovieClip):MovieClip {
    scope = (scope == undefined) ? this : scope;
    var depth:Number = scope.getNextHighestDepth();
    var mc:MovieClip = scope.createEmptyMovieClip("mc_" + depth, depth);
    mc.lineStyle(color);
    mc.moveTo(0, 0);
    mc.lineTo(0, height);
    mc.lineTo(width, height);
    mc.lineTo(width, 0);
    mc.lineTo(0, 0);
    return mc;
    }

    =========================================

  • 相关阅读:
    开源数据采集组件比较: scribe、chukwa、kafka、flume
    主流开源SQL(on Hadoop)总结
    Hive over HBase和Hive over HDFS性能比较分析
    开源Astro(SparkSQL On HBase)
    ML: 降维算法-LE
    ML: 降维算法-LLE
    Blender使用基础
    Cycles渲染研究测试效果图
    vs2008所有DTE.ExecuteCommand命令
    come on,逆战
  • 原文地址:https://www.cnblogs.com/MaxIE/p/529297.html
Copyright © 2011-2022 走看看