All pastes #363721 Raw Edit

Something

public javascript v1 · immutable
#363721 ·published 2007-02-19 17:09 UTC
rendered paste body
var container:MovieClip = createEmptyMovieClip("container", -16381);var mcLoader:MovieClipLoader = new MovieClipLoader();var listener:Object = new Object();listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void  {	trace(target+".onLoadProgress with "+bytesLoaded+" bytes of "+bytesTotal);};listener.onLoadInit = function(target:MovieClip):Void  {	trace(target+".onLoadInit");};mcLoader.addListener(listener);container._x = 2;container._y = 2;trace(previous_btn.getDepth());function loadXML(loaded) {	if (loaded) {		xmlNode = this.firstChild;		image = [];		description = [];		total = xmlNode.childNodes.length;		for (i=0; i<total; i++) {			image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;			description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;		}		firstImage();	} else {		content = "file not loaded!";	}}xmlData = new XML();xmlData.ignoreWhite = true;xmlData.onLoad = loadXML;xmlData.load("images.xml");/////////////////////////////////////listen = new Object();listen.onKeyDown = function() {	if (Key.getCode() == Key.LEFT) {		prevImage();	} else if (Key.getCode() == Key.RIGHT) {		nextImage();	}};Key.addListener(listen);previous_btn.onRelease = function() {	if (p>0) {		_root.onEnterFrame = function() {			if (container._alpha>=0) {				fadeOut();				if (container._alpha<1) {					prevImage();				}			}		};	}};next_btn.onRelease = function() {	if (p<(total-1)) {		_root.onEnterFrame = function() {			if (container._alpha>=0) {				fadeOut();				if (container._alpha<1) {					nextImage();				}			}		};	}};/////////////////////////////////////p = 0;this.onEnterFrame = function() {	filesize = container.getBytesTotal();	loaded = container.getBytesLoaded();	preloader._visible = true;	trace('filesize: '+filesize);	if (loaded != filesize) {		trace(loaded);		preloader.preload_bar._xscale = 100*loaded/filesize;	} else {		preloader._visible = false;		if (container._alpha<=100) {			container._alpha += 2;		}	}};function fadeIn() {	container._alpha = container._alpha+15;}function fadeOut() {	container._alpha = container._alpha-15;}function nextImage() {	if (p<(total-1)) {		p++;		//if (loaded == filesize) {		container.loadMovie(image[p]);		//fadeIn();		desc_txt.text = description[p];		_root.onEnterFrame = function() {			if (container._alpha<=100) {				//trace('fadein called');				fadeIn();			}		};		picture_num();		//}	}}function prevImage() {	if (p>0) {		p--;		//picture._alpha = 0;		container.loadMovie(image[p]);		desc_txt.text = description[p];		_root.onEnterFrame = function() {			if (container._alpha<=100) {				//trace('fadein called');				fadeIn();			}		};		picture_num();	}}function firstImage() {	mcLoader.loadClip(image[0], container);	//container.loadMovie(image[0]);	container._alpha = 0;	this.onEnterFrame = function() {		if (container._alpha<=100) {			container._alpha = container._alpha+5;		}	};	if (loaded == filesize) {		//picture._alpha = 0;		//picture.loadMovie(image[0], 1);		desc_txt.text = description[0];		picture_num();	}}function picture_num() {	current_pos = p+1;	pos_txt.text = current_pos+" / "+total;}