Hey,
I'm creating a site at the moment that needs to have a really good sense of
flow. This means that I feel nothing can just 'jump' in and out of frames. No
sudden appearances, everthing needs to look like it's supposed to happen. This
has left me with three problems that I need abit of help with!
1) I need to make a white box background resize from whatever size it is to a
new size (that would be defined my the button clicked) Its so that the
background can morph from any size smoothly. Any ideas? I've put the white box
inside a movie clip so that the actionscript can target it. and then I guess it
resizes it to the x and y values that the button defines, but i need it to
tween as well!
2) 'Out' animations. This has annoyed me for a while, how to I get a page to
play a quick )like 5 frames (24fps) at the most and then move onto the page
that the user wants. So the process would be. User clicks button - current
content loads out - new content loads in.
3) Is there a way that I can say 'if' the playhead is at a certain frame in a
movie clip, then move it somewhere else. The thing is, I want a menu button to
go back to its original state - if it was the one seleceted on the previous
page.
I know it all sounds abit confusing! Message again if there's anything that
needs to be cleared up!
I don't necessarily need EXACT answers, even just pointers to relevant
articles e.t.c would be useful. I'm always up for widening my actionscript
knowledge!
Cheers in advance
Sam Goudie
dzedward - 27 Jun 2007 16:45 GMT
1) import mx.transitions.easing.*;
import mx.transitions.Tween;
var tw:Tween = new Tween(yourmc, "_width",
mx.transitions.easing.Strong.easeOut, start(number value), finish(number
value), time(in seconds), true); //if false, time will be in frames
do the same for the "_height" but use var tw2:Tween or something, as long as
the variable names arnt the same.
2)same as above, if this is different frame, then you need to import the two
classes again
var tw:Tween = new Tween(yourmc, "_alpha" or "_x" or "_y" or any _mc property,
mx.transitions.easing.Strong.easeOut, ....the rest);
tw.onMotionFinished = function() {
//do something when the animation has finished
}
3) put this somewhere in the root timeline
onEnterFrame = function(){
if(yourmc._currentframe == 10){ //10 refers to the frame number
//do something when it gets there
delete this.onEnterFrame;
}
}
you should read up on the Tween class, its very useful, and you can broaden
what i provided as examples.
mynameissam.co.uk - 28 Jun 2007 12:09 GMT
Thanks for that man, a quick question:
In 1) how do I make it that the the box will morph from an UNDEFINED size.
This is so that no matter what page its on it will still morph to the new size
smoothly
Cheers
dzedward - 28 Jun 2007 16:00 GMT
set up a variable to get the current size then plug the variable in, should work.
mynameissam.co.uk - 28 Jun 2007 16:17 GMT
cheers man, all works great!