Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/04/2008, 12:46
olaketal
 
Fecha de Ingreso: abril-2008
Mensajes: 7
Antigüedad: 10 años, 5 meses
Puntos: 0
Ayuda con ActionScript!

Muy buenas.

A ver si algún experto en programación flash puede echarme un cablecito.

He adquirido un documento que es una galería de fotos y lo quero incorporar a una web. La página es completamente en flash y consta de un flash principal (index) que carga otro flash (donde está el menú) y en este segundo se cargan las secciones.

Pues bien, resulta que la programación de la galería está echa desde la raíz por lo que al ser una película incrustada no carga bien. Tocando un poquito (básicamente cambiando _roots por _parents) he logrado hasta que me cargen los thumbnails y la primera foto.

A ver si algun alma cándida puede echarle un vistazo al código y me dice qué me falla. Mil gracias.

PD: toda la programación está dentro de una instancia llamada "main".

Cita:
largeImageBlur.onRelease = function () {}
largeImageBlur.useHandCursor=0;

//The following is for general settings:
var generalXML:XML = new XML();
generalXML.ignoreWhite = true;
var theXMl:String = "./general3.xml";
if (_parent.flashVars != undefined ) {
theXMl = _parent.flashVars;
}
generalXML.load(theXMl);
generalXML.onLoad = loadGeneralXML;
function loadGeneralXML(loaded) {
if (loaded) {
theRootNode = this.firstChild;
stageBackgroundColor = theRootNode.childNodes[0].childNodes[0].nodeValue;
_root.thumbnailEffect = theRootNode.childNodes[1].childNodes[0].nodeValue;
_parent.largeImageEffect = theRootNode.childNodes[2].childNodes[0].nodeValue;
rightBtn.theColor = leftBtn.theColor = theRootNode.childNodes[3].childNodes[0].nodeValue;
rightBtn.theRolloverColor = leftBtn.theRolloverColor =theRootNode.childNodes[4].childNodes[0].nodeValue;





// left button
myColor = new Color(leftBtn);
myColor.setRGB("0x"+leftBtn.theColor);
arrowBgLeft.onRollOver = function () {
myColor=new Color(leftBtn);
myColor.setRGB("0x"+leftBtn.theRolloverColor);
}
arrowBgLeft.onRollOut = function () {
myColor=new Color(leftBtn);
myColor.setRGB("0x"+leftBtn.theColor);
}

// right button
myColor = new Color(rightBtn);
myColor.setRGB("0x"+rightBtn.theColor);

arrowBgRight.onRollOver = function () {
myColor=new Color(rightBtn);
myColor.setRGB("0x"+rightBtn.theRolloverColor);
}
arrowBgRight.onRollOut = function () {
myColor=new Color(rightBtn);
myColor.setRGB("0x"+rightBtn.theColor);
}


// big background
myColor = new Color(bigBg);
myColor.setRGB("0x"+stageBackgroundColor);



}
}

// The following is for the thumbnails and big image
var myXML2:XML = new XML();
myXML2.ignoreWhite = true;
myXML2.load("./gallery3.xml");
var thumbPath:Array = Array();
var picPath:Array = Array();
var link:Array = Array();

_parent.gapH = 17;
// horizontal space
myXML2.onLoad = function(success) {
displayPage();
};

function displayPage() {
mc_thumbnail._x=0;
delete rightBtn.onEnterFrame;
delete leftBtn.onEnterFrame;

xml = myXML2.firstChild;
var numberOfItems:Number = xml.childNodes.length;
var numberPerScreen = 6;
var integer:Number = Math.floor(numberOfItems/numberPerScreen);

var remainder:Number = numberOfItems%numberPerScreen;
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;
arrowBgLeft._visible = false;

//if total imgs less than 10 or equal 10
if (numberOfItems<=numberPerScreen) {
rightBtn._visible = false;
arrowBgRight._visible = false;
} else {
rightBtn._visible = true;
arrowBgRight._visible = true;
}

currentTarget = 0;

arrowBgRight.onRelease = function() {
leftBtn._visible = true;
arrowBgLeft._visible = true;
rightClickTime++;
if (rightClickTime == maxRightClickTime) {
rightBtn._visible = false;
arrowBgRight._visible = false;
}

currentTarget = 0-((mc_thumbnail.img._width+_parent.gapH)*numberPerS creen)*rightClickTime;

this.onEnterFrame = function() {
diff = currentTarget-mc_thumbnail._x;
mc_thumbnail._x += diff/4;

};

};


arrowBgLeft.onRelease = function() {
rightBtn._visible = true;
arrowBgRight._visible = true;
rightClickTime--;
leftClickTime++;
if (rightClickTime == 0) {
leftBtn._visible = false;
arrowBgLeft._visible = false;
}


currentTarget = 0-((mc_thumbnail.img._width+_parent.gapH)*numberPerS creen)*rightClickTime;

this.onEnterFrame = function() {
diff = currentTarget-mc_thumbnail._x;
mc_thumbnail._x += diff/4;

};

};
_parent.numberOfThumbs = numberOfItems;
for (var i = 0; i<numberOfItems; i++) {
thumbPath[i] = xml.childNodes[i].childNodes[0].childNodes[0].nodeValue;
picPath[i] = xml.childNodes[i].childNodes[1].childNodes[0].nodeValue;
link[i] = xml.childNodes[i].childNodes[2].childNodes[0].nodeValue;

mc_thumbnail.img.duplicateMovieClip("img"+i, i);
mc_thumbnail["img"+i]._x = mc_thumbnail.img._x+i*(mc_thumbnail.img._width+_pa rent.gapH)+39;

if (thumbPath[i] == "undefined") {
mc_thumbnail["img"+i].enabled = false;
} else {
mc_thumbnail["img"+i].enabled = true;
mc_thumbnail["img"+i].img_mc.loadMovie(thumbPath[i]);
}
mc_thumbnail["img"+i].thePicPath = picPath[i];
mc_thumbnail["img"+i].theLinkURL = link[i];
mc_thumbnail["img"+i].theDesc = desc[i];
mc_thumbnail["img"+i].theThumbNumber = i;
}
mc_thumbnail.img._visible=false;


//load the first big image
showLargeImage(picPath[0],link[0],desc[0]);
}

//for loading first big image
function showLargeImage(thePicPath:String,link:String,desc: String) {


_parent.theBigImageContainer = _parent.main.big_mc.big_mc_image;
_parent.theBigImageContainer.loadMovie(thePicPath) ;

_parent.theBigImageContainer2 = _parent.main.largeImageBlur.big_mc_blur.big_mc_ima ge;
_parent.theBigImageContainer2.loadMovie(thePicPath );


_parent.theBigImageContainer._alpha = 0;
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
container.onEnterFrame = function() {
if (_parent.theBigImageContainer.getBytesLoaded()==_p arent.theBigImageContainer.getBytesTotal() && _parent.theBigImageContainer.getBytesTotal()!=4) {
delete this.onEnterFrame;
_parent.main.changeColor();
_parent.theBigImageContainer._alpha = 100;

}
};

_parent.main.big_mc.onRelease = function() {
getURL(link, "_blank");
};

if (link == undefined) {
_parent.main.big_mc.enabled = false;
} else {
_parent.main.big_mc.enabled = true;
}




}

function changeColor():Void {
if (_parent.largeImageEffect.toUpperCase()=="ON") {
var colorComponent:Number = 500;
onEnterFrame = function () {
myColor = new Color(_parent.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;
}
};
}
}

function showClickedThumbnail () {
for (var i = 0; i<_parent.numberOfThumbs; i++) {
if (_parent.currentThumb == i) {
myColor = new Color(mc_thumbnail["img"+i].thumbBorder);
myColor.setRGB("0x8E8D8D");
} else {
myColor = new Color(mc_thumbnail["img"+i].thumbBorder);
myColor.setRGB("0xFFFFFF");
}
}
}