View Full Version : [FMX] loops with attached movie for fade out effect
planetfour
July 27th, 2003, 05:26 PM
Hey wonderful helpers in the kirupa world... :beam:
I'm trying to achieve an effect such that when a user rolls over a movie clip, a new movie clip appears, enlarges and fades out over the original. Sorry no example, i just cooked it up in my head.
I've managed to attach a movieclip to the main stage, but I can't get it to ripple out, so to speak, like I wanted to.
I've been trying to do it by altering the height, with, and alpha with a loop, but something's just not right. The following code is attached to the movie clip I want this to happen for. New to AS, be gentle!!:P
on (rollOver) {
_root.attachMovie ("aaronName","aaronClone",1);
aaronClone._x = aaronName._x;
aaronClone._y = aaronName._y;
for (var i = 1; i <= 6; i++) {
aaronClone._height = aaronClone._height * (i*(.1));
aaronClone._width = aaronClone._width * (i*(.1));
aaronClone._alpha = aaronClone._alpha - (i*(15));
}
}
can anyone lend a hand?
pom
July 27th, 2003, 07:46 PM
for loops execute in 1 frame. If you want to see the fade, you'll have to change your _height, _width and _alpha over a few frames, with a onEnterFrame handler for instance.
pom :)
planetfour
July 28th, 2003, 10:52 PM
OK, I got it to work with the following code (thanks for the tip!:smirk: )
on (rollOver) {
attachMovie ("aaronName","aaronClone",1);
aaronClone._x = aaronName._x;
aaronClone._y = aaronName._y;
}
onClipEvent (enterFrame) {
aaronClone._height = (aaronClone._height * 1.1);
aaronClone._width = (aaronClone._width * (1.1));
aaronClone._alpha = (aaronClone._alpha - (15));
if (this.aaronClone._alpha < 10) {
this.aaronClone.removeMovieClip;
}
}
on (rollOut) {
delete (this.aaronClone);
}
Now when I roll over I get the desired effect. However, if I then roll out of the movie, then rollback into it, the loop just starts repeating. I'm thinking I'm not using remove and/or delete in the right context or the right way?
The code is on a movie clip on the main timeline, which lasts for about 6 frames.
Any help? I'm learning!!
planetfour
July 29th, 2003, 07:45 PM
OK, got it to work with the following code (darn parens and ==!),
on (rollOver) {
attachMovie ("aaronName","aaronClone",0);
aaronClone._x = aaronName._x;
aaronClone._y = aaronName._y;
}
onClipEvent (enterFrame) {
aaronClone._height = (aaronClone._height * 1.1);
aaronClone._width = (aaronClone._width * (1.1));
aaronClone._alpha = (aaronClone._alpha - 15);
if (this.aaronClone._alpha == 10) {
this.aaronClone.removeMovieClip();
}
}
on (rollOut) {
this.aaronClone.removeMovieClip();
}
but now a couple more questions... I'd like the effect to repeat for the duration of the mouseover, any way to do this? Also, if I remain over the clip until the "clone" is removed, my cursor remains a hand instead of turning back into a pointer! Help a novice out!!
planetfour
July 30th, 2003, 11:41 PM
sorry to gratuitously bump... can anyone help me understand how to use the onRollOver correctly?
Hope I didn't post in the wrong forum... if so, mods, lemme know or move...
Thanks!!
upuaut
July 30th, 2003, 11:54 PM
Not sure if this is what you're looking for, but you might give it a try. I also simplified the enterframe alterations using *= and -=. These just say, "aaronClone._yscale *=1.1;" take aaronClone's yscale and multiply it by 1.1.
on (rollOver) {
attachMovie ("aaronName","aaronClone",0);
aaronClone._x = aaronName._x;
aaronClone._y = aaronName._y;
}
onClipEvent (enterFrame) {
aaronClone._yscale *=1.1;
aaronClone._xscale *= 1.1;
aaronClone._alpha -=15);
if (this.aaronClone._alpha == 10) {
this.aaronClone._alpha=100;
this.aaronClone._yscale=100;
this.aaronClone._xscale=100;
}
}
on (rollOut) {
this.aaronClone.removeMovieClip();
}
planetfour
July 31st, 2003, 10:01 AM
Now that's some thinkin... woulda never thought of just overlaying the attached mc. Not at home right now, but I'll try that tonight!
Thanks!:goatee:
planetfour
August 1st, 2003, 02:14 PM
OK, that's a cleaner approach I think, but in Control Test movie, if I've seen one whole cycle of the code (make sense? alpha gets all the way to 10, and the mc is rescaled...) then when I rollout of the mc, the mouse doesn't change back to a pointer, it's a finger still. until I roll out of the stage altogether and roll back in.
Any help in that area? Sound familiar? Forever in debt to kirupa once again.
planetfour
August 4th, 2003, 03:33 PM
has anyone ever experienced anything like this?
planetfour
August 14th, 2003, 11:17 PM
Originally posted by planetfour
OK, that's a cleaner approach I think, but in Control Test movie, if I've seen one whole cycle of the code (make sense? alpha gets all the way to 10, and the mc is rescaled...) then when I rollout of the mc, the mouse doesn't change back to a pointer, it's a finger still. until I roll out of the stage altogether and roll back in.
Sorry to bring back the dead here, (especially after my own repeated bumps and all:smirk: ) but I've picked up this project again, and can't seem to figure out why the above occurs. I figured I'd throw up a quick fla for anyone who could possibly assist.
Still an actionscript newb, so can someone explain why I can't get rid of the finger? Perhaps I should just change it to a pointer at all times?
Edit: whoops, guess that fla was too big, and for some reason it the board only lets me post gifs and jpgs. so... guess this really is a gratuitouis bump.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.