Hi,
Been working on learning the kirupa xml photogallery.
There’s the start of the thread, and if you read it all,
I am learning a little bit.
My take on the xml gallery <-clicky
Anyway, I am to a point where what I have almost works pretty well.
Here’s the current problem:
On my older machine(laptop with 2500+1.8GHz, winXP pro, IE7, flash9)
the preloader seems to be loading, but it never actually shows up on the screen.
On my newer, faster machine, all seems to work quite well.
I do not know why.
Thank you in advance for your help with this
here’s a live view:
http://www.flawlessdog.com/eggzdownload/kirupa/photogallery00503/
current post:
////////////////////////////////////////////////////////////////
//////////Some new Movie Clips to hold everything///////////////
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
////////This creates the Rectangles used for this movie/////////
////////////////////////////////////////////////////////////////
drawRectangle = function(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):Void {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo(0, 0);
lineTo(boxWidth, 0);
lineTo(boxWidth, boxHeight);
lineTo(0, boxHeight);
lineTo(0, 0);
endFill();
}
};
////////////////////////////////////////////////////////////////
////////////////////Holds the main picture//////////////////////
////////////////////////////////////////////////////////////////
buildMain = function():Void{
this.createEmptyMovieClip("imageHolder", 3);
imageHolder._x = 0;
imageHolder._y = 0;
imageHolder._alpha = 0;
};
////////////////////////////////////////////////////////////////
//////////////////////Holds the preloader///////////////////////
////////////////////////////////////////////////////////////////
buildPreloader = function():Void{
this.createEmptyMovieClip("eggsLoader", 4);
eggsLoader._x = 0;
eggsLoader._y = 390;
drawRectangle(eggsLoader, 600, 30, 0xFF0000, 100);
eggsLoader._xscale = 0;
eggsLoader._visible = true;
};
buildMain();
buildPreloader();
////////////////////////////////////////////////////////////////
////This creates the movie clip for the mask and thumbnails/////
////////////////////////////////////////////////////////////////
this.createEmptyMovieClip("thumbnail_mc", 1);
thumbnail_mc._x = 0;
thumbnail_mc._y = 425;
this.createEmptyMovieClip("thumbMask", 2);
thumbMask._x = 0;
thumbMask._y = 425;
drawRectangle(thumbMask, 600, 67, 0xffffff, 100);
///////////////////////////////////////////////////////////////////////
/////////This sets the thumbmask clip to mask the thumbnail_mc/////////
///////////////////////////////////////////////////////////////////////
thumbnail_mc.setMask(thumbMask);
////////////////////////////////////////////////////////////////
/////////////////////////text field/////////////////////////////
////////////////////////////////////////////////////////////////
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFFFFFF;
my_fmt.font = "Verdana";
my_fmt.size = 15;
my_fmt.bold = true;
my_fmt.align = "center";
this.createTextField("desc_txt", 5, 0, 397, 600, 23);
desc_txt.setNewTextFormat(my_fmt);
var myNext:Boolean=true;
var p:Number = 0;
////////////////////////////////////////////////////////////////
//////////Load the XML store it and fire first image////////////
////////////////////////////////////////////////////////////////
cliparray = [];
loadXML = function(loaded:Boolean):Void{
if (loaded) {
image = [];
description = [];
thumbnails = [];
total = xmlData.firstChild.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlData.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlData.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlData.firstChild.childNodes*.childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
};
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
////////////////////////////////////////////////////////////////
///////////////Get the controls ready for use///////////////////
////////////////////////////////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
removeMovieClip(imageHolder);
buildPreloader();
myNext = false;
myCounter = 5;
myImage();
trace("left key");
}else if (Key.getCode() == Key.RIGHT) {
removeMovieClip(imageHolder);
buildPreloader();
myNext = true;
myCounter = 5;
myImage();
trace("right key");
}
};
Key.addListener(listen);
////////////////////////////////////////////////////////////////
//////////////////////PreLoader script//////////////////////////
////////////////////////////////////////////////////////////////
myLoader = function():Void {
eggsLoader.onEnterFrame = function(){
var loadedBytes1:Number = imageHolder.getBytesLoaded();
var totalBytes1:Number = imageHolder.getBytesTotal();
var eggsLoaded1:Number = Math.round(Number(loadedBytes1)/Number(totalBytes1)*100);
if (Number(loadedBytes1) < Number(totalBytes1)) {
eggsLoader._visible = true;
eggsLoader._xscale = Number(eggsLoaded1);
}else{
eggsLoader._visible = false;
if (imageHolder._alpha<100) {
imageHolder._alpha += 10;
}else{
imageHolder._alpha = 100;
trace("all over");
//delete eggsLoader.onEnterFrame;
removeMovieClip(this);
}
}
};
};
////////////////////////////////////////////////////////////////
////////////////////Picture/Text controls///////////////////////
////////////////////////////////////////////////////////////////
myImage = function():Void {
buildMain();
if (myNext == true){
if(p<(total-1)){
p++;
picture_num();
var tlistenerMain:Object = new Object();
tlistenerMain.onLoadInit = function(target_mcMain:MovieClip) {
//target_mcMain._alpha = 0;
};
var image_mcMain:MovieClipLoader = new MovieClipLoader();
image_mcMain.addListener(tlistenerMain);
image_mcMain.loadClip(image[p],"imageHolder");
myLoader();
}else if(p >= total-1){
p=0;
picture_num();
var tlistenerMain:Object = new Object();
tlistenerMain.onLoadInit = function(target_mcMain:MovieClip) {
//target_mcMain._alpha = 0;
};
var image_mcMain:MovieClipLoader = new MovieClipLoader();
image_mcMain.addListener(tlistenerMain);
image_mcMain.loadClip(image[p],"imageHolder");
myLoader();
}
}else if (myNext == false){
//function prevImage()//
if(p>0){
p--;
picture_num();
var tlistenerMain:Object = new Object();
tlistenerMain.onLoadInit = function(target_mcMain:MovieClip) {
//target_mcMain._alpha = 0;
};
var image_mcMain:MovieClipLoader = new MovieClipLoader();
image_mcMain.addListener(tlistenerMain);
image_mcMain.loadClip(image[p],"imageHolder");
myLoader();
}else if(p<=0){
p=total-1;
picture_num();
var tlistenerMain:Object = new Object();
tlistenerMain.onLoadInit = function(target_mcMain:MovieClip) {
//target_mcMain._alpha = 0;
};
var image_mcMain:MovieClipLoader = new MovieClipLoader();
image_mcMain.addListener(tlistenerMain);
image_mcMain.loadClip(image[p],"imageHolder");
myLoader();
}
}
};
firstImage = function():Void {
picture_num();
var tlistenerMain:Object = new Object();
tlistenerMain.onLoadInit = function(target_mcMain:MovieClip) {
//target_mcMain._alpha = 0;
};
var image_mcMain:MovieClipLoader = new MovieClipLoader();
image_mcMain.addListener(tlistenerMain);
image_mcMain.loadClip(image[0],"imageHolder");
myLoader();
};
picture_num = function():Void {
current_pos = p+1;
desc_txt.text = description[p] +" "+ current_pos+" / "+total;
};
////////////////////////////////////////////////////////////////
/////////////////////Thumbnail Functions////////////////////////
////////////////////////////////////////////////////////////////
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
var tot = 0;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if (_root._xmouse>=(600-40)) {
for (var obj in cliparray) {
cliparray[obj]._x -= scroll_speed;
}
if (cliparray[0]._x<-cliparray[0]._width) {
cliparray[0]._x = cliparray[cliparray.length-1]._x+cliparray[cliparray.length-1]._width+5;//last num 5
var j = cliparray.splice(0, 1);
cliparray = cliparray.concat(j);
}
} else if (_root._xmouse<=(0+40)) {
for (var obj in cliparray) {
cliparray[obj]._x += scroll_speed;
}
if (cliparray[cliparray.length-1]._x>600) {
cliparray[cliparray.length-1]._x = cliparray[0]._x-(cliparray[cliparray.length-1]._width+5);//last num 5
var j = cliparray.splice(cliparray.length-1, 1);
cliparray = j.concat(cliparray);
}
}
}
};
thumbnails_fn = function(k):Void {
var yy = thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
cliparray.push(yy);
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = 5+(target_mc._width+5)*k;//num 5 twice
target_mc.pictureValue = k;
tot += target_mc._x;
target_mc.onRelease = target_mc.onReleaseOutside = function() {
removeMovieClip(imageHolder);
buildPreloader();
myCounter = 5;
myNext = true;
p = this.pictureValue-1;
myImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
};
stop();