flash actionscript:
Hi
I have a problem with a slideshow I've made. It works fine untill I call the
script again and then I get an error telling me
"256 levels of recursion were exceeded in one action list.
This is probably an infinite loop.
Further execution of actions has been disabled in this movie."
Can anyonw tell me how I can avoid this?
Here's the code...
Movieclip.prototype.oldLoadMovie=Movieclip.prototype.loadMovie
Movieclip.prototype.loadMovie=function(url,vars){
if(this.onData != undefined && this.onData != null){
this._parent.createEmptyMovieClip("__fixEvents",7777)
this._parent.__fixEvents.theTarget=this
this._parent.__fixEvents.onData=this.onData
if(this.onLoad != undefined && this.onLoad != null){
this._parent.__fixEvents.onLoad=this.onLoad
}
this._parent.__fixEvents.onEnterFrame=function(){
this.oldv=this.v
this.v=this.theTarget.getBytesLoaded()
if(this.v != this.oldv){
this.onData.call(this.theTarget)
}
if(this.v == this.theTarget.getBytesTotal() && (this.theTarget._width
[quoted text, click to view] > 0) && (this.theTarget._height > 0)){
this.theTarget.onData=this.onData
if(this.onLoad != undefined){
this.theTarget.onLoad=this.onLoad
}
this.onLoad.call(this.theTarget)
this.removeMovieClip()
}
}
}
this.oldLoadMovie(url,vars)
}
this.createEmptyMovieClip("myImage",4);
myImage.onLoad = function() {
var maxWidth = 900;
var maxHeight = 670;
if (this._width>maxWidth || this._height>maxHeight)
{
var scaleFactor = this._width>this._height ? maxWidth/this._width :
maxHeight/this._height;
this._width = Math.floor(this._width*scaleFactor);
this._height = Math.floor(this._height*scaleFactor);
}
}
myImage.onData = function() {
}
myImage._alpha=0;
mypic=1;
_root.onEnterFrame = function()
{
if (myImage._alpha <10)
{
myImage.loadMovie("maspalomas/image"+mypic+".jpg", "myImage")
fadeOut=false;
fadeIn=true;
message.text = mypic; }
}
if (myImage._alpha > 10 && fadeOut)
{
myImage._alpha -= 10;
}
if (myImage._alpha < 100 && fadeIn && !fadeOut)
{
myImage._alpha += 10;
}
else
{
fadeIn=false;
}
}
next.onPress = function()
{
if( mypic < 10 && !fadeIn && !fadeOut)
{
fadeOut=true;
mypic++;
}
if(mypic >= 10)
{
mypic=1;
}
}
back.onPress = function()
{
if (mypic > 1 && !fadeIn && !fadeOut)
{
fadeOut = true;
mypic--;
}
if (mypic == 1 && !fadeIn && !fadeOut)
{
fadeOut=true;
mypic=10;
}
}
{
autoAdvance();
setInterval(autoAdvance, 10000)
}
function autoAdvance()
{
if (mypic <= 10 && !fadeIn && !fadeOut)
{
fadeout=true;
mypic++;
}
if (mypic > 10)
{ mypic=1;
}
if (mypic == 10)
{
_root.gotoAndStop("map");
}
}
Cheers