Hello all,
I’m trying to load and unload a MovieClip with the same button. And it works, but it will only let me load and unload the MC once. After the first time, it stops loading. I believe this is because after the first load it only reads the unload code. I’m not sure how to solve this, here’s my code:
[LEFT]my_btn.onPress = function()
{
captionFNtst(true,“tst”,this);
this.onPress = function()
{
captionFNtst(false);
};
};
captionFNtst = function (showCaption, captionText, bName)
{
if (showCaption)
{
_root.createEmptyMovieClip(“tst”,this.getNextHighestDepth(),{_x:100, _y:100});
if ((bName._width + bName._x + tst._width) > Stage.width)
{
xo = 0 - tst._width;
yo = 0;
}
else
{
xo = 0;
yo = 0;
}
tst.onEnterFrame = function()
{
tst._x = 100;
tst._y = 100;
tst._visible = true;
};
}
else
{
delete tst.onEnterFrame;
tst._visible = false;
}
};
[/LEFT]
I’ve also tried this suggested code, but it doesn’t work at all when I use this version:
[COLOR=#000000]load_movie = false;
my_btn.onPress = function()
{
load_movie = !load_movie;
};
if(load_movie == true){
captionFNtst(true,“tst”,this);
} else {
captionFNtst(false);
}
captionFNtst = function (showCaption, captionText, bName)
{
if (showCaption)
{
_root.createEmptyMovieClip(“tst”,this.getNextHighestDepth(),{_x:100, _y:100});
if ((bName._width + bName._x + tst._width) > Stage.width)
{
xo = 0 - tst._width;
yo = 0;
}
else
{
xo = 0;
yo = 0;
}
tst.onEnterFrame = function()
{
tst._x = 100;
tst._y = 100;
tst._visible = true;
};
}
else
{
delete tst.onEnterFrame;
tst._visible = false;
}
};
[/COLOR]
Is there some code I can add at the end to get the actions to start again from the top? Any help is very much appreciated.
Thanks,
Jennifer