核心代码

CODE:

    function setBtn() {
        this.attachMovie("btn", "LTbtn", 9001);
        this.LTbtn.num = 1;
        this.LTbtn.onPress = function () {
            if (Btn_num == 0) {
                set_move(-1, -1, this.num);
            }
        };
        this.LTbtn.onRollOver = function () {
            if (Btn_num == 0) {
                set_move(-1, -1, this.num);
            }
        };
        this.LTbtn.onRollOut = function () {
            set_Stop();
        };
        this.LTbtn.onRelease = function () {
            set_move(-1, -1, this.num, 1);
        };
        this.LTbtn.onReleaseOutside = function () {
            set_Stop();
        };
        this.attachMovie("btn", "LBbtn", 9002);
        this.LBbtn.num = 2;
        this.LBbtn.onPress = function () {
            if (Btn_num == 0) {
                set_move(-1, 1, this.num);
            }
        };
        this.LBbtn.onRollOver = function () {
            if (Btn_num == 0) {
                set_move(-1, 1, this.num);
            }
        };
        this.LBbtn.onRollOut = function () {
            set_Stop();
        };
        this.LBbtn.onRelease = function () {
            set_move(-1, 1, this.num, 1);
        };
        this.LBbtn.onReleaseOutside = function () {
            set_Stop();
        };
        this.attachMovie("btn", "RTbtn", 9003);
        this.RTbtn.num = 3;
        this.RTbtn.onPress = function () {
            if (Btn_num == 0) {
                set_move(1, -1, this.num);
            }
        };
        this.RTbtn.onRollOver = function () {
            if (Btn_num == 0) {
                set_move(1, -1, this.num);
            }
        };
        this.RTbtn.onRollOut = function () {
            set_Stop();
        };
        this.RTbtn.onRelease = function () {
            set_move(1, -1, this.num, 1);
        };
        this.RTbtn.onReleaseOutside = function () {
            set_Stop();
        };
        this.attachMovie("btn", "RBbtn", 9004);
        this.RBbtn.num = 4;
        this.RBbtn.onPress = function () {
            if (Btn_num == 0) {
                set_move(1, 1, this.num);
            }
        };
        this.RBbtn.onRollOver = function () {
            if (Btn_num == 0) {
                set_move(1, 1, this.num);
            }
        };
        this.RBbtn.onRollOut = function () {
            set_Stop();
        };
        this.RBbtn.onRelease = function () {
            set_move(1, 1, this.num, 1);
        };
        this.RBbtn.onReleaseOutside = function () {
            set_Stop();
        };
        this.LTbtn._x = (this.LBbtn._x = -_root.mc_width);
        this.RTbtn._x = (this.RBbtn._x = _root.mc_width - 100);
        this.LTbtn._y = (this.RTbtn._y = -(_root.mc_height / 2));
        this.LBbtn._y = (this.RBbtn._y = (_root.mc_height / 2) - 100);
    }
    function BG_img() {
        Bnum = _root.img_num;
        this.attachMovie("img", "Limg" + Bnum, depth++);
        this["Limg" + Bnum].d = -dir;
        this["Limg" + Bnum].num = Bnum;
        this.attachMovie("img", "Rimg" + Bnum, s + 2);
        this["Rimg" + Bnum].d = dir;
        this["Rimg" + Bnum].num = Bnum;
        this.attachMovie("Ls", "LS", depth++);
        this.LS._width = _root.mc_width;
        this.LS._height = _root.mc_height;
        this.LS._x = 0;
        this.attachMovie("Rs", "RS", s + 3);
        this.RS._width = _root.mc_width;
        this.RS._height = _root.mc_height;
        this.RS._x = 0;
    }
    function Left_img() {
        rTnum = _root.img_num - 1;
        this.attachMovie("img", "Limg" + rTnum, s--);
        this["Limg" + rTnum].d = -1;
        this["Limg" + rTnum].num = rTnum;
        this.createEmptyMovieClip("Rimg" + rTnum, depth++);
        this["Rimg" + rTnum].attachMovie("img", "LBimg", 1);
        this["Rimg" + rTnum].LBimg.num = rTnum;
        this["Rimg" + rTnum].LBimg._y = (-((_root.mc_height / 2) + _root.mc_width)) * Ver;
        this["Rimg" + rTnum]._y = ((_root.mc_height / 2) + _root.mc_width) * Ver;
        this["Rimg" + rTnum]._rotation = -90 * Ver;
    }
    function Right_img() {
        Tnum = _root.img_num + 1;
        this.attachMovie("img", "Rimg" + Tnum, s--);
        this["Rimg" + Tnum].num = Tnum;
        this["Rimg" + Tnum].d = 1;
        this.createEmptyMovieClip("Limg" + Tnum, depth++);
        this["Limg" + Tnum].attachMovie("img", "RBimg", 1);
        this["Limg" + Tnum].RBimg.num = Tnum;
        this["Limg" + Tnum].RBimg.d = -1;
        this["Limg" + Tnum].RBimg._y = (-((_root.mc_height / 2) + _root.mc_width)) * Ver;
        this["Limg" + Tnum]._y = ((_root.mc_height / 2) + _root.mc_width) * Ver;
        this["Limg" + Tnum]._rotation = 90 * Ver;
    }
    function varNum() {
        Pnum = _root.img_num - 1;
        Cnum = _root.img_num;
        Nnum = _root.img_num + 1;
    }
    function set_Shadow() {
        h = Math.sqrt((_root.mc_width * _root.mc_width) + (_root.mc_height * _root.mc_height));
        this.createEmptyMovieClip("TLshadow", 8205);
        this.TLshadow._y = _root.mc_width + (_root.mc_height / 2);
        this.TLshadow._rotation = 45;
        this.TLshadow.duplicateMovieClip("TRshadow", 8206);
        this.TLshadow.attachMovie("Ls", "LS", 1);
        this.TLshadow.LS._width = _root.mc_width;
        this.TLshadow.LS._height = h;
        this.TLshadow.LS._x = 0;
        this.TLshadow.LS._y = -(_root.mc_width + (h / 2));
        this.TRshadow.attachMovie("Rs", "RS", 2);
        this.TRshadow.RS._width = _root.mc_width;
        this.TRshadow.RS._height = h;
        this.TRshadow.RS._x = 0;
        this.TRshadow.RS._y = -(_root.mc_width + (h / 2));
    }
    function set_Mask() {
        this.attachMovie("mask", "RB_Mask", 8114);
        this.RB_Mask._width = (this.RB_Mask._height = (_root.mc_height * 2) + 100);
        this.RB_Mask._y = (_root.mc_height / 2) + _root.mc_width;
        this.RB_Mask._rotation = -135;
        this.RB_Mask.duplicateMovieClip("LB_mask", 8113);
        this.RB_Mask.duplicateMovieClip("RT_mask", 8112);
        this.RB_Mask.duplicateMovieClip("LT_mask", 8111);
        this.RB_Mask.duplicateMovieClip("BS_mask", 8110);
        this.attachMovie("mask", "H_Mask", 8115);
        this.H_Mask._width = _root.mc_width;
        this.H_Mask._height = _root.mc_height;
        this.H_Mask._y = (-_root.mc_height) / 2;
        this.createEmptyMovieClip("W_Mask", 8116);
        this.W_Mask.attachMovie("mask", "wm", 1);
        this.W_Mask.wm._width = _root.mc_width;
        this.W_Mask.wm._height = _root.mc_height;
        this.W_Mask.wm._x = -_root.mc_width;
        this.W_Mask.wm._y = -(_root.mc_height + _root.mc_width);
        this.W_Mask._y = (_root.mc_height / 2) + _root.mc_width;
        this.W_Mask._rotation = 90;
    }
    function reMask() {
        varNum();
        if (_root.img_num < 2) {
            this.LT_Mask._visible = 0;
            this.LB_Mask._visible = 0;
        } else {
            this.LT_Mask._visible = 1;
            this.LB_Mask._visible = 1;
         }
        if (_root.img_num == _root.img_ea) {
            this.RT_Mask._visible = 0;
            this.RB_Mask._visible = 0;
        } else {
            this.RT_Mask._visible = 1;
            this.RB_Mask._visible = 1;
         }
        if (preEvent == true) {
            if (mDir == "f") {
                this.RB_Mask._visible = 0;
            } else if (mDir == "b") {
                this.LB_Mask._visible = 0;
            }
        }
        this["Limg" + Nnum].setMask(this.RB_Mask);
        this["Rimg" + Pnum].setMask(this.LB_Mask);
        if (dir == 1) {
            this.LT_Mask._visible = 0;
            this.RT_Mask._visible = 1;
            this.H_Mask._x = 0;
            if (preEvent == true) {
                this["Rimg" + CCnum].setMask(this.RT_Mask);
            } else {
                this["Rimg" + Cnum].setMask(this.RT_Mask);
             }
            this.TLshadow.setMask(this.W_Mask);
            this.TRshadow.setMask(this.H_Mask);
            this.RS.setMask(BS_mask);
        } else if (dir == -1) {
            this.RT_Mask._visible = 0;
            this.LT_Mask._visible = 1;
            this.H_Mask._x = -_root.mc_width;
            if (preEvent == true) {
                this["Limg" + CCnum].setMask(this.LT_Mask);
            } else {
                this["Limg" + Cnum].setMask(this.LT_Mask);
             }
            this.TLshadow.setMask(this.H_Mask);
            this.TRshadow.setMask(this.W_Mask);
            this.LS.setMask(BS_mask);
        }
    }
    function img_Move() {
        var mc_x = (((((-dir) * _xmouse) + _root.mc_width) + 10) / (_root.mc_width * 2));
        if (onMove == 1) {
            MX = MX - ((MX - 1.01) * 0.2);
        } else if (mcMove) {
            MX = MX - ((MX - mc_x) * 0.5);
        } else if (MX > 0.666666666666667) {
            MX = MX - ((MX - 1.01) * 0.15);
        } else {
            MX = MX - ((MX + 0.05) * 0.12);
         }
        if ((MX > 0.5) and Psound) {
            soundMC.start(0);
            Psound = false;
        }
        var c;
        if (Ver == 1) {
            c = 20 - Math.round((MX / 1) * 26);
        } else {
            c = 15 - Math.round((MX / 0.3) * 15);
         }
        if (c <= 0) {
            c = 1;
        }
        if (dir == 1) {
            if (this["Rimg" + Cnum].Ton == 1) {
                this["Rimg" + Cnum].textBG.gotoAndStop(c);
            } else if (this["Rimg" + Cnum].LBimg.Ton == 1) {
                this["Rimg" + Cnum].LBimg.textBG.gotoAndStop(c);
            }
        }
        if (MX <= 0) {
            MX = 0;
            if (dir == 1) {
                this["Limg" + Nnum]._rotation = 90 * Ver;
            } else if (dir == -1) {
                this["Rimg" + Pnum]._rotation = 90 * Ver;
            }
            if (!mcMove) {
                viewBtn();
                delete this.onEnterFrame;
            }
        } else if (MX >= 1) {
            MX = 1;
            if (dir == 1) {
                this["Limg" + Nnum]._rotation = 0;
            } else if (dir == -1) {
                this["Rimg" + Pnum]._rotation = 0;
            }
            if (!mcMove) {
                delete this.onEnterFrame;
                MX = 0;
                if (preEvent == true) {
                    this["Limg" + CCnum].removeMovieClip();
                    this["Rimg" + CCnum].removeMovieClip();
                } else {
                    this["Limg" + Cnum].removeMovieClip();
                    this["Rimg" + Cnum].removeMovieClip();
                 }
                if (dir == 1) {
                    this.LS.swapDepths(depth++);
                    if (preEvent == true) {
                        this["Limg" + PPnum].removeMovieClip();
                        this["Rimg" + PPnum].removeMovieClip();
                    } else {
                        this["Limg" + Pnum].removeMovieClip();
                        this["Rimg" + Pnum].removeMovieClip();
                     }
                    if (_root.img_num < _root.img_ea) {
                        _root.img_num++;
                    }
                    if (_root.img_num != _root.img_ea) {
                        Right_img();
                    }
                    Left_img();
                    this["Rimg" + Nnum].textBG.gotoAndPlay(2);
                } else if (dir == -1) {
                    this.RS.swapDepths(depth++);
                    if (preEvent == true) {
                        this["Limg" + NNnum].removeMovieClip();
                        this["Rimg" + NNnum].removeMovieClip();
                    } else {
                        this["Limg" + Nnum].removeMovieClip();
                        this["Rimg" + Nnum].removeMovieClip();
                     }
                    if (_root.img_num >= 1) {
                        _root.img_num--;
                    }
                    if (_root.img_num != 0) {
                        Left_img();
                    }
                    Right_img();
                    this["Rimg" + Pnum].LBimg.textBG.gotoAndPlay(2);
                }
                this._parent.preView.bottom.char = (_root.img_num + "/") + _root.img_ea;
                this._parent.preView.bg.ibg.Onum = _root.img_num;
                viewBtn();
                reMask();
                Psound = true;
                if (_root.img_num < _root.preView.Fnum) {
                    if (_root.img_num != 0) {
                        _root.preView.MCreatImg(1);
                    }
                } else if (_root.img_num > ((_root.preView.Fnum + _root.view_ea) - 1)) {
                    if (_root.img_num != 0) {
                        _root.preView.MCreatImg(-1);
                    }
                }
            }
        }
        if (dir == 1) {
            this.TLshadow._rotation = (this.TRshadow._rotation = (45 * Ver) - ((45 * MX) * Ver));
            this.RB_Mask._rotation = (this.RT_Mask._rotation = (this.BS_mask._rotation = (-135 + ROT) - ((45 * MX) * Ver)));
            this["Limg" + Nnum]._rotation = (this.W_Mask._rotation = (90 * Ver) - ((90 * MX) * Ver));
        } else if (dir == -1) {
            this.TLshadow._rotation = (this.TRshadow._rotation = (-(45 * Ver)) + ((45 * MX) * Ver));
            this.LB_Mask._rotation = (this.LT_Mask._rotation = (this.BS_mask._rotation = (-135 - ROT) + ((45 * MX) * Ver)));
            this["Rimg" + Pnum]._rotation = (this.W_Mask._rotation = (-(90 * Ver)) + ((90 * MX) * Ver));
        }
    }
    function set_Stop() {
        mcMove = false;
        this.LBbtn._visible = (this.LTbtn._visible = (this.RBbtn._visible = (this.RTbtn._visible = 0)));
    }
    function set_Move(par, Vpar, b_num, onM, imgBtn) {
        var av;
        Btn_num = b_num;
        if ((Btn_num % 2) == 0) {
            av = 2;
        } else {
            av = 1;
         }
        ROT = 180 * av;
        if (onM == 1) {
            onMove = onM;
            mcMove = false;
            this.LBbtn._visible = (this.LTbtn._visible = (this.RBbtn._visible = (this.RTbtn._visible = 0)));
        } else {
            mcMove = true;
            if (this.LBbtn.num != b_num) {
                this.LBbtn._visible = 0;
            }
            if (this.LTbtn.num != b_num) {
                this.LTbtn._visible = 0;
            }
            if (this.RBbtn.num != b_num) {
                this.RBbtn._visible = 0;
            }
            if (this.RTbtn.num != b_num) {
                this.RTbtn._visible = 0;
            }
         }
        var ddr = dir;
        var vvr = Vpar;
        dir = par;
        if (((par != ddr) or (Vpar != Ver)) or (imgBtn == 1)) {
            reMask();
            re_xy(Vpar);
        }
        this.onEnterFrame = function () {
            img_move();
        };
    }
    function viewBtn() {
        onMove = 0;
        Btn_num = 0;
        preEvent = false;
        if (_root.img_num == 0) {
            this.LBbtn._visible = 0;
            this.LTbtn._visible = 0;
        } else {
            this.LBbtn._visible = 1;
            this.LTbtn._visible = 1;
         }
        if (_root.img_num == _root.img_ea) {
            this.RBbtn._visible = 0;
            this.RTbtn._visible = 0;
        } else {
            this.RBbtn._visible = 1;
            this.RTbtn._visible = 1;
         }
    }
    function re_xy(p) {
        Ver = p;
        this.RB_Mask._y = (this.RT_Mask._y = (this.LB_Mask._y = (this.LT_Mask._y = (this.BS_mask._y = ((_root.mc_height / 2) + _root.mc_width) * Ver))));
        this.TLshadow._y = (this.TRshadow._y = (_root.mc_width + (_root.mc_height / 2)) * Ver);
        this.TLshadow.LS._y = (this.TRshadow.RS._y = (-(_root.mc_width + (h / 2))) * Ver);
        if (Ver == 1) {
            this.W_Mask.wm._y = -(_root.mc_width + _root.mc_height);
        } else {
            this.W_Mask.wm._y = _root.mc_width;
         }
        this.W_Mask._y = ((_root.mc_height / 2) + _root.mc_width) * Ver;
        if (dir == 1) {
            if (preEvent == false) {
                this["Rimg" + Pnum]._rotation = (this.W_Mask._rotation = -90 * Ver);
                this["Rimg" + Pnum]._y = ((_root.mc_height / 2) + _root.mc_width) * Ver;
                this["Rimg" + Pnum].LBimg._y = (-((_root.mc_height / 2) + _root.mc_width)) * Ver;
            }
            this["Limg" + Nnum]._rotation = (this.W_Mask._rotation = 90 * Ver);
            this["Limg" + Nnum]._y = ((_root.mc_height / 2) + _root.mc_width) * Ver;
            this["Limg" + Nnum].RBimg._y = (-((_root.mc_height / 2) + _root.mc_width)) * Ver;
            this.W_Mask.wm._x = -_root.mc_width;
            this.LB_Mask._rotation = (this.LT_Mask._rotation = (this.RB_Mask._rotation = (this.RT_Mask._rotation = (this.BS_mask._rotation = -135 + ROT))));
            this.TLshadow._rotation = (this.TRshadow._rotation = 45 * Ver);
        } else {
            if (preEvent == false) {
                this["Limg" + Nnum]._rotation = (this.W_Mask._rotation = 90 * Ver);
                this["Limg" + Nnum]._y = ((_root.mc_height / 2) + _root.mc_width) * Ver;
                this["Limg" + Nnum].RBimg._y = (-((_root.mc_height / 2) + _root.mc_width)) * Ver;
            }
            this["Rimg" + Pnum]._rotation = (this.W_Mask._rotation = -90 * Ver);
            this["Rimg" + Pnum]._y = ((_root.mc_height / 2) + _root.mc_width) * Ver;
            this["Rimg" + Pnum].LBimg._y = (-((_root.mc_height / 2) + _root.mc_width)) * Ver;
            this.W_Mask.wm._x = 0;
            this.RB_Mask._rotation = (this.RT_Mask._rotation = (this.LB_Mask._rotation = (this.LT_Mask._rotation = (this.BS_mask._rotation = -135 - ROT))));
            this.TLshadow._rotation = (this.TRshadow._rotation = -45 * Ver);
         }
    }
    function preVeiw_evnet(parNum) {
        preEvent = true;
        PPnum = Pnum;
        CCnum = Cnum;
        NNnum = Nnum;
        this["Limg" + Pnum].removeMovieClip();
        this["Rimg" + Pnum].removeMovieClip();
        this["Limg" + Nnum].removeMovieClip();
        this["Rimg" + Nnum].removeMovieClip();
        if (_root.img_num > parNum) {
            mDir = "f";
            _root.img_num = parNum + 1;
            Left_img();
            set_move(-1, 1, 0, 1, 1);
        } else {
            mDir = "b";
            _root.img_num = parNum - 1;
            Right_img();
            set_move(1, 1, 0, 1, 1);
         }
    }
    depth = 5000;
    s = 2000;
    dir = 1;
    Ver = 1;
    preEvent = false;
    step = 0.02;
    mcMove = false;
    Btn_num = 0;
    onMove = 0;
    Psound = true;
    soundMC = new Sound ();
    soundMC.attachSound("Esound");
    soundMC.setVolume(100);
    BG_img();
    stop();
posted on 2008-11-27 04:56  睿达团队  阅读(1091)  评论(2编辑  收藏  举报