I have two questions about two different things.
I begin with the first question.
Describes the first the thing.
I have a scene as there are photo albums for each image have I a MovieClip object.
The code looks like this:
PHP-Code:
var a24:MovieClip;
a4c_mc.onPress = function () {
_root.scrollMc.disable();
hiden.useHandCursor = false;
hiden._visible = true;
a24 = _root.attachMovie("fmap1", "a24a", _root.getNextHighestDepth(), {_x:(Stage.width-565)/2, _y:(Stage.height-492)/2});
a24._alpha = 0;
checkImagea24();
};
checkImagea24 = function () {
_root.createEmptyMovieClip("begin04", _root.getNextHighestDepth());
_root.begin04.createTextField("ab1_txt", this.getNextHighestDepth(), ((Stage.width-a24._width)/2)+(a24._width-460)/2, 585, 460, 20);
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "_serif";
my_fmt.size = 15;
my_fmt.bold = true;
my_fmt.color = 0xffffff;
_root.begin04.ab1_txt.text = "Text Text Text Text Text Text Text Text";
_root.begin04.ab1_txt.setTextFormat(my_fmt);
_root.begin04.ab1_txt.setTextFormat(my_fmt);
_root.begin04.ab1_txt.selectable = false;
_root.begin04.ab1_txt.wordWrap = false;
_root.begin04.ab1_txt.background = true;
_root.begin04.ab1_txt.backgroundColor = 0x000000;
var myDropFilter = new DropShadowFilter();
myDropFilter.blurX = 25;
myDropFilter.blurY = 10;
myDropFilter.angle = 180;
myDropFilter.inner = true;
myDropFilter.alpha = 100;
myDropFilter.color = 0xFFFFFF;
var myFilters:Array = _root.begin04.ab1_txt.filters;
myFilters.push(myDropFilter);
_root.begin04.ab1_txt.filters = myFilters;
var text1:Tween = new Tween(_root.begin04.ab1_txt, "_alpha", None.easeNone, 0, 100, 1, true);
text1.onMotionStarted= function() {
_root.begin04.ab1_txt._visible = true;
};
a24.cacheAsBitmap = true;
new Tween(a24, "_alpha", Strong.easeOut, 0, 100, 2, true);
a24.useHandCursor = false;
bgalpha._visible = true;
a24.onPress = function () {
_root.begin04.ab1_txt._visible = false;
bgalpha._visible = false;
var myTween8:Tween = new Tween(a24, "_alpha", Strong.easeOut, 100, 0, 2, true);
myTween8.onMotionFinished = function() {
a24.fmap1 = stopTweens();
hiden._visible = false;
_root.scrollMc.enable();
a24.removeMovieClip();
_root.begin04.removeMovieClip();
};
a24.onPress = undefined;
};
};
In this scene have I from a programmer taken this function
PHP-Code:
function stopTweens(target:MovieClip):Void {
target = target || _level0;
for (var i in target) {
if (typeof (target[i]) == "object" && target[i] instanceof Tween) {
target[i].stop();
}
if (typeof (target[i]) == "movieclip") {
stopTweens(target[i]);
}
}
}
After image MovieClip object a24 goes up in code see here
PHP-Code:
a24 = _root.attachMovie("map1", "a24a", _root.getNextHighestDepth(), {_x:(Stage.width-565)/2, _y:(Stage.height-492)/2});
.........
new Tween(a24, "_alpha", Strong.easeOut, 0, 100, 2, true);
a24.onPress = function () {
.........
var myTween8:Tween = new Tween(a24, "_alpha", Strong.easeOut, 100, 0, 2, true);
myTween8.onMotionFinished = function() {
a24.map1 = Tweenbl.stopTweens();
After I have clicked the MovieClip object a24 goes down but then freezes everything.
I then get in the Output window from Test Movie where I get the text
"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."
In MovieClip object map1 have I several tween objects in one MovieClip object.
Then after I have clicked on the a24 so would I stop all Tween motion in MovieClip object map1 whatever.
When I click MovieClip object a24 again so shall be Movieclipt object map1 start over again.
How do I do it with the function stopTweens without other MovieClip with Tween be stopped.
I conclude with the second question.
If I have a scene that contains this code
PHP-Code:
function stopTweens(target:MovieClip):Void {
}
function starta() {
_global.c.onPress = function () {
Tweenbl.stopTweens();
var black1:MovieClip = _root.attachMovie("blackbg", "black", _root.getNextHighestDepth(), {_x:0, _y:0});
var black2:Tween = new Tween(black1, "_alpha", None.easeNone, 0, 100, 3, true);
black2.onMotionFinished = function() {
gotoAndStop("scene2")
};
};
How do I get the function stopTweens in this _global.c.onPress = function () { nested function.
Where c is MovieClip object.