Непосредственно класс галлереи

Код:
/**
* Slideshow/picture gallery class, a part of the inner page cunstruction classes.
* Constructs a slideshow (gallery).
* It has the changePict() method. Which changes the currently dysplayed picture.
*/
class UGallery extends MovieClip {
var u_slider:USlider;
var Ubody:MovieClip;
var u_pic:MovieClip;
var slid_holder:MovieClip;
var nex_arr:MovieClip;
var pre_arr:MovieClip;
var ct:Number = -1;
var desc:TextField;
var _eye:MovieClip;
var _cam:MovieClip;
var prl_txt:TextField;
function UGallery(mc:MovieClip, cat:Number) {
var ct = cat;
this.Ubody = mc.attachMovie("rect", "Ubody", mc.getNextHighestDepth());
with (this.Ubody) {
_width = 780;
_height = 370;
_alpha = 0;
}
this.u_pic = mc.attachMovie("rect", "u_pic", mc.getNextHighestDepth());
with (this.u_pic) {
_x = Stage.width/2;
_y = 110;
_alpha = 0;
}
this.desc = mc.createTextField("desc", mc.getNextHighestDepth(), 550, 130, 170, 190);
with (this.desc) {
html = true;
multiline = true;
wordWrap = true;
styleSheet = SuperString._css();
}
this.u_pic.holder = this.u_pic.attachMovie("rect", "holder", this.u_pic.getNextHighestDepth());
this.u_pic.holder._height = 190;
this.u_pic.holder._width = 190;
this.u_pic.onEnterFrame = function() {
var _arr:Array = slid.onSliderLoad();
var _str:String = _arr[0];
if (_str>-1) {
this._hd = _arr[1];
this._ds = _arr[2];
this._parent.desc.htmlText = "<p>"+_arr[1]+"</p><p>"+_arr[2]+"</p>";
var p_loader = new PicLoader(this.holder, "album/"+ct+"/"+_str+".jpg", {h:this.holder._height, w:this.holder._width});
p_loader.onDone = function() {
};
delete this.onEnterFrame;
}
};
this.u_pic.onResized = function() {
this.holder._xscale = this.holder._yscale;
this._x = Stage.width/2-this._width/2;
this._alpha = 100;
};
this.slid_holder = mc.createEmptyMovieClip("slid_holder", mc.getNextHighestDepth());
with (this.slid_holder) {
_x = 177;
_y = 320;
}
this.u_slider = new USlider(this.slid_holder, {W:440, H:74}, cat);
var slid:USlider = this.u_slider;
this.nex_arr = mc.attachMovie("slider_arr", "nex_arr", mc.getNextHighestDepth());
with (nex_arr) {
_y = 345;
_x = Stage.width-150;
}
this.nex_arr.onPress = function() {
slid.slide(false);
};
this.nex_arr.enabled = false;
this.pre_arr.enabled = false;
this.nex_arr.onRelease = function() {
slid.freez();
};
this.pre_arr = mc.attachMovie("slider_arr", "pre_arr", mc.getNextHighestDepth());
with (pre_arr) {
_y = 345+_height;
_x = 150+_width;
_rotation = 180;
}
this.pre_arr.onPress = function() {
slid.slide(true);
};
this.pre_arr.onRelease = function() {
slid.freez();
};
this._eye = mc.attachMovie("eye_b", "_eye", mc.getNextHighestDepth());
with (this._eye) {
_x = 180;
_y = 280;
}
this._cam = mc.attachMovie("camera_b", "_eye", mc.getNextHighestDepth());
with (this._cam) {
_x = 210;
_y = 280;
}
this.prl_txt = mc.createTextField("prl_txt", mc.getNextHighestDepth(), 185, 300, 410, 20);
with (this.prl_txt) {
html = true;
multiline = true;
wordWrap = true;
styleSheet = SuperString._css();
}
}
function changePict(_str:String, n:Number, _arr:Array) {
this.desc.htmlText = "<p>"+_arr[0]+"</p><p>"+_arr[1]+"</p>";
var p_loader = new PicLoader(this.u_pic.holder, "album/"+n+"/"+_str+".jpg", {h:this.u_pic.holder._height, w:this.u_pic.holder._width});
}
function updPreText(_n:Number, _n1:Number):Void {
this.prl_txt.htmlText = "<p class='ctr'>Pictures "+_n.toString()+" of "+_n1.toString()+" loaded";
if (_n == _n1) {
this.nex_arr.enabled = true;
this.pre_arr.enabled = true;
this.prl_txt.htmlText = "";
}
}
}
так создается новая галлерея:

Код:
var _ug:UGallery = new UGallery([MovieClip], [Number]);
Для того, чтобы создать галлерею в библиотеке должны быть мувики с линкеджем "rect", "slider_arr", там еще были какие-то eye_b, camera_b - это мусор какой-то, они не нужны...
Там еще по ходу могут попадаться ссылки на класс SuperString типа SuperString._css(); - просто поубивать, или заменить на что-то свое =)
ХМЛ лежит в папке xmldata на уровень ниже самой флешки, кроме этого, так же на уровень ниже флешки нужна папка album, в нем папки: имя папки = название категории в ХМЛе, в каждой папке есть еще одна папка для превьюх (превьюхи и большие картинки соответственно называются одинаково)
Ну и наконец пример ХМЛя (не бейте, я тут вообще ни при чем, мне такой дали %)
Этот описыват картинки

Код:
<images>
<cat name="1">
<img name="375" heading="heading#1" des="Picture description" />
<img name="376" heading="heading#2" des="Picture description" />
<img name="377" heading="heading#3" des="Picture description" />
<img name="378" heading="heading#4" des="Picture description" />
<img name="379" heading="heading#5" des="Picture description" />
<img name="380" heading="heading#6" des="Picture description" />
<img name="381" heading="heading#7" des="Picture description" />
<img name="382" heading="heading#8" des="Picture description" />
<img name="383" heading="heading#9" des="Picture description" />
<img name="385" heading="heading#10" des="Picture description" />
<img name="386" heading="heading#11" des="Picture description" />
<img name="387" heading="heading#12" des="Picture description" />
<img name="388" heading="heading#13" des="Picture description" />
</cat>
</images>
Этот описывает категории с картинками:
(в случае, если интерфейс позволяет добавлять\создавать дополнительные категории) Эта ситуаци я в коде выше никак не освещена, и так много писанины, но если надо, то и такая возможность имеется =)

Код:
<buttons>
<button1 b_value="Itzuv Irua" b_url="1" b_image="">
</button1>
<button2 b_value="Print BAr" b_url="2" b_image="">
</button2>
</buttons>