Any ActionScript guru's here?

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
697
0
United Kingdom
I'm doing a bit of Flash work and I've got a bit stuck with some ActionScripting... I was just wondering if anyone might know a solution!?

http://www.willcheyney.co.uk/guide.swf

Take a look at 'guide.swf' (link above).

Hover your mouse over the options and notice that animations kick in. The option I'm having trouble with is 'WORK'. If you hover and leave your mouse over it a series of additional 'pillbox' options run in. Move your mouse out after they have all appeared, and the animate themselves out. Fine. However, if you don't leave your mouse in place until all addition 'pillboxes' have come in, then the animation will jump. All the additional 'pillboxes' will be displayed suddenly, and the outro animation will then play. This is my problem!

I need code so that if the mouse is pulled off the 'WORK' option mid-flow (before all additional 'pillboxes' have had a change to animate in), the animation reverses itself from wherever it is and animates itself out.

Does that make any sense? My portfolio (www.willcheyney.co.uk) does a similar thing of playing the timeline in reverse, but I haven't manage to 'translate' the code to this as it were.

Any assistance would be much appreciated!
Thanks.
 

Coheebuzz

macrumors 6502
Oct 10, 2005
351
1
Nicosia, Cyprus
Actually all your buttons have the same behaviour if you look carefully.
Thats because when you rollOut you tell the movieclip to play the outro anmation which is what it does now.

Put this code in the button or mc so it will play the outro animation to the corresponding frame and not from the beginning.

Code:
on (rollOut) {
	gotoAndPlay(this._totalframes - this._currentframe);
}
Let me know how it goes.
 

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
697
0
United Kingdom
Thank you so much!

OK, we're almost there... Everything almost works perfectly. If you move the mouse of the option mid-animation flow, it plays begins to play the outro from it's current position and everything starts to slide back out. Yay!
The problem is if you leave in the intro animation to play fully and then mouse your mouse off, it doesn't commence the outro :(
Is having an set of motion tweens to the intro and another set for the outro the best way of doing this? Is there a way of just reversing the intro?

Here is how it functions with your code: http://www.btinternet.com/~nicame/guide2.swf

Would having the source .fla help? http://www.btinternet.com/~nicame/guide.zip
(MX, 2004 and 8 versions are included as I don't know what edition of Flash you have!).

Contact me via email if needs be!
me@willcheyney.co.uk


Many thanks.
 

Coheebuzz

macrumors 6502
Oct 10, 2005
351
1
Nicosia, Cyprus
Oh yeah just make sure that your intro and outro animations have the same number of frames. I've noticed in the file that for the 'Work' animation you have 45 frames for the intro animation but less for the outro. Fix it to be the same and it will work. ;)
 

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
697
0
United Kingdom
Just wondering about the same thing for for 'ABOUT' option. As this has a 'click' animation, I can't apply the same code to the button.
Is there a way of limiting the same code/idea it to just a select range of frames from within a movie clip?

If you look in 'pill_about' instance, you will see that frames 1-12 is the intro animation, and frames 12-22 is the outro.
Tweens after that point are initiated once a user clicks the 'ABOUT' button.
 

Coheebuzz

macrumors 6502
Oct 10, 2005
351
1
Nicosia, Cyprus
Would it help if you could reverse the animation for the outro? It will save you alot of frames and it helps alot to optimize things as much as possible in Flash.

So this simple code should do fine:

Code:
onClipEvent (enterFrame) {
	if (workAnimation == "intro") {
		nextFrame();
	} else {
		if (workAnimation == "outro") {
			prevFrame();
		}
	}
}

on (rollOver) {
	workAnimation = "intro";
}
on (rollOut) {
	workAnimation = "outro";
}
Just put a 'stop' command on the first and last frame of your animation in the timeline.

I just wish Objective-C was this simple :mad:
 

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
697
0
United Kingdom
Wow! Perfect... How'd you get so good? :D
Dude, you got an email address/IM contact? It'd be good to chat! PM/email me if you are worried about disclosing such info here.

Thanks so much
 

Coheebuzz

macrumors 6502
Oct 10, 2005
351
1
Nicosia, Cyprus
Will Cheyney said:
Wow! Perfect... How'd you get so good? :D
Dude, you got an email address/IM contact? It'd be good to chat! PM/email me if you are worried about disclosing such info here.

Thanks so much
Just by asking around as you do now actually. I'll add you to my msn if you want when it decides to connect! :rolleyes:
 

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
697
0
United Kingdom
I'm having some more troubles with the Flash project I'm working on!
This time, I feel it is a lot simpler, but for the life of me can't work out why something isn't happening!

Basically, I'm trying to get a nested mc to play another nested mc upon clicking it.

This is the code I am using:

Code:
on (press) {
	_root.open.about.aboutlaunch.gotoAndPlay(2);
}
For some reason however, it wont trigger the desired animation.
I don't know if I'm being a bit vague, so check your PM's for a link to the most recent save of the .fla.

The mc I am having trouble with is found here:
Scene 1 >open > pill_work > frame 55

For the time being, I'm just trying to get the first button, '3DMM STUDIO' to work. I want it so that when you click it, it plays the animation nested within it (from frame 2).

Thanks for this... I owe you big-time!

Any questions/queries, don't hesitate to contact me!
MSN: willcheyney@msn.com / AIM: willcheyney / EMAIL: me@willcheyney.co.uk
 

Will Cheyney

macrumors 6502a
Original poster
Jul 13, 2005
697
0
United Kingdom
Fixed it! The problem was that the button on press is not being called at all instead the parent movieclips on press is being called.

I added this code to the root of the timeline:

Code:
_root.onMouseMove = function()
{
    if (open.work.hitTest(_xmouse, _ymouse, true))
    {
        open.work.workAnimation = "intro";
    }
    else
    {
        open.work.workAnimation = "outro";
    }
}
... and removed the (rollOver) and (rollOut) functions from 'pill_work' instance. The (onPress) for the additional nested button now works!