I’ve been a webmaster since 1997, with programmed graphics, then going into Adobe Photoshop, HTML, and PHP. Then I decided I wanted to do more, so I went into Flash earlier this year. Little did I know what a mess it would turn into. I’m not real comfortable with asking for help, but you’ve got to get comfortable sometime.
I followed the tutorial on kirupa, but instead of getting the stated result, I got the first pic in the gallery array, flashing repeatedly. Can someone help me, please?
Christopher William Coddington (Xzandar / cwcandromeda)
Action.
//Code written by sbeener (suprabeener)
/*
i wrote this code, but you can use and abuse it however you like.
the methods are defined in the order which they occur to make it
easier to understand.
*/
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. “pics/”)
// leave it blank if they’re in the same directory
this.pathToPics = “…/images/gallery/”;
// fill this array with your pics
this.pArray = [“front_gallery_1.jpg”];
this.fadeSpeed = 5;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
}
this.onEnterFrame = fadeOut;
};
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
}
};
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
//------------------------------------------
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
// Actions -----------------------------------------
// these aren’t necessary, just an example implementation
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);
“Next” button action:
Next.
on (release) {
_root.changePhoto(-1);
}
“Back” button action:
Back.
on (release) {
_root.changePhoto(1);
}
================================
I’m 14. I didn’t think these migraines were possible for individuals of my age.
Christopher William Coddington (Xzandar / cwcandromeda)
The tutorial said it was. shrugs I still can’t figure out why only one picture is flashing. It doesn’t even go to the next when I hit the buttons. The first one just flashes repeatedly.
Christopher William Coddington (Xzandar / cwcandromeda)
I’ve never used this code before…but the next thing i see is that you’ve only chosen 1 picture while in the tutorial it gives the code below that specify’s many pics. Where’d you put the rest of the pics to be scrolled?
// fill this array with your pics
this.pArray = ["image0.jpg", "image1.jpg", "image2.jpg", "image3.jpg", "image4.jpg", "image5.jpg", "image6.jpg", "image7.jpg", "image8.jpg", "image9.jpg"];
The error might be with your images. Flash can only load in Non-Progressively saved .jpg images. No other file types are allow, and they MUST be non-progressive. That might be your problem.
Your footer is too big. We are trying to limit that due to lag on the forum and such, please read this…
this may sound silly but it’s all i can come up with, without seeing your file at least…are you sure you have the img keyframes all set to the same length. I added a frame to the end of the actions layer and got some flashing…all layers have ONE frame right?
If that doesn’t solve your prob I would recommend downloading the tutorial and just start by taking that file and changing the graphics to yours. Then if that works…keep adjusting the file until it’s how you want it. At least then you’ve started with a working copy and you can see where you go wrong if you do it again.
*Originally posted by lostinbeta *
**1) The error might be with your images. Flash can only load in Non-Progressively saved .jpg images. No other file types are allow, and they MUST be non-progressive. That might be your problem.
Your footer is too big. We are trying to limit that due to lag on the forum and such, please read this…
And by comparing your file with the file at the end of the download you can check to see if any of your coding or anything is wrong, and if not, then the problem probably has to do with your images (as stated previously :))
The images are standard .jpg files, so I don’t understand what the problem is.
There is only one frame, but one layer seems to be sticking out farther on the frame timeline, so I better figure out how to relieve that.
Geesh! I thought the 500 x 200 sig limit on my clan board was bad. It’ll take a magnifying glass and more time and patience to be able to make a 300 x 60 image.
Christopher William Coddington (Xzandar / cwcandromeda)
And I didn’t use the file from the tutorial, which makes me happy. Although, I find it’s harder that way, but that’s how I learned to do everything I can do now, which I started learning back in 1997.
Christopher William Coddington (Xzandar / cwcandromeda)
excuse me, i am starting to create a photo gallery and i want to ask someone isn’t after i have finish the photo gallery which was taught in kirupa ,do i have to upload the folder of image to the web too