Hi,
I have a problem with my xml gallery. I load each picture on a container and on the onEnterFrame of this container i’m waiting that the picture is loaded, i take the _width and _height and center the picture then a fadein effect. All is working great except that i can see the picture moving while the fadin. I tried everything i think but didn’t find what to change to make it work properly.
Here’s some of my code and a link to see what’s happen :
http://adesign.tonsite.biz/xml_alerie/xml_galerie.swf
[font=Tms Rmn][color=#000000]function attache_btn() {
//Create an array of the xml values with the function tableaux()
tableaux();
//Create a container for the buttons
_root.createEmptyMovieClip("thumb_mc", 1);
thumb_mc._x = 10;
thumb_mc._y = 10;
nb_ligne=3;
nb_colonne=3;
//attach the tooltip 'thumb_mc'
thumb_mc.attachMovie("texte","tooltip_mc",100,{_visible:false});
//attach 'container_image' on the scene
_root.attachMovie("container_image","container_mc",0,{_y:10,_x:120});
container_mc.preloader._visible=false;
thumb_mc.tooltip_mc.onEnterFrame = function() {
if (_global.x == 1) {
this._x = Math.round(_root._xmouse);
this._y = Math.round(_root._ymouse);
this._visible = true;
} else {
this._visible = false;
}
};
//attach les buttons inb the container
nb_images = images_xml.firstChild.childnodes.length;
for (i=0; i<nb_images; i++) {
thumb_mc.attachMovie("Btn", "Btn"+i, i, {_x:35*(i%nb_ligne), _y:35*Math.floor(i/nb_colonne)});
thumb_mc["Btn"+i].i=i;
thumb_mc["Btn"+i].j=tableau_url*;
//Rollover
thumb_mc["Btn"+i].onRollOver=function(){
this.gotoAndPlay("over");
_global.x=1;
thumb_mc.tooltip_mc.caption.text=tableau_texte[this.i];
//Format tooltip
thumb_mc.tooltip_mc.caption.background=true;
thumb_mc.tooltip_mc.caption.backgroundColor="0xFFFFFF";
thumb_mc.tooltip_mc.caption.autoSize=true;
thumb_mc.tooltip_mc.caption.border=true;
thumb_mc.tooltip_mc.caption.bordercolor="0xCCCCCC";
}
//Rollout
thumb_mc["Btn"+i].onRollOut=function(){
this.gotoAndPlay("out");
_global.x=0;
}
//Release
thumb_mc["Btn"+i].onRelease=function(){
container_mc.container._alpha=0;
container_mc.container.loadmovie(this.j);
container_mc.onEnterFrame=function(){
//Preload the picture
charge=this.container.getBytesLoaded()
total=this.container.getBytesTotal()
rapport=Math.round((charge*100)/total);
if(charge==total){
this.preloader._visible=false;
this.preloader.barre._xscale=0;
//pos the picture in the center
largeur=(this._width/2)-(this.container._width/2);
hauteur=(this._height/2)-(this.container._height/2);
this.container._x=largeur;
this.container._y=hauteur;
this.container._visible=true;
}else{
this.preloader.barre._xscale=rapport;
trace(this.preloader.barre._xscale);
this.container._visible=false;
this.preloader._visible=true;
}
//fadein picture
this.container._alpha+=5;
if(this.container._alpha>=100){
this.container._alpha=100;
trace(this.container._alpha);
delete this.onEnterFrame;
}
};
}
//text on each button
thumb_mc["Btn"+i].texte=tableau_num*;
}
}
[/color][/font]