Make a circle getting bigger

Hope that anyone can helt me make a little action script,-
that take a “movie” and scale it from zero to 100%
Just like if u would do it with a “Motion Tween”.

onClipEvent(enterFrame) {
if(_alpha < 100) { //wrong code
_alpha++; //wrong code
} //wrong code
} //wrong code

Add these actions to the movieclip (circle)!
make sure you set the alpha 0 too!

don’t you mean _xScale and _yScale, Syko?

I´ve found this code, andi works well,-
But how do i make it stop at a serten point.
Let´s say it has scailed the picture 150,- then i want it to stop.

onClipEvent (load)
{
z=0;
zspeed=5;
fl=10;
}
onClipEvent(enterFrame)
{
scale=fl/(fl+z);
_xscale=_yscale=150*scale;
z-=zspeed;
}

onClipEvent(enterFrame)
{
if (_xscale<=150) {
scale=fl/(fl+z);
_xscale=_yscale=150*scale;
z-=zspeed;
}
}

lol jsk! I must be going nuts! Yes I meant Xscale and Yscale!
lol!
No more coffee to me!

You can use the easing equation inscalling. That way the scalling is smoother:

Make sure that the movie clip you want to scale has a smaller scale percentage than myXscale and myYscale.


onClipEvent(load){
//change these values to the amount in scalling percentage.
  myXscale = 100; 
  myYscale = 100;
}
onClipEvent(enterFrame){
_xscale += (myXscale - _xscale)/3;
_yscale += (myYscale - _yscale)/3;
}

And there’s no need to calculate the focal length unless you want to do some more advanced perspective effects :slight_smile:

onClipEvent(enterFrame)
{
if (_xscale<=150) {
_xscale=_yscale += 5 ;
}
}

Oh and that too! :stuck_out_tongue:
I thought there’s something wrong with my script… whew!

:slight_smile:

onClipEvent(enterFrame)
{
if (_xscale<=150) {
scale=fl/(fl+z);
_xscale=_yscale=150*scale;
z-=zspeed;
}
}

what exactly does this code that jsk posted do? does it ease up to 150? or am i wrong

onClipEvent(enterFrame){
(_xscale<100)?(_xscale+=3;_yscale+=3): (_xscale=_yscale=100)
}

same thing

I´m all new to this Action script,-
and after getting all the results of this question, i´ve tryed to play around with this:

onClipEvent(enterFrame)
{
if (_xscale<=150) {
_xscale=_yscale += 5 ;
}
}

and changed it to this:

onClipEvent(enterFrame)
{
if (_alpha<=100) {
_alpha -= 5 ;
}
}

It make a picture fade out,-
HOW do i make it fade out and then fade in???

No matter what i do i can´t make come back!!!

try this

[AS]

onClipEvent (load)

{

    _alpha = 4;

reached100=false
}

onClipEvent (enterFrame)

{

if ((_alpha<100) and (reached100==false)){
_alpha+=2;
}
else {
if(_alpha!=0){
reached100=true
_alpha-=2;
}

}

} [/AS]

If we’d just want to fade out and in, I’d do it like this:


MovieClip.prototype.fade_out_in = function()
{
	this._alpha = 100;
	direction = -1;
	
	this.onEnterFrame = function()
	{
		if (this._alpha > 100 || this._alpha < 0)
		{
			if (direction == -1) 
			{
				// At this point the photo is invisible
				// So if you'd want you could change it ;P
				direction = 1;
			}
			else delete this.onEnterFrame; 
		}
		this._alpha += (2*direction);
	}
}
	
photo_mc.fade_out_in();

*Originally posted by jugnu *
**onClipEvent(enterFrame){
(_xscale<100)?(_xscale+=3;_yscale+=3): (_xscale=_yscale=100)
} **
Let’s be serious…

And there are a few more methods here: http://www.kirupaforum.com/forums/showthread.php?s=&threadid=4016