flash AS question
- Started
- Last post
- 40 Responses
- CygnusZero40
^ sorry, now scales from 125% to 25%, need fade out to start earlier
- CygnusZero40
One more question about this, sorry guys. Im using this code that orpkoobcam2 gave me, and it works great. Like I said Im going to have like 65 movie clips, and I have this code in each one of them, which means if I build all this and they want to change the speed of the scale for example, I would have to go into each one and change it in the code.
Is there a way that this code doesnt sit within each of these clips, but rather say 1 timeline up, and there is something in the clips that references this code? Just would like some way to set this up so that if they want to make a change, I only need to change it in one place and all of the clips see that one piece of code.
- Hombre_Lobo0
how disappointing,
i read this as 'Flash ass question'. I thought i might be able to show my expertise for once :(
- CygnusZero40
Fucker, you got me all excited when I saw the 32 next to my topic. >.<
- orpkoobcam20
http://www.kirupa.com/developer/…
is each movieclip going to be a separate .fla or all in the same .fla?
- CygnusZero40
^ just 1 fla with 65 MCs in it
- redant0
Have you tried using this? http://www.greensock.com/tweenli…
- Even if you don't use this, you should learn it as one of your main Flash tools.CyBrainX
- CygnusZero40
A friend of mine told me to try this--
// One level up
function doMyAnimationYo(targetMC)
{
new mx.transitions.Tween(targetMC, "_alpha", mx.transitions.easing.None.easeN... 0, 100, 30, false);
var scaleup = new mx.transitions.Tween(targetMC, "_yscale", mx.transitions.easing.None.easeN... 125, 25, 150, false);
var scaleup = new mx.transitions.Tween(targetMC, "_xscale", mx.transitions.easing.None.easeN... 125, 25, 150, false);
scaleup.onMotionChanged = function()
{
if(scaleup.time == 120){
new mx.transitions.Tween(targetMC, "_alpha", mx.transitions.easing.None.easeN... 100, 0, 30, false);
}
}And then inside each clip put this._parent.doMyAnimationYo(thi...
Getting these errors, some problem with the open the open/close brackets. Any ideas?
Symbol=main, layer=actions, frame=1, Line 3 Statement block must be terminated by '}'
Symbol=main, layer=actions, frame=1, Line 12 Syntax error.
- orpkoobcam20
blimey.
is it one after another? or randomly? or interactively?
you can do this if it sequentially - clip 1 to clip 65:
http://pastebin.com/xEvM5Q6ajust name all your clips sequentially from myclip1_mc to myclip65_mc.
- of course you will need to hide all the other clips on the stage whilst the other animates...orpkoobcam2
- orpkoobcam20
put all 65 clips on the stage. - can be on different layers.
then use this:it hides them all and only reveals the one to be animated when needed. plays all clips one after another from clip 1 to 65.
- Mishga0
Are you sure you don't want to use tweens???
Will be pretty easy....
send me your fla...
- CygnusZero40
^ I have to animated 65 movieclips, and they made end up making changes, I CANNOT use tweens for this thing.
- Are you talking about timeline Tweens or Tweens Extensions like greensock or fuzekit?Mishga
- i was talking about dynamic fadein, scale...etc...Mishga
- Timeline, cant do those for this. Never used any extensions.CygnusZero4
- Yeah, thats what I need.CygnusZero4
- send me your fla...Mishga
- Ok I willCygnusZero4
- CygnusZero40
^ Almost working, except Im seeing all the clips turned on, they arent hidden.
- Used your latest code too. Not sure if it matters that I only have 6 clips right now, not 65 yet.CygnusZero4
- shouldn't matter too much if there's only 6.orpkoobcam2
- ifeltdave0
GTween
- CygnusZero40
^ I just tried turning their alpha to 0 by default and its working fine now.
- yeah that's a quick fix. if it works go for it.orpkoobcam2
- fyoucher10
Greensock as redant mentioned above is probably best and something you should learn as it's kind of a standard nowadays (TweenMax, TweenLite, or TweenNano).
Or if you're using AS2, mctween2 is really easy to understand if you've never used a tweening engine before.
http://hosted.zeh.com.br/mctween…For mctween2, just download the AS file and put it next to your FLA. There are extensions you can download but just scroll down the Downloads page and download the AS file instead.
Then in your actions panel in a frame where your movieclip is type the following:
(Assuming your FLA is 30 FPS, it's AS2, and the movieclip is called myClip)#include "mctween_2_28_29.as"
//Start off at 150% scale
myClip._xscale = myClip._yscale = 150;//Scale to 0% over 5 seconds
myClip.scaleTo(0, 5, "linear");
//The easing equation can be many different things.
//Look up those string values ("easeOutQuart", "linear", etc) here >
//http://hosted.zeh.com.br/mctwe...//fade in 0 > 100% alpha
myClip._alpha = 0;
myClip.alphaTo(100, 1, "linear");//fade out at end
myClip.alphaTo(0, 1, "linear", 4);
// the last parameter 4 is the delay value. So it'll fade out after 4 seconds.
- Pixter0
addEventListener(Event.ENTER_FRA... decrease);
function decrease(e) {
anymovieclip.scaleX-=.01;
if (anymovieclip.scaleX<=0) {
removeEventListener(Event.ENTER... decrease);
}
}
- fyoucher10
You can even turn all of that into a function or prototype for reusing across movieclips
MovieClip.prototype.scaleAndfade = function():Void {
this._xscale = this._yscale = 150;
this.scaleTo(0, 5, "linear");
this._alpha = 0;
this.alphaTo(100, 1, "linear");
this.alphaTo(0, 1, "linear", 4);
}myClip1.scaleAndFade();
myClip2.scaleAndFade();
myClip3.scaleAndFade();
etc, etc, etc.
- CygnusZero40
I downloaded TweenLite. I cant even figure out how to install it. Theres no installer, no instructions. Just a bunch of AS files. Im new to all this stuff, I think they assume everyone knows what to do with this.
- redant0
They are scripts that you call up in AS, they just sit in a folder ("com" folder)
instructions
http://blog.greensock.com/get-st…- http://www.greensock…
that page helps u with the code. Import the scripts. Then use the code. Read the documentation.
redant
- http://www.greensock…