I Just Can't Take It

Banging My Sore head for 2 days.

I’ve been through the excellent thread on photo gallerys featuring Scott on crank and have finally pulled most of my head out, but I desperately need a bit of assistance. Have posted a photo gallery sans photo’s running off an xml file based on the V3 photogallery.

Here is where I’m having prob’s:

  1. For some reason, the first photo in the xml datebase (pic1.jpg) does not load when button#1 is pressed. The gallery starts with #2? I just don’t understand why.
  2. On load, the preload bar is presend even though i’ve got visible = 0.
  3. The BIG one. Right now I’ve got an empty frame for my thumb buttons. What I really want to do is have a single button prototype that duplicates itself and externally loads a thumb*.jpg rather than placing each thumb*.jpg on each button manuelly. There was an example on the same thread, but I was unable to combine the two.

Hope this is clear.

Any help is GREATLY appreciated. :upset:

before I download your file and have a look at it I think I might be able to get you going in the right direction for the first two problems.

  1. This sounds like a function using a counting system starting at 0, and a picture loading system that starts counting at 1. I might be able to explain more in a few.
  2. use _visible=false; the 0 thing used to work and still does [U]sometimes[/U] however it randomly decides not to work.
  3. in the morning…

okay, I took care of the correct image loading first by manually loading it on start, but when anything before 1 or after 16 (total images) NaN% loaded comes up. Like a loop is needed to return to 1 or goto 16.

I fixed the bar problem.

After looking at your file I noticed that you are loading pics into containerMC then trying to check containerMC.getBytesLoaded(), etc. I found that if you create an empty movieclip inside the containerMC then load the pic into the emptyMC you can check the containerMC.getBytesLoaded(), and it will return something other than “undefined” which is why you get the NaN%.

Since you don’t have a whole lot of comments or labels I am assuming the nine boxes in the top left corner are going to be the thumbs. I would convert all of these to MC’s then just apply the button actions to them. ie
onClipEvent(load){
this.onPress = function(){
//do something when I get pressed
}
}
This way you will be able to duplicate the movieclips for dynamic creation of the thumbs.

Will try the fix for getbitesloaded. Yes, the boxes represent thumbs. But what I’m trying to do is dynamically load a thumb array in a scroll-box that works with the existing .fla that you have. Basically taking two topics from the now infamious Scotty thread and combining them. I’ve attached an example of the thumb array I was working from. But rather than resizing an image, I want to call from a seperate xml that loads thumbs.

Hope this is clear.

In regards to to na%, this is only happening when a button selectin (forward or back) tries to go past the confines of the xml file. In this case, it is 16 images. I need some sort of loop so that if <1 is called the array goes to the last image etc.

Don’t know how to do this.

@1: the xml makes/fills arrays. Arrays are zero-based, so the first element in an array is [0]. In your code you have for your first thumb: loadPic(1), which refers in the loadPic function at loadMovie(pArray[1]), which will load the second picture;)
@2: The loadbar isn’t set invisible at load, it’s been set invisble after the first pic has been loaded.
Add somewhere in your code (eg at the top)

bar._visible = 0;

@3: You can use the method in the test fla. In the scrll mc refer to _root.pArray instead of image_array:)

scotty(-:

Thanks a lot Scotty. Does this mean I should lable my *.jpg’s starting with “pic0.jpeg” rather than “pic1.jpg”? I understand using pArray to define what the thumbs are calling when pressed, but how do I load thumbs from a seperate thumb array if I want to use seperate thumb .jpeg’s rather than a scaled version of the original pic.

Thanks again for taking the time to explain.

Okay, this is the two previous .fla’s combined. I’m now very confused. I’ve changed the button code to _root.pArray as suggested, but, well…

No:)
you have this in your first thumb:

on (release) {
	this._parent.containerMC.loadPic(1);
}
on (rollOver) {
	overtxt.text = this._parent.tArray[1];
}
on (rollOut) {
	overtxt.text = "";
}

Like I’ve said array’s are zero-based so this will call the second element in the array. Change both “1”'s in “0”…[size=1]And off course decrease for all other thumbs the value with 1:)[/size]

…I understand using pArray to define what the thumbs are calling when pressed, but how do I load thumbs from a seperate thumb array if I want to use seperate thumb .jpeg’s rather than a scaled version of the original pic.

In your XML make another attribute for your thumb.jpg. And in Flash put that attribute (in the xml load) in “thumbArray”. Now you can refer to that in “scrll” as “_root.thumbArray”

I diidn’t look at your most recent fla yet, will do that;)
editOops, there’s no fla in the zip [size=1](just an xml and a fla.copy…)[/size]

scotty(-:

Sorry, fixed the .fla. Was the file, but removed the “copy” txt to turn it back into a .fla file. Everything is working except the thumbs. Added new array to xml and fla and generally tried to do everything you suggested, but, well, let’s just say i’m learning a lot. Thanks for your patience scotty.

By the by, if you do look at the new test I uploaded, it is my intention to change the resize function to just a thumb load + i used the actual image as my thumb in the xml. Will go back and change all after I get the basic functionality down and understand htf things work.

It’s working now, I’ve commented the changes in the AS (main+scroll mc).
Main problems:
*The zero based arrays (and xml), kirupa wrote something on that:)
http://www.kirupa.com/developer/actionscript/array.htm

*When the xml loads, the arrays aren’t defined instantly, but it takes a (very little) while, so thumbs weren’t working because thumbArray was undefined. I’ve made some setintervals for the thumbs and for loading the first picture (that one worked, but won’t if you put it online(without the setInterval))

Hope this will help you=)

scotty(-:

Man, you rock Scotty. I can’t thank you enough. Will sit down and digest this so I understand what’s happening.

thanks again.

no problem:thumb:
Have fun with it:lol:

scotty(-: