Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá bom dia,entreguei um site para um cliente onde suas galerias tem a movimentação dos thumbs com o movimento do mouse, porém só após a entrega <_< foi que o cliente foi fazer o teste com o seu tablet, já que é ilustrador, e decidiu que não queria mais a galeria daquele jeito... Bom por não lembrar nem querer pesquisar eu comprei uma galeria que faz a movimentação dos thumbs através dos botõezinhos superior e inferior, e fiz as moficações que ele precisa que são os thumbs sempre a esquerda e a imagem sempre centralizada, até aí ok. O problema é que não consigo nem sei onde está o comando para centralizar a primeira imagem que carrega a galeria do xml, centraliza apenas após clicar em outras imgs... Alguem pode me ajudar?
Este é o link que publiquei para teste: Link teste
Segue abaixo o AS para conferir:
// The thumbnails are on the left side
Stage.scaleMode = "noScale";
Stage.align = "TL";
stop();
// The following is for the thumbnails and big image
var myXML2:XML = new XML();
myXML2.ignoreWhite = true;
myXML2.load("gallery.xml");
var thumbPath:Array = Array();
var picPath:Array = Array();
var link:Array = Array();
var txt:Array=Array();
_root.gapH = 7.25;
// horizontal space
myXML2.onLoad = function(success) {
displayPage();
};
function displayPage() {
var originY = 22.5;
delete rightBtn.onEnterFrame;
delete leftBtn.onEnterFrame;
xml = myXML2.firstChild;
var numberOfItems:Number = xml.childNodes.length;
var numberPerScreen =9; // Qtde de icones que roda por vez ao clicar nos botões
var integer:Number = Math.floor(numberOfItems/numberPerScreen);
var remainder:Number = numberOfItems%10;
var maxRightClickTime:Number = 0;
//if total imgs over 10
if (remainder == 0) {
maxRightClickTime = integer-1;
} else {
maxRightClickTime = integer;
}
var leftClickTime:Number = 0;
var rightClickTime:Number = 0;
var currentTarget:Number = 0;
leftBtn._visible = false;
//if total imgs less than 10 or equal 10
if (numberOfItems<=numberPerScreen) {
rightBtn._visible = false;
} else {
rightBtn._visible = true;
}
currentTarget = 0;
rightBtn.onRelease = function() {
leftBtn._visible = true;
rightClickTime++;
if (rightClickTime == maxRightClickTime) {
rightBtn._visible = false;
}
currentTarget = originY-(mask._height+_root.gapH)*rightClickTime;
this.onEnterFrame = function() {
diff = currentTarget-mc_thumbnail._y;
mc_thumbnail._y += diff/4;
};
};
leftBtn.onRelease = function() {
rightBtn._visible = true;
rightClickTime--;
leftClickTime++;
if (rightClickTime == 0) {
leftBtn._visible = false;
}
currentTarget = originY-(mask._height+_root.gapH)*rightClickTime;
this.onEnterFrame = function() {
diff = currentTarget-mc_thumbnail._y;
mc_thumbnail._y += diff/4;
};
};
for (var i = 0; i<numberOfItems; i++) {
thumbPath* = xml.childNodes**.childNodes[0].childNodes[0].nodeValue;*
picPath = xml.childNodes.childNodes[1].childNodes[0].nodeValue;
link = xml.childNodes.childNodes[2].childNodes[0].nodeValue;
txt=xml.childNodes.childNodes[3].childNodes[0].nodeValue;
mc_thumbnail.img.duplicateMovieClip("img"+i, i);
mc_thumbnail["img"+i]._y = mc_thumbnail.img._y+i(mc_thumbnail.img._height+_root.gapH);*
//trace(mc_thumbnail["img"+i]._y);
* if (thumbPath** == "undefined") {*
mc_thumbnail["img"+i].enabled = false;
} else {
mc_thumbnail["img"+i].enabled = true;
* mc_thumbnail["img"+i].img_mc.loadMovie(thumbPath**);*
}
* mc_thumbnail["img"+i].thePicPath = picPath**;*
* mc_thumbnail["img"+i].theLinkURL = link**;*
* mc_thumbnail["img"+i].txt = txt**;*
}
mc_thumbnail.img._visible=false;
//load the first big image
getFirst(picPath[0]);
}
//for loading first big image
function getFirst(thePicPath:String,link:String, txt:String) {
_root.theBigImageContainer = _root.main.big_mc.big_mc_image;
_root.theBigImageContainer.loadMovie(thePicPath);
_root.theBigImageContainer._alpha = 0;
this.a_mc.onEnterFrame = function() {
if (_root.theBigImageContainer.getBytesLoaded()==_root.theBigImageContainer.getBytesTotal() && _root.theBigImageContainer.getBytesTotal()!=4) {
delete _root.main.a_mc.onEnterFrame;
//_root.main.changeColor();
// inseri as linhas abaixo para que a primeira imagem sempre fique alinhada no centro - mas não funcionou
loading._x = Stage.width/2;
loading._y = Stage.height/2;
// inseri esta linha para que a primeira imagem sempre fique alinhada no centro
_root.theBigImageContainer._x = Stage.width/2 - _root.theBigImageContainer._width/2 ;
_root.theBigImageContainer._y = Stage.height/2 - _root.theBigImageContainer._height/2 ;
_root.theBigImageContainer._alpha = 100;
}
};
_root.main.big_mc.onRelease = function() {
getURL(link, "_blank");
};
if (link == undefined) {
_root.main.big_mc.enabled = false;
} else {
_root.main.big_mc.enabled = true;
}
}
// Determinando nova posição ao redimensionamento do palco
*var stageResize:Object = new Object();*
*stageResize.onResize = function() {*
loading._x = Stage.width/2;
loading._y = Stage.height/2;
_root.theBigImageContainer._x = Stage.width/2 - _root.theBigImageContainer._width/2 ;
_root.theBigImageContainer._y = Stage.height/2 - _root.theBigImageContainer._height/2 ;
}
// A linha inferior é obrigatoria para a função resize rodar corretamente
Stage.addListener(stageResize);
function changeColor():Void {
var colorComponent:Number = 500;
* onEnterFrame = function () {*
* myColor = new Color(_root.main.big_mc.big_mc_image);*
* myColTr = new Object();*
colorComponent += (100-colorComponent)/10;
myColTr = {ra:colorComponent, ga:colorComponent, ba:colorComponent};
myColor.setTransform(myColTr);
if (Math.round(colorComponent) == 100) {
delete this.onEnterFrame;
colorComponent=500;
}
loading._x = Stage.width/2;
loading._y = Stage.height/2;
// inseri esta linha para que a primeira imagem sempre fique alinhada no centro
_root.theBigImageContainer._x = Stage.width/2 - _root.theBigImageContainer._width/2 ;
_root.theBigImageContainer._y = Stage.height/2 - _root.theBigImageContainer._height/2 ;
};
}
Obrigadão !
Nenhuma ajuda???? :huh:
Carregando comentários...