佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1017|回复: 2

auto resize 求助。

[复制链接]
nx 该用户已被删除
发表于 19-9-2006 11:56 AM | 显示全部楼层 |阅读模式
各位高手,

本人在编辑FLASH ACTIONSCRIPT 时遇上了问题。想请各位帮忙。

是这样的。本人使用了AUTO RESIZE FUNTION & SETINTERVAL 来 DISPLAY 一系列的图片。 OFFLINE 时, 它是没问题的。当搬上网时, 问题就出现了。

本人的 SCRIPT 是每5秒跳下一张图片。 当般上网时, 还没 LOAD 完一张图片, 它就跳下一张。  我知道需要一个 PRELOADER 来
DETECT 每一张图片的 LOADING TIME。 但是, 我的问题是要怎么使用?

CODING 如以下。 希望各位可以给些意见。

spacing = 10;
containerMC._alpha = 0;
var pArray = new Array();
var tArray = new Array();

function slideshow() {
        if (cur == 0) {
                containerMC.loadPic(pArray.length-1);
        } else {
                containerMC.loadPic(0);
        }
}
setInterval(slideshow, 2000);

MovieClip.prototype.loadPic = function(pic) {
        containerMC._alpha = 0;
        cur = pic;
        this.loadMovie(pArray[pic]);
        this._parent.onEnterFrame = function() {
                var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
                if (t != 0 && Math.round(l/t) == 1 && containerMC._width>0) {
                        var w = containerMC._width+spacing, h = containerMC._height+spacing;
                        border.resizeMe(w, h, pic);
                        delete this._parent.onEnterFrame;
                }
        };
};
MovieClip.prototype.resizeMe = function(w, h, pic) {
        var speed = 3;
        this.onEnterFrame = function() {
                this._width += (w-this._width)/speed;
                this._height += (h-this._height)/speed;
                nav._x = Math.round(this._x-this._width/2);
                nav._y = Math.round(this._y+this._height/2+spacing/2);
                //prevb._x = nav._x-5;
                //nextb._x = nav._x+this._width+5;
                //nextb._y = prevb._y=this._y-this._height/2;
                //picinfo._y = nextb._y-5;
                //picinfo.info.text = tArray[pic];
                //picinfo._x = border._x-picinfo._width/2;
                if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
                        this._width = w;
                        this._height = h;
                        containerMC._x = this._x-this._width/2+spacing/2;
                        containerMC._y = this._y-this._height/2+spacing/2;
                        containerMC._alpha = 100;
                        delete this.onEnterFrame;
                }
        };
};
var gallery_xml = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success) {
        if (success) {
                var gallery = this.firstChild;
                // pathToPics = gallery.attributes.path;
                for (var i = 0; i<gallery.childNodes.length; i++) {
                        tArray.push(gallery.childNodes.attributes.title);
                        pArray.push(gallery.childNodes.attributes.source);
                }
                loadPhoto();
        } else {
                title_txt.text = "Error!";
        }
};
gallery_xml.load("gallery.xml");
/*prevb.onRelease = function() {
        if (cur == 0) {
                containerMC.loadPic(pArray.length-1);
        } else {
                containerMC.loadPic(cur-1);
        }
};
nextb.onRelease = function() {
        if (cur == pArray.length-1) {
                containerMC.loadPic(0);
        } else {
                containerMC.loadPic(cur+1);
        }
};*/
回复

使用道具 举报


ADVERTISEMENT

发表于 21-9-2006 07:18 PM | 显示全部楼层
用MovieClipLoader載入圖片完畢后才使用setTimeout計算5秒后再載入下一張吧
回复

使用道具 举报

nx 该用户已被删除
 楼主| 发表于 22-9-2006 10:03 AM | 显示全部楼层
WOW, 感谢回复。很好的建议, 让我试一试。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-9-2024 07:21 PM , Processed in 0.109760 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表