// copyright by webstudio.com.cn.author by egoldy.2006.1.14
//初始化起始位置.
Stage.scaleMode="noScale"
System.useCodepage=true;
var x = 3;
var y = 3;
// 设定图像的水平和竖向间距位置.图像的宽为100*75.间隔为5
var hspace = 105;
var vspace = 80;
// 列和行数,以列为主.
var num_columnas = 3;
var num_rows=3;
//定义分页变量
var pages;
// 初始xml
myXML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success) {
if (success) {
//创建一个空影片用于装载所有内容.
_root.createEmptyMovieClip("mycont",0);
//设定遮罩.及它的宽高.
mycont.setMask(mask_mc);
mask_mc._width=hspace*num_columnas;
mask_mc._height=vspace*num_rows;
// xml结点轮徇
for (var i = 0; i < this.firstChild.childNodes.length; i++) {
//计算出页数多少
pages=Math.ceil(i/(num_columnas*num_rows));
trace(pages);
//xml节点付值
var thumb = this.firstChild.childNodes[i].attributes.id;
var holder_mc = mycont.createEmptyMovieClip("holder_mc" + i, i + 100);
var item = holder_mc.createEmptyMovieClip("butx" + i, i + 100);
item.loadMovie(thumb);
// 初始化holder_mc的位置
holder_mc._x = x;
holder_mc._y = y;
// 可以分配变量给holder_mc,如果有的话
holder_mc.url = this.firstChild.childNodes[i].attributes.url;
holder_mc.onRelease = function() {
getURL(this.url);
};
// holder_mc的x方向排列
x += hspace;
// 定义临时列数.
var columna;
columna += 1;
// 控制列数,如果临时列数与我们初定义的相同,每排完3个后向左移(hspace*num_columnas),
//y方向直接向下增加即可.
if (columna == num_columnas) {
columna = 0;
x -= (hspace * num_columnas);
y += vspace;
}
//显示页号
if(pages>0){
for(var j=0;j
var pag=_root.attachMovie("page_btn","pag"+j,j+100);
trace(pag);
trace(pages);
pag._x = 5+j*30;
pag._y = 260;
//指定一个id.是为了后面移动holder_mc准备
pag.id = j;
//按钮文字
pag.info.text = j+1;
pag.onPress = function() {
//设定按钮状态
setButtons(pages, this.id)
//移动mycont,实现翻页.
mycont._y=-(this.id*(num_rows*vspace));
}
}
}
}
}
};
myXML.load("http://www.webstudio.com.cn/wsswf/f...ge/imagenes.xml");
//设定按钮状态函数
function setButtons(tot, q) {
for (var i = 0; i<=tot; i++) {
var but = this["pag"+i];
if (i != q) {
but.gotoAndStop(1);
but.enabled = 1;
} else {
but.gotoAndStop(2);
but.enabled = 0;
}
}
}