๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.pl.programy.flash-5
1 messages
1 total messages Started by M.jp Sat, 19 May 2007 16:04
Galeria, ktos wie?
#34206
Author: M.jp
Date: Sat, 19 May 2007 16:04
121 lines
4851 bytes
Witam. Mam poniลผej skrypt kt wczytuje dynamicznie galerie.
Obecnie dziala to tak: galeria wczytuje miniatury, po kliknieciu w
ktoras z nich wczytuje sie 100% obrazka.
Problem w tym iz po kliknieciu w te 100% obrazek powinien sie schowac.
Na samym spodzie jest rozwiazanie tylko ze z onRelease... Jak
przelozyc to rozwiazanie na OnPress?


-------------------------------

import mx.transitions.*;

_global.thisX = 0;
_global.thisY = 0;
_global.stageWidth = 300;
_global.stageHeight = 100;

var gallery_xml:XML = new XML();
gallery_xml.ignoreWhite = true;
gallery_xml.onLoad = function(success:Boolean) {
	try {
		if (success) {
			var images:Array = this.firstChild.childNodes;
			var gallery_array:Array = new Array();
			for (var i = 0; i<images.length; i++) {
				gallery_array.push({src:images[i].firstChild.nodeValue});
			}
		} else {
			throw new Error("Unable to parse XML");
		}
	} catch (e_err:Error) {
		trace(e_err.message);
	} finally {
		delete this;
	}
};

gallery_xml.load("galeria.xml");

function displayGallery(gallery_array:Array) {
	var galleryLength:Number = gallery_array.length;
	for (var i = 0; i<galleryLength; i++) {
		var thisMC:MovieClip = this.createEmptyMovieClip("image"+i+"_mc",
i);
		mcLoader_mcl.loadClip(gallery_array[i].src,thisMC);
		preloaderMC = this.attachMovie("preloader_mc", "preloader"+i+"_mc",
5000+i);
		preloaderMC.bar_mc._xscale = 0;
		preloaderMC.progress_txt.text = "0%";
		thisMC._x = _global.thisX;
		thisMC._y = _global.thisY;
		preloaderMC._x = _global.thisX;
		preloaderMC._y = _global.thisY+5;
		if ((i+1)%4 == 0) {
			_global.thisX = 0;
			_global.thisY += 80;
		} else {
			_global.thisX += 90+20;
		}
	}
}

var mcLoader_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadStart = function() {
};

mclListener.onLoadProgress = function(target_mc, loadedBytes,
totalBytes) {
	var pctLoaded:Number = Math.round(loadedBytes/totalBytes*100);
	var preloaderMC = target_mc._parent["preloader"+target_mc.getDepth()
+"_mc"];
	preloaderMC.bar_mc._xscale = pctLoaded;
	preloaderMC.progress_txt.text = pctLoaded+"%";
};

mclListener.onLoadInit = function(evt:MovieClip) {
	evt._parent["preloader"+evt.getDepth()+"_mc"].removeMovieClip();
	var thisWidth:Number = evt._width;
	var thisHeight:Number = evt._height;
	var borderWidth:Number = 2;
	var marginWidth:Number = 7;
	evt.scale = 14;
	evt.lineStyle(borderWidth,0x000000,100);
	evt.beginFill(0xFFFFFF,100);
	evt.moveTo(-borderWidth-marginWidth,-borderWidth-marginWidth);
	evt.lineTo(thisWidth+borderWidth+marginWidth,-borderWidth-
marginWidth);
	evt.lineTo(thisWidth+borderWidth+marginWidth,thisHeight+borderWidth
+marginWidth);
	evt.lineTo(-borderWidth-marginWidth,thisHeight+borderWidth
+marginWidth);
	evt.lineTo(-borderWidth-marginWidth,-borderWidth-marginWidth);
	evt.endFill();
	evt._xscale = evt.scale;
	evt._yscale = evt.scale;
	evt.onPress = function() {
		trace(this+" info");
		this._xscale = 100;
		this._yscale = 100;
		this.origX = this._x;
		this.origY = this._y;
		this.origDepth = this.getDepth();
		this.swapDepths(this._parent.getNextHighestDepth());
		this._x = (_global.stageWidth-evt._width-50)/2;
		this._y = (_global.stageHeight-evt._height-50)/2;
		mx.transitions.TransitionManager.start(this,
{type:mx.transitions.Photo, direction:0, duration:1,
easing:mx.transitions.easing.Strong.easeOut, param1:empty,
param2:empty});
	};
	/* to jest funkcja kt robi dokladnie to o co pytam, jak przylozyc to
na powyzsze...?
	evt.onRelease = function() {
	this._xscale = this.scale;
	this._yscale = this.scale;
	this._x = this.origX;
	this._y = this.origY;
	};*/
};
mcLoader_mcl.addListener(mclListener);
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads