Foros del Web » Creando para Internet » Flash y Actionscript »

Preloader en AS.as

Estas en el tema de Preloader en AS.as en el foro de Flash y Actionscript en Foros del Web. Hola, tengo una galería de imagenes dinámica en flash que no tiene un preloader. El tema es que la galería no contiene nada más que ...
  #1 (permalink)  
Antiguo 17/06/2010, 15:59
 
Fecha de Ingreso: junio-2010
Mensajes: 108
Antigüedad: 13 años, 9 meses
Puntos: 2
Preloader en AS.as

Hola,

tengo una galería de imagenes dinámica en flash que no tiene un preloader. El tema es que la galería no contiene nada más que AS. Como le agrego un preloader individual a las fotos o una a la galeria, pero que cargue todo antes de mostrar las fotos?

el unico codigo que contiene el .fla es:

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"

y el codigo del AS.as es:

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);
}

Como agrego un preloader?

Etiquetas: actionscript, as.as, preloader
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:21.