Agregue el codigo de un preloader en el 1er fotograma, corriendo lo original al 2do. Pero el resultado fue muy malo: no funciono ni el preloader ni la galería.
Supongo que tendrá que ver con que el codigo esta en el AS.as que llama el 1er fotograma:
FOTOGRAMA 1:
Código:
import mx.transitions.Tween;
import mx.transitions.easing.*;
fscommand("allowscale", "false");
var GallXml = new XML();
GallXml.ignoreWhite = true;
GallXml.load("xml/gallery_animaux.xml");
#include "AS.as"
CONTENIDO DE AS.as:
Código:
GallXml.onLoad = function() {
_root.gallery_width = GallXml.firstChild.attributes.width;
_root.gallery_height = GallXml.firstChild.attributes.height;
_root.gallery_y = GallXml.firstChild.attributes.y;
_root.spacing = GallXml.firstChild.attributes.Vert_space;
_root.bar_y = Number(_root.gallery_height)+Number(_root.spacing);
_root.Bar_Thick = GallXml.firstChild.attributes.Bar_Thick;
_root.colorSlider = GallXml.firstChild.attributes.colorSlider;
_root.alphaSlider = GallXml.firstChild.attributes.alphaSlider;
_root.SliderColorLine = GallXml.firstChild.attributes.SliderColorLine;
_root.SliderAlphaLine = GallXml.firstChild.attributes.SliderAlphaLine;
_root.link_URL = _root.link_URL;
_root.Scroll_Width = GallXml.firstChild.attributes.Scroll_Width;
_root.IntervalTime = GallXml.firstChild.attributes.IntervalTime;
_root.IMG_width = GallXml.firstChild.attributes.image_width;
_root.myImages = GallXml.firstChild.childNodes;
_root.myImagesTotal = _root.myImages.length;
createContainer();
callImages();
Mask_Gallery();
Scroll_B();
Scroller();
};
function createContainer() {
_root.MC_Gallery = _root.createEmptyMovieClip("MC_Gallery", _root.getNextHighestDepth());
_root.MC_Gallery._y = _root.gallery_y;
_root.MC_Gallery._x = (Stage.width-_root.gallery_width)/2;
}
function callImages() {
_root.myImages_mc = _root.MC_Gallery.createEmptyMovieClip("myImages_mc", _root.MC_Gallery.getNextHighestDepth());
var myMCL:MovieClipLoader = new MovieClipLoader();
for (i=0; i<_root.myImagesTotal; i++) {
imageURL = _root.myImages[i].attributes.url;
image_mc = _root.myImages_mc.createEmptyMovieClip(i, _root.myImages_mc.getNextHighestDepth());
image_mc._x = _root.IMG_width*i;
myMCL.loadClip(imageURL,image_mc);
}
}
function Mask_Gallery() {
_root.Mask_Mc = _root.MC_Gallery.createEmptyMovieClip("Mask_Mc", _root.MC_Gallery.getNextHighestDepth());
_root.Mask_Mc.beginFill(SliderColorLine,SliderAlphaLine);
_root.Mask_Mc.lineTo(_root.gallery_width,0);
_root.Mask_Mc.lineTo(_root.gallery_width,_root.gallery_height);
_root.Mask_Mc.lineTo(0,_root.gallery_height);
_root.Mask_Mc.lineTo(0,0);
_root.Mask_Mc.endFill();
_root.myImages_mc.setMask(_root.Mask_Mc);
}
function Scroll_B() {
_root.Scroll_B_mc = _root.MC_Gallery.createEmptyMovieClip("Scroll_B_mc", _root.MC_Gallery.getNextHighestDepth());
_root.Scroll_B_mc._y = _root.bar_y;
_root.Scroll_B_mc.beginFill(SliderColorLine,SliderAlphaLine);
_root.Scroll_B_mc.lineTo(gallery_width,0);
_root.Scroll_B_mc.lineTo(gallery_width,_root.Bar_Thick);
_root.Scroll_B_mc.lineTo(0,_root.Bar_Thick);
_root.Scroll_B_mc.lineTo(0,0);
_root.Scroll_B_mc.endFill();
_root.Scroll_B_mc.onPress = function() {
_root.MC_Scroller._x = this._xmouse;
if (_root.MC_Scroller._x>(this._width-_root.MC_Scroller._width)) {
_root.MC_Scroller._x = this._width-_root.MC_Scroller._width;
}
A_Move();
};
}
function Scroller() {
_root.MC_Scroller = _root.MC_Gallery.createEmptyMovieClip("MC_Scroller", _root.MC_Gallery.getNextHighestDepth());
_root.MC_Scroller._y = _root.bar_y;
_root.MC_Scroller.beginFill(colorSlider,alphaSlider);
_root.MC_Scroller.lineTo(_root.Scroll_Width,0);
_root.MC_Scroller.lineTo(_root.Scroll_Width,_root.Bar_Thick);
_root.MC_Scroller.lineTo(0,_root.Bar_Thick);
_root.MC_Scroller.lineTo(0,0);
_root.MC_Scroller.endFill();
_root.MC_Scroller.onPress = function() {
startDrag(this, false, 0, this._y, _root.Scroll_B_mc._width-this._width, this._y);
A_MoveInterval = setInterval(A_Move,IntervalTime);
};
_root.MC_Scroller.onRelease = _root.MC_Scroller.onReleaseOutside=function () {
stopDrag();
clearInterval(A_MoveInterval);
A_Move();
};
}
function A_Move() {
var ScrollerLocation = _root.MC_Scroller._x/(_root.Scroll_B_mc._width-_root.MC_Scroller._width);
var galleryLocation = ScrollerLocation*(_root.Mask_Mc._width-_root.myImages_mc._width);
new Tween(_root.myImages_mc, "_x", Strong.easeOut, _root.myImages_mc._x, galleryLocation, 1.5, true);
}
Alguien sabe como agregar un preloader a las imagenes desde el archivo AS.as?


