CODE
class Gallery {
var target:MovieClip;
var total:Number;
var thumbs:Array;
function Gallery(t:MovieClip, nm:String, c:Number) {
target = t;
total = c;
thumbs = [];
for (var i = 0; i<total; i++) {
var o = {img:"thumb_"+(i+1)+".jpg"};
var item = target.attachMovie("Thumb", nm+"_thumb_"+i, i, o);
thumbs.push(item);
}
}
function gShowThumbs() {
trace(thumbs);
}
function gShowCount() {
trace(total);
}
}
var target:MovieClip;
var total:Number;
var thumbs:Array;
function Gallery(t:MovieClip, nm:String, c:Number) {
target = t;
total = c;
thumbs = [];
for (var i = 0; i<total; i++) {
var o = {img:"thumb_"+(i+1)+".jpg"};
var item = target.attachMovie("Thumb", nm+"_thumb_"+i, i, o);
thumbs.push(item);
}
}
function gShowThumbs() {
trace(thumbs);
}
function gShowCount() {
trace(total);
}
}
È åãî îáüåêò:
CODE
var g1 = new Gallery(this, "first", 5);
Ïðè âûçîâå:
CODE
g1.gShowThumbs();
g1.gShowCount();
g1.gShowCount();
Output:
_level0.first_thumb_0,_level0.first_thumb_1,_level0.first_thumb_2,_level0.first_
thumb_3,_level0.first_thumb_4
5
Òî åñòü âñå â ïîðÿäêå. Íî â ñëó÷àå åñëè îáüåêòîâ 2:
CODE
var g1 = new Gallery(this, "first", 5);
var g2 = new Gallery(this, "second", 3);
g1.gShowThumbs();
g1.gShowCount();
g2.gShowThumbs();
g2.gShowCount();
var g2 = new Gallery(this, "second", 3);
g1.gShowThumbs();
g1.gShowCount();
g2.gShowThumbs();
g2.gShowCount();
Output:
,,,_level0.first_thumb_3,_level0.first_thumb_4
5
_level0.second_thumb_0,_level0.second_thumb_1,_level0.second_thumb_2
3
Ïî÷åìó ìàññèâ òðàêòóåòñÿ êàê static è ÷òî äåëàòü? private ïðîáîâàë - zero effect. Help please