# HELP me with my action script!

**URL:** https://forum.kirupa.com/t/help-me-with-my-action-script/775
**Category:** Uncategorized
**Created:** [July 29, 2002, 6:17pm UTC](https://forum.kirupa.com/t/help-me-with-my-action-script/775 "2002-07-29T18:17:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sk8\_kyle\_420](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@sk8\_kyle\_420](https://forum.kirupa.com/u/sk8_kyle_420)
#### Post date: [July 29, 2002, 6:17pm UTC](https://forum.kirupa.com/t/help-me-with-my-action-script/775/1 "2002-07-29T18:17:49Z")

</div>

I need help what my photo gallery…here is the action script so far…

* * *

this.pathToPics = “[http://www.members.cox.net/twistedkyle/pics/](http://www.members.cox.net/twistedkyle/pics/)”;  
this.pArray = [“1.JPEG”, “2.JPEG”, “3.JPEG”, “4.JPEG”, “5.JPEG”, “6.JPEG”];  
this.fadeSpeed = 20;  
this.pIndex = 1;  
loadMovie(this.pathToPics+this.pArray[+1], \_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() {  
// 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;  
}  
};  
this.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
this.changePhoto(-1);  
} else if (Key.getCode() == Key.RIGHT) {  
this.changePhoto(1);  
}  
};  
Key.addListener(this);

* * *

the first picture will show but it will not fade out and go to the next picture!! plzzz help me…reply here or send me an e-mail at [sk8kyle420@netscape.net](mailto:sk8kyle420@netscape.net)  
thanks

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 29, 2002, 6:32pm UTC](https://forum.kirupa.com/t/help-me-with-my-action-script/775/2 "2002-07-29T18:32:10Z")

</div>

maybe where you have this…

this.onEnterFrame = fadeOut;

put:

this.onEnterFrame = fadeOut();

and also do that where you have fadeIn…put the parenthesis after the name of the function.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 29, 2002, 7:55pm UTC](https://forum.kirupa.com/t/help-me-with-my-action-script/775/3 "2002-07-29T19:55:40Z")

</div>

Its not the fading the other photos wont load. photo 1.JPEG will load but the second photo (2.JPEG) will NOT load

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 29, 2002, 10:01pm UTC](https://forum.kirupa.com/t/help-me-with-my-action-script/775/4 "2002-07-29T22:01:13Z")

</div>

jubb, no brackets in that case. brackets make the function execute, and we just want to point to it, not execute it.

you are pressing the arrow keys to change the pics right?

change this:

```auto

// specify the movieclip to load images into
var p = _root.photo;
// ------------------------------------------

```

to this:

```auto

var p = this.createEmptyMovieClip("photo",0);

```

and remove any clips that you’ve created by hand that may interfere.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 29, 2002, 10:07pm UTC](https://forum.kirupa.com/t/help-me-with-my-action-script/775/5 "2002-07-29T22:07:29Z")

</div>

This still dosent work this is my action script so far…

```auto
this.pathToPics = "http://www.members.cox.net/twistedkyle/pics/";
this.pArray = ["1.JPEG", "2.JPEG", "3.JPEG", "4.JPEG", "5.JPEG", "6.JPEG"];
this.fadeSpeed = 20;
this.pIndex = 1;
loadMovie(this.pathToPics+this.pArray[1], _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 = this.createEmptyMovieClip("photo",0);
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);

```
