help for an idiot -- actionscripting 101
I'm not very good at flash. PHP by trade so forgive the ignorance.
What I want to do is a basic slideshow with as much actionscripting as possible since I'm so bad at working w/ the stage. The images cannot be dynamically loaded.
The problem is I don't even know what's possible and am having trouble understanding... well almost everything!
I'm thinking, instead of loading the images into frames, I can load them into the library. (?) I can then create one movie clip on the stage to load images into and put the names of the images into an array. "next" button will add 1 to the index of that array, "previous" will subtract displaying the proper image.
Is that wrong?
*What about preloading? Can I preload all the images and still display only one?
I want to have about 3 swf slideshow files like this with one main movie where you can click and choose which slideshow you want to see. If I do that can I still name all the jpgs as 001.jpg, 002.jpg for each slideshow or will that cause a conflict since the 001.jpg in the mountain slideshow is different than the 001.jpg in the desert slideshow? in other words, are libraries always shared?
*I have completed this whole project and now found out I can't dynamically load all the jpgs. They need to be "in" the movie. I have tried to manipulate that code but... error... ! If anyone can help me manipulate the code below I would love it. The pre-loader thing concerns me since I don't have one on this...was planning on preloading with the main movie onclickevent as the other swfs were called.
Here's a piece of that code: (this works perfectly)
I'm not very good at flash. PHP by trade so forgive the ignorance.
What I want to do is a basic slideshow with as much actionscripting as possible since I'm so bad at working w/ the stage. The images cannot be dynamically loaded.
The problem is I don't even know what's possible and am having trouble understanding... well almost everything!
I'm thinking, instead of loading the images into frames, I can load them into the library. (?) I can then create one movie clip on the stage to load images into and put the names of the images into an array. "next" button will add 1 to the index of that array, "previous" will subtract displaying the proper image.
Is that wrong?
*What about preloading? Can I preload all the images and still display only one?
I want to have about 3 swf slideshow files like this with one main movie where you can click and choose which slideshow you want to see. If I do that can I still name all the jpgs as 001.jpg, 002.jpg for each slideshow or will that cause a conflict since the 001.jpg in the mountain slideshow is different than the 001.jpg in the desert slideshow? in other words, are libraries always shared?
*I have completed this whole project and now found out I can't dynamically load all the jpgs. They need to be "in" the movie. I have tried to manipulate that code but... error... ! If anyone can help me manipulate the code below I would love it. The pre-loader thing concerns me since I don't have one on this...was planning on preloading with the main movie onclickevent as the other swfs were called.
Here's a piece of that code: (this works perfectly)
Code:
this.pathToPics = "mountains/";
this.pArray = ["title.jpg", "001.jpg","002.jpg", "003.jpg", "004.jpg", "005.jpg", "006.jpg", "007.jpg", "008.jpg", "009.jpg", "010.jpg", "011.jpg", "012.jpg", "013.jpg", "014.jpg", "015.jpg", "016.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
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() {
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;
}
};
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);