| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 639 人关注过本帖
标题:求教-哪位大虾帮忙看看这个Flash代码如何修改
只看楼主 加入收藏
marine0516
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-1-13
结帖率:0
收藏
 问题点数:0 回复次数:0 
求教-哪位大虾帮忙看看这个Flash代码如何修改
Flash菜单01-05,鼠标经过哪个表,菜单自动上下切换,由于这个菜单在开始加载到网站后,是全部收缩起来的状态,希望将它修改为一启动,菜单的状态就是打开第一个


代码如下:(如果代码太长,我可以上传整个源码)
function scaler() {
    var speed = 2.000000E-001;
    k = 1;
    range = 0;
    aply = false;
    this.onEnterFrame = function() {
        _root["line"+k]._width = _root["line"+k]._width+(_root["line"+k].wid+30-_root["line"+k]._width)*speed;
        _root["line"+k]._height = _root["line"+k]._height+(_root["line"+k].hei-_root["line"+k]._height)*speed;
        _root["line"+k]._y = _root["line"+k]._y+(_root["line"+k].hey-_root["line"+k]._y)*speed;
        if (Math.abs(_root["line"+k].wid-_root["line"+k]._width)<3) {
            if (k<=num) {
                k = k+1;
            } else {
                aply = true;
            }
            // end if
        }
        // end else if   
        for (var _loc3 = 1; _loc3<=num; ++_loc3) {
            if (!down) {
                if (_loc3 == names) {
                    th = 250;
                    ap = 0;
                } else {
                    th = this["line"+_loc3].hei;
                    ap = 100;
                }
                // end else if
            } else {
                th = 1;
                ap = 100;
            }
            // end else if
            this["line"+_loc3].mcScaler(th, ap);
            this["type"+_loc3].mcScaler(undefined, ap);
        }
        // end of for
        for (var _loc3 = 1; _loc3<=num; ++_loc3) {
            if (_loc3 != 1) {
                _root["line"+_loc3]._y = _root["line"+(_loc3-1)]._y+_root["line"+(_loc3-1)]._height;
                _root["type"+_loc3]._y = _root["line"+_loc3]._y-1;
            } else {
                _root["line"+_loc3]._y = 0;
                _root["type"+_loc3]._y = -1;
            }
            // end else if
            this["makeClip"+_loc3]["mask"+_loc3].Clip._y = _root["line"+_loc3]._y;
            this["makeClip"+_loc3]["mask"+_loc3].Clip._width = _root["line"+_loc3]._width;
            this["makeClip"+_loc3]["mask"+_loc3].Clip._height = _root["line"+_loc3]._height;
            this["makeClip"+_loc3]["mask"+_loc3].obj._y = _root["line"+_loc3]._y;
            this["makeClip"+_loc3]["mask"+_loc3].obj.setMask(this["makeClip"+_loc3]["mask"+_loc3].Clip);
        }
        // end of for
    };
}
// End of the function
function DataLoader(obj) {
    loadTxt = new LoadVars();
    loadTxt.load(obj);
    loadTxt.onLoad = function(sucess) {
        if (sucess) {
            init();
        }
        // end if   
    };
}
// End of the function
function init() {
    _global.num = Number(loadTxt.imgNum);
    confirm = new Array();
    confirmAll = 0;
    loaded = new Array();
    down = false;
    DataConstructor();
}
// End of the function
function DataConstructor() {
    i = 1;
    targetw = 500;
    while (i<=num) {
        this.attachMovie("mclip"+i, "line"+i, i+300);
        this["line"+i]._x = 0;
        this["line"+i].wid = this["line"+i]._width;
        this["line"+i].hei = this["line"+i]._height;
        this["line"+i].hey = this["line"+i]._y;
        this["line"+i]._width = 0;
        this["line"+i]._alpha = 100;
        this["line"+i]._y = random(100);
        this["line"+i]._height = random(30)+10;
        this.createEmptyMovieClip("makeClip"+i, 100+i);
        this.createEmptyMovieClip("type"+i, 400+i);
        this["type"+i].attachMovie("types", "types", 350+i);
        this["type"+i].types.gotoAndStop(i);
        this["type"+i].types._alpha = 70;
        this.type1._y = -3;
        this["type"+i]._y = this["type"+(i-1)]._y+this["type"+(i-1)]._height+1;
        this["type"+i]._x = Math.round(this["type"+i]._x)+2;
        this["type"+i]._y = Math.round(this["type"+i]._y);
        this["makeClip"+i].attachMovie("mask", "mask"+i, 90+i);
        this["makeClip"+i]["mask"+i].createEmptyMovieClip("Clip", 80+i);
        this["makeClip"+i]["mask"+i].Clip.attachMovie("mclip"+i, "mclip"+i, 70+i);
        this["makeClip"+i]["mask"+i].obj.loadMovie(loadTxt.imgURL+loadTxt["img"+i]);
        ++i;
    }
    // end while
    this.onEnterFrame = function() {
        if (!ply) {
            for (var _loc2 = 1; _loc2<=num; ++_loc2) {
                loaded[_loc2] = (this["makeClip"+_loc2]["mask"+_loc2].obj.getBytesLoaded()>=this["makeClip"+_loc2]["mask"+_loc2].obj.getBytesTotal())*100;
               
                if (loaded[_loc2] == 100) {
                    confirm[_loc2] = 1;
                }
                // end if   
                confirmAll = confirmAll+confirm[_loc2];
            }
            // end of for
            if (confirmAll == num) {
                ply = true;
                scaler();
                for (var _loc2 = 1; _loc2<=num; ++_loc2) {
                    MouseEventer(this["line"+_loc2]);
                    this["line"+_loc2].uurl =loadTxt["connURL"+_loc2];
                }
                // end of for
            } else {
                confirmAll = 0;
            }
            // end else if
        } else {
            delete this.onEnterFrame;
        }
        // end else if
    };
}
// End of the function
function MouseEventer(obj) {
    obj.onRollOver = function() {
        down = false;
        aply = true;
        names = this._name.substring(4, 5);
    };

    obj.onRelease = function() {
        //down = true;
        names = this._name.substring(4, 5);
        cc=this.uurl;
        trace(cc);
    };
}
// End of the function
Stage.align = "";
Stage.scaleMode = "noScale";
Stage.showMenu = false;
DataLoader("element.txt");
MovieClip.prototype.mcScaler = function(th, al) {
    var speed = 2.000000E-001;
    this.onEnterFrame = function() {
        this._height = this._height+(th-this._height)*speed;
        this._alpha = this._alpha+(al-this._alpha)*speed;
        if (Math.abs(th-this._height)<1 && Math.abs(al-this._alpha)<4) {
            this._height = th;
            this._alpha = al;
            delete this.onEnterFrame;
        }
        // end if   
    };
};

[ 本帖最后由 marine0516 于 2010-4-24 21:19 编辑 ]
搜索更多相关主题的帖子: Flash 代码 
2010-04-24 21:18
快速回复:求教-哪位大虾帮忙看看这个Flash代码如何修改
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.066100 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved