Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Nany GTD

Alterar AS de uma galeria de fotos

Recommended Posts

Olá! Estou estreiando hoje aqui no fórum do iMasters http://forum.imasters.com.br/public/style_emoticons/default/grin.gif

 

Bom, fiz o download de uma galeria de fotos neste link, porém, gostaria de alterar uns valores, para que a animação, o movimento, ficasse mais lento e mais leve.

 

O código é esse:

 

CODE
dynamic class Kallery

{

private var xmlData:XML;

function Kallery(xmlLocation)

{

_root.kallery = this;

 

var kalleryMC:MovieClip3D = new MovieClip3D();

kalleryMC.base.useHandCursor = false;

kalleryMC.base.beginFill(0x000000, 1);

kalleryMC.base.moveTo(0,0);

kalleryMC.base.lineTo(550,0);

kalleryMC.base.lineTo(550,400);

kalleryMC.base.lineTo(0,400);

kalleryMC.base.lineTo(0,0);

kalleryMC.base.endFill();

_root.kalleryMC = kalleryMC;

 

trace("Loading XML (" + xmlLocation + ")");

//## XML Loading

xmlData = new XML();

xmlData.ignoreWhite = true;

xmlData.onLoad = this.OnXMLLoad;

xmlData.load(xmlLocation);

trace("Kallery initialized.");

_root.hideImage = function(){

_root.activeThumb.ZIndexAddition = 0;

_root.activeImageContainer.base.removeMovieClip();

delete _root.activeImageContainer;

_root.imageActive = false;

for (var idx:Number = 0; idx < _root.thumbnails.length; idx++){

_root.thumbnails[idx].Z = 0;

}

_root.activeThumb.HidePreloader();

}

_root.ShowLoadedPicture = function(){

var iW:Number = _root.activeImage.thumbContainerImage._width;

var iH:Number = _root.activeImage.thumbContainerImage._height;

var padding:Number = 100;

if (iW > iH){

var scale:Number = (550 - padding) / iW;

iW *= scale;

iH *= scale;

}else{

var scale:Number = (400 - padding) / iH;

iW *= scale;

iH *= scale;

}

_root.activeImageContainer._X = 550 / 2 - iW / 2;

_root.activeImageContainer._Y = 400 / 2 - iH / 2;

_root.activeImage.width = iW;

_root.activeImage.height = iH;

_root.activeImage.DrawBorders();

 

_root.activeImageContainer.ZIndexAddition = 5000;

_root.activeImageContainer.ZIndexMultiplier = 2;

_root.activeImageContainer.Z = 0;

_root.activeImageContainer.ZBlurAddition = -4;

for (var idx:Number = 0; idx < _root.thumbnails.length; idx++){

_root.thumbnails[idx].Z = 10;

}

_root.activeThumb.Z = -5;

_root.loadHandler.removeMovieClip();

_root.activeImageContainer.base._visible = true;

clearInterval(_root.redrawInterval);

}

}

function ShowPicture(parentThumbnail:Thumbnail){

var imageBoxContainer:MovieClip3D = new MovieClip3D();

var imageBox:ImageBox = new ImageBox(parentThumbnail.BigImageURL, 300, 400, imageBoxContainer.base);

imageBoxContainer.base._visible = false;

_root.activeImageContainer = imageBoxContainer;

_root.activeThumb = parentThumbnail;

_root.activeThumb.ZIndexAddition = 1000;

_root.activeImage = imageBox;

_root.imageActive = true;

_root.activeImageContainer._Location = new Location3D(0, 0, 200);

imageBoxContainer.base.onPress = _root.hideImage;

var loadHandler:MovieClip = _root.createEmptyMovieClip("loadHandler", _root.getNextHighestDepth());

loadHandler.onEnterFrame = function(){

if (_root.activeImage.thumbContainerImage.getBytesTotal() == null || _root.activeImage.thumbContainerImage.getBytesTotal() == 0) return;

var percentage:Number = _root.activeImage.thumbContainerImage.getBytesLoaded() / _root.activeImage.thumbContainerImage.getBytesTotal();

if (percentage >= 1){

_root.activeThumb.ShowLoadingProgress(100);

_root.redrawInterval = setInterval(_root.ShowLoadedPicture, 400);

delete loadHandler.onEnterFrame;

return;

}

_root.activeThumb.ShowLoadingProgress(percentage * 100);

}

imageBox.BeginLoad();

}

function OnXMLLoad(success):Void{

trace("XML loaded.");

if (!success){ trace("Unable to load XML!"); return; }

var thumbMargin = 10;

var thumbSize = {Width: 64, Height: 64};

var rows = Math.ceil(this.firstChild.childNodes.length / 5);

var cols = Math.min(5, this.firstChild.childNodes.length);

var xLocationStart = Location3D.CenterStage.X - thumbSize.Width * cols / 2 - thumbMargin * (cols - 1) / 2;

var yLocationStart = Location3D.CenterStage.Y - thumbSize.Height * rows / 2 - thumbMargin * (rows - 1) / 2;

var xLocation = xLocationStart;

var yLocation = yLocationStart;

_root.thumbnails = [];

for (var idx:Number = 0; idx < this.firstChild.childNodes.length; idx++){

if (idx % 5 == 0 && idx != 0) { xLocation = xLocationStart; yLocation += thumbSize.Height + thumbMargin; }

var photoBigPath:String = this.firstChild.childNodes[idx].attributes.image;

var photoThumbPath:String = this.firstChild.childNodes[idx].attributes.thumb;

trace("Loading thumbnail " + photoThumbPath);

_root.thumbnails.push(new Thumbnail(photoThumbPath, photoBigPath));

var i = _root.thumbnails.length - 1;

_root.thumbnails._Location = new Location3D(

xLocation,

yLocation,

200 - random(100)

);

_root.thumbnails.Z = 1;

_root.thumbnails.imageBox.BeginLoad();

xLocation += thumbSize.Width + thumbMargin;

}

}

}

 

Gostaria de saber também, se no arquivo xml, tem como colocar descrição ou título da foto.

 

No xml tem apenas isso:

 

<?xml version="1.0" ?>

<photos>

<photo image="1.jpg" thumb="1thumb.jpg" />

</photos>

 

Obrigada!!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.