Hi. I am building an image gallery, and I’ve got a small actionscript issue I can’t figure out:
My swf is 600px wide, and most of the pictures does not exceed that. However, some of the pictures needs to be presented in a larger width.
www.tinagent.com solves the problem in a great way, by scrolling the images to the left automatically. (for example, check the second picture in Knut Bry’s portfolio)
My problem is that I can’t figure out how on earth I’m gonna do that. Can anybody help me? Or maybe point me in the right direction?
Thanks:)
:gi:
Here’s my code so far.
var xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
total = xml.firstChild.childNodes.length;
carga.fade(xml.firstChild.childNodes[0].childNodes[0].childNodes, 20);
for (var i = 0; i<total; i++) {
var mc = xx.item0.duplicateMovieClip("itemx"+i, i);
if (i >= 9) {
mc.texto.text = ""+(i+1);
}
else {
mc.texto.text = "0"+(i+1);
}
mc.img = xml.firstChild.childNodes*.childNodes[0].childNodes;
mc._x = 22*i;
mc.onRollOver = function() {this._alpha = 40;};
mc.onRollOut = function() {this._alpha = 100;};
mc.onPress = function() {carga.fade(this.img, 20);};
}
xx.item0._alpha = 0;
};
xml.load("dodge.xml");
Stage.scaleMode = "noScale";
Color.prototype.fuego = function(offset) {
var trans = this.getTransform();
with (trans) {
rb = gb=bb=offset;
}
this.setTransform(trans);
};
Variablefade = new Object();
MovieClip.prototype.fade = function(p1, vel) {
this._alpha = 99;
Variablefade.vel = vel;
minuevocolor = new Color(this);
if (this._width>0) {
this.onEnterFrame = function() {
minuevocolor.fuego(Variablefade.level += Variablefade.vel);
if (Variablefade.level>=255) {
delete this.onEnterFrame;
fadeIn(p1, this._name, -(vel));
}
};
} else {
fadeIn(p1, this._name, -(vel));
}
};
function fadeIn(p1, p2, vel) {
Variablefade.vel = vel;
Variablefade.level = 255;
minuevocolor = new Color(p2);
eval(p2).unloadMovie();
eval(p2).loadMovie(p1);
this.onEnterFrame = function() {
if (eval(p2).getBytesLoaded() == eval(p2).getBytesTotal()) {
loadBar._visible = false;
carga.play();
minuevocolor.fuego(Variablefade.level += Variablefade.vel);
if (Variablefade.level<=0) {
minuevocolor.fuego(0);
delete this.onEnterFrame;
}
} else {
loadBar._visible = true;
loadBar._width = Math.round(600/eval(p2).getBytesTotal()*eval(p2).getBytesLoaded());
}
};
}