PDA

View Full Version : Sequential MC Tweens



subraz
12-28-2006, 03:48 PM
Hi guys,
New to the forum and hope some of you can help. Ive recently downloaded mc tween. (Cant believe I've left it until now, considering its power). Anyway - having a small prob with chained, or sequential tweens.

For example:
I have a movie entitled mc on my main stage. Its colour is ffffff.

I wanted to change it to red, (ff0000) then back to white in 4 seconds. But it wont seem to work quite as desired. IT WILL CHANGE TO RED, BUT WONT REVERT TO WHITE as soon as the 4 seconds are up. The code is as follows.

onClipEvent (enterFrame) {
_root.mc.colorTo(0xff000, 0.5, linear, 0);
_root.mc.colorTo(0xffffff, 0.5, undefined, 4);
}


The colours arent important here, ive just used them for the examples sake. I have had the same problem with all of the mc tween prototypes.

Ive tried various things, including creating a second clip for the delayed action to address. It actually worked, so it seems the problem lies in the fact that I'm addressing the same clip twice, but of course - thats what I need here.

Any of you guys got any advice?
It will be gratefully received if so.

Best
Sub

BLiZZaRD
12-30-2006, 06:43 PM
Not to sure about mctween as a whole, makes for some nasty code and really only works well with AS1. You might be better off coding and tweening by hand.

Either way...

your code is what is wrong here, not the tween, you have an on Enter event happening, and you are telling the MC to do 2 things at once. Thats like me telling you: "as soon as you walk in the door, go to the kitchen and go to your bedroom" You can't do it.

Your best bet is to use an alternate slice of coding. Tell it in enter to go white. Start a count down from 4 seconds, add an if statement telling the MC to go red when time == 0; then restart the counter and tell it to go white when timer reaches 0 again.

That would be the easiest way, and least sloppy, at least while using a 3rd party app. like mctween.

subraz
01-01-2007, 11:35 PM
Hi Blizzard,
Cheers for the reply. Point taken on the coding! However, the way MC Tween is set up, is thus:

e.g
_root.mc.colorTo(0xffffff, 0.5, undefined, 4);

Where the final '4' is actually the delay before that particular line is executed. Hence i thought that would take care of the issue you outlined.

It turns out that the code should actually be applied to the frame and not the clip itself. Works like a treat. You really think Mc Tween is bad? Ive been using flash for years, but have only began in the last few months to delve deeper into AS. Already I'm finding the power offered by MC Tween (at least in light of the lack of effort required) to be quite brilliant.

Cheers again
Sub

BLiZZaRD
01-02-2007, 05:27 AM
I am not saying it is bad I guess I am just too "old school"

I like doing things by hand. That way, when something breaks I know where to go to look to fix it. I also still use plain old notepad for hand coding all my 20,000+ web pages I have created over the last so many moons.

Glad you got it working though :D

subraz
01-03-2007, 01:42 PM
Ha! 'Textpad' is the daddy, I find. But each to his own, as they say!

BLiZZaRD
01-04-2007, 02:40 AM
Notepad+ is pretty good too I hear, but I am stubborn :p