Показать сообщение отдельно
Старый 24.09.2009, 16:11
glukaviy вне форума Посмотреть профиль Отправить личное сообщение для glukaviy Найти все сообщения от glukaviy
  № 1  
Ответить с цитированием
glukaviy

Регистрация: Mar 2006
Сообщений: 76
По умолчанию Помогите разобраться в галереи

Есть во такая галерея. она делает превьюшки в один столбец... а мне нужно их как минимум 4 (4 столбца по 6 картинок), что нужно сделать? И Сделать между ними интервал 10 пикселей.

Код AS1/AS2:
import mx.transitions.Tween;
import mx.transitions.easing.*;
 
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("gallery.xml");
 
myGalleryXML.onLoad = function() {
	_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
	_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
	_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
	_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
 
	_root.myImages = myGalleryXML.firstChild.childNodes;
	_root.myImagesTotal = myImages.length;
 
	_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
	_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
 
	_root.full_x = myGalleryXML.firstChild.attributes.full_x;
	_root.full_y = myGalleryXML.firstChild.attributes.full_y;
 
	callThumbs();
	createMask();
	scrolling();
 
};
 
function callThumbs() {
	_root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
	container_mc._x = _root.gallery_x;
	container_mc._y = _root.gallery_y;
 
	var clipLoader = new MovieClipLoader();
	var preloader = new Object();
	clipLoader.addListener(preloader);
 
	for (i=0; i<myImagesTotal; i++) {
		thumbURL = myImages[i].attributes.thumb_url;
		myThumb_mc = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth());
		myThumb_mc._y = _root.thumb_height*i;
 
		clipLoader.loadClip("thumbs/"+thumbURL,myThumb_mc);
 
		preloader.onLoadStart = function(target) {
			target.createTextField("my_txt",target.getNextHighestDepth(),0,0,100,20);
			target.my_txt.selectable = false;
		};
 
 
		preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
			target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
		};
 
		preloader.onLoadComplete = function(target) {
			new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
			target.my_txt.removeTextField();
			target.onRelease = function() {
				callFullImage(this._name);
			};
 
			target.onRollOver = function() {
				this._alpha = 50;
			};
 
			target.onRollOut = function() {
				this._alpha = 100;
			};
 
 
		};
	}
 
}
 
 
 
function callFullImage(myNumber) {
 
	myURL = myImages[myNumber].attributes.full_url;
	myTitle = myImages[myNumber].attributes.title;
	_root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
	fullImage_mc._x = _root.full_x;
	fullImage_mc._y = _root.full_y;
 
	var fullClipLoader = new MovieClipLoader();
	var fullPreloader = new Object();
	fullClipLoader.addListener(fullPreloader);
 
	fullPreloader.onLoadStart = function(target) {
		target.createTextField("my_txt",fullImage_mc.getNextHighestDepth(),0,0,200,20);
		target.my_txt.selectable = false;
	};
 
	fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
		target.my_txt.text = Math.floor((loadedBytes/totalBytes)*100);
	};
 
	fullPreloader.onLoadComplete = function(target) {
		new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
		target.my_txt.text = myTitle;
	};
 
	fullClipLoader.loadClip("full_images/"+myURL,fullImage_mc);
 
}
 
function createMask() {
 
	_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
 
	mask_mc._x = _root.gallery_x;
	mask_mc._y = _root.gallery_y;
 
	mask_mc.beginFill(0x000000,100);
	mask_mc.lineTo(_root.gallery_width,0);
	mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
	mask_mc.lineTo(0,_root.gallery_height);
	mask_mc.lineTo(0,0);
 
	container_mc.setMask(mask_mc);
 
}
/*
function scrolling() {
	_root.onEnterFrame = function() {
 
		container_mc._y += Math.cos(((mask_mc._ymouse)/mask_mc._height)*Math.PI)*15;
 
		if (container_mc._y>mask_mc._y) {
			container_mc._y = mask_mc._y;
		}
 
		if (container_mc._y<(mask_mc._y-(container_mc._height-mask_mc._height))) {
			container_mc._y = mask_mc._y-(container_mc._height-mask_mc._height);
		}
 
	};
 
}*/
xml
Код:
 <gallery thumb_width="90" thumb_height="90" gallery_width="90" gallery_height="800" gallery_x="50" gallery_y="30" full_x="600" full_y="100">
<image thumb_url="thumb1.jpg" full_url="image1.jpg" title="Mango Juice" />
<image thumb_url="thumb2.jpg" full_url="image2.jpg" title="Cherry Seven Up" />
<image thumb_url="thumb3.jpg" full_url="image3.jpg" title="Stawberry Juice" />
<image thumb_url="thumb4.jpg" full_url="image4.jpg" title="Rice and Chicken" />
<image thumb_url="thumb5.jpg" full_url="image5.jpg" title="Mixed Capsicum" />
<image thumb_url="thumb6.jpg" full_url="image6.jpg" title="Roma at Barbera Cafe" />
<image thumb_url="thumb7.jpg" full_url="image7.jpg" title="Orange Juice" />
<image thumb_url="thumb8.jpg" full_url="image8.jpg" title="Fries in Salalah" />
<image thumb_url="thumb9.jpg" full_url="image9.jpg" title="Chicken Tacos" />
<image thumb_url="thumb10.jpg" full_url="image10.jpg" title="Club Sandwiches" />
<image thumb_url="thumb11.jpg" full_url="image11.jpg" title="Samosa" />
<image thumb_url="thumb12.jpg" full_url="image12.jpg" title="Mountain Dew" />
<image thumb_url="thumb13.jpg" full_url="image13.jpg" title="Water at Grill House" />
<image thumb_url="thumb14.jpg" full_url="image14.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb15.jpg" full_url="image15.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb16.jpg" full_url="image16.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb17.jpg" full_url="image17.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb18.jpg" full_url="image18.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb19.jpg" full_url="image19.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb20.jpg" full_url="image20.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb21.jpg" full_url="image21.jpg" title="Ice Tea at Noodle House" />
<image thumb_url="thumb22.jpg" full_url="image22.jpg" title="Ice Tea at Noodle House" />
</gallery>