Controlling properties step by step without buttons!

Hi there,\rI would like to know if it is possible to control the property of movie clip with the enterframe event until it meets a particular condition then if it does another one.\r\r1) My MC (this) of size 50% increases by 10% on enter frame until it reaches 150% of it’s size\r\r2) When it does reach 150% it then starts to shrink by -=10 until it gets to 100% \r\r3) When it does get to 100% it goes and plays a particular label inside this MC’s time line.\r\rI need this funtion to be reusable, so that several MC’s can call it on the timeline.\r\rI tried with the following similar code:\r\rlimitX=this._xscale;\rlimitY=this._yscale;\r//define my variables\rfunction GrowTill(){\rlimitX +=10;\rlimitY +=10;\rif(limitX=150){\r this._xscale -=10;\r this._yscale -10;\r}else if (limitX=100){\rgotoandplay(this.label1)\r}\r}\r\rDon’t worry about the synthax of gotoandplay is just to illustrate, basically this does nothing and I have been told that is is because I redefine limitX everytime I call the function, but how do you get around this?\r\rThanks\r

man… this is a tough one. grrrr

a/ set up like that, your “else if” will be true before your if (100 is < than 150 !) and will execute first!\rb/when you check if something is equal, use == , not = (which assigns a value!)…i s’pose you know that, as you specified not to worry about the code…\rc/i’ll see if i can writte this function in a working manner if(nobodyDoesItBefore==false); :slight_smile:

There’s an error in your code.

 function Eyezberg () {\r\rmixingUp.everything = true ;\r\r    while (Beers.liter>125) {\r\r             gotoAndSleep (this) ;\r\r            }\r\r    if (nobodyDoesItBefore==true) { // ==true !!\r\r            implement.Function () ;\r\r    }\r\rdelay = getTimer () ;\r\rif (delay>"10 days" ) {\r\r    trace ("Bump!" ) ;\r\r    }\r\r}

That should work.\r\rpom 0]

Satsukilla,\r\rthis works …\r\rdefine this method:

  \r\rMovieClip.prototype.boing = function(m,s){\r\r_ _ _ _ if(d>0){\r\r_ _ _ _ _ _ _ _ if(_xscale+d>m)d=-d;\r\r_ _ _ _ }\r\r_ _ _ _ else if(d<0){\r\r_ _ _ _ _ _ _ _ if(_xscale+d<s){ d=0;/*and whatever else*/ }\r\r_ _ _ _ }\r\r_ _ _ _ _xscale = _yscale += d;\r\r}

\rand put an onClipEvent() on the movies to effect:\r

  onClipEvent(enterFrame){\r\r_ _ _ _ if(d) boing(150,100);\r\r}

\rnow if d evaluates as true, the movie will spring into action!\r\rfor testing i wrote (also on the clip):

  \r\ronClipEvent(load){\r\r_ _ _ _ _xscale = _yscale = 50;\r\r}\r\r\r\ronClipEvent(mouseDown){\r\r_ _ _ _ d=10;\r\r}

\rthis makes it go whenever (and wherever) you click, probably not what you want, but you can set d however you like.\r\rthe downside is that the onClipEvent(enterFrame) is constantly running. it’s such a small amount of processing that it shouldn’t really matter, but it’s a bad practice.\r\rwhat you could do instead, would be to attach a movie which would effect the movie you wanted, and then delete it when it was finished. but like i said, in this case it doesn’t really matter, it’s probably not worth the bother.\r