[flashpro] flying!
Christoph Helzle
christoph at worldwidechris.com
Thu May 19 14:18:46 EDT 2005
Here's a way to simplify this whole thing.
this.onEnterFrame = function ()
{
this._x += Math.abs(this._x*0.2 );
if(this._x>=0)
{
this._x=0;
delete this.onenterframe;
trace("done");
}
}
Denis Huë wrote:
>With the examples i send, it worked...
>I don't place the action into the movieclip, but on the stage. (and yes your
>right, i didn't finished reading the email :) )
>
>-----Message d'origine-----
>De : flashpro-bounces at muinar.org [mailto:flashpro-bounces at muinar.org] De la
>part de Toby Pratt - Elsey Adcock Associates
>Envoyé : jeudi 19 mai 2005 11:02
>À : Mailing list for professional Flash designers and developers
>Objet : RE: RE : [flashpro] flying!
>
>Hiya,
>
> It does get to zero. Otherwise, the trace()s wouldn't have
>executed. - The
>key is that the movie clip's _x is a value less than zero. Otherwise,
>you're right, it would keep getting bigger.
>
>-----Original Message-----
>From: flashpro-bounces at muinar.org [mailto:flashpro-bounces at muinar.org]On
>Behalf Of Denis Huë
>Sent: 19 May 2005 09:55
>To: 'Mailing list for professional Flash designers and developers'
>Subject: RE: RE : [flashpro] flying!
>
>
>You_MC.onenterframe=function() {
> stopPosition = 400; // before, it never went to 0 :)
> currentXPosition = getProperty(this,_x);
> increment = Math.abs(currentXPosition * 0.2);
> currentXPosition += increment;
> trace(currentXPosition);
> if(currentXPosition>stopPosition){
> trace("I SHOULD HAVE STOPPED, but I've blinking not");
> trace("I definitely get to here, so where is the problem?");
> trace("Even the following line of code works in a different
>example");
> delete this.onenterframe;
> }else{
> this._x=currentXPosition;
> }
>}
>
>-----Message d'origine-----
>De : flashpro-bounces at muinar.org [mailto:flashpro-bounces at muinar.org] De la
>part de Toby Pratt - Elsey Adcock Associates
>Envoyé : jeudi 19 mai 2005 10:52
>À : Mailing list for professional Flash designers and developers
>Objet : RE: RE : [flashpro] flying!
>
>Okaaaaaay then.
>
> Thanks everybody, I tried a couple of the examples and they seemed
>to work.
>However, my script still doesn't. The thing at issue is the delete
>this.onenterframe; line - Which works in the example kindly provided by
>denis, but not here.
>
>My script in full - you lucky, lucky people:
>
>onClipEvent(enterFrame){
> stopPosition = 0;
> currentXPosition = getProperty(this,_x);
> increment = Math.abs(currentXPosition * 0.2);
> currentXPosition += increment;
> trace(currentXPosition);
> if(currentXPosition==stopPosition){
> trace("I SHOULD HAVE STOPPED, but I've blinking not");
> trace("I definitely get to here, so where is the problem?");
> trace("Even the following line of code works in a different
>example");
> delete this.onenterframe;
> }else{
> setProperty(this,_x,currentXPosition);
> }
>}
>
> If anyone wishes to try this code, it's placed on a movieclip with a
>negative _x (actually it's -238) so, the idea being that it decelerates
>towards 0 from the left.
>
> Your further assistance will be greeted with a certain amount of
>cheer.
>
>
>-----Original Message-----
>From: flashpro-bounces at muinar.org [mailto:flashpro-bounces at muinar.org]On
>Behalf Of denis at atypic.be
>Sent: 18 May 2005 22:08
>To: 'Mailing list for professional Flash designers and developers'
>Subject: RE : [flashpro] flying!
>
>
>onClipEvent(enterFrame){
> //Do stuff
> if(myCondition==100){
> delete this.onenterframe;
> }else{
> myCondition = myCondition +1;
> }
>-----Message d'origine-----
>De : flashpro-bounces at muinar.org [mailto:flashpro-bounces at muinar.org] De
>la part de Toby Pratt - Elsey Adcock Associates
>Envoyé : mercredi 18 mai 2005 19:08
>À : Mailing list for professional Flash designers and developers
>Objet : RE: [flashpro] flying!
>
>speaking of which...
>
> Here's something...
>
>onClipEvent(enterFrame){
> //Do stuff
> if(myCondition==100){
> stop();
> }else{
> myCondition = myCondition +1;
> }
>
>or something like that - Problem is, the stop(); command doesn't work,
>the
>line is reached, but for some reason it doesn't stop the continual
>iteration
>of the enterFrame. Is there a way to force the enterFrame thing to stop
>iterating? Please let me know (P.S. I know the above code doesn't work
>as
>is, but the example I'm paraphrasing does, and 100 is indeed reached,
>but it
>darned well don't stop.)
>
>
>Hints anybody?
>
>Usually I'd do this type of loop on a 2 frame movie clip, but found
>enterFrame more elegant, if I can get it to work...
>
>
>
>
>-----Original Message-----
>From: flashpro-bounces at muinar.org [mailto:flashpro-bounces at muinar.org]On
>Behalf Of John Holland
>Sent: 18 May 2005 17:46
>To: 'Mailing list for professional Flash designers and developers'
>Subject: RE: [flashpro] flying!
>
>
>That was a fun break. Thanks
>
>John W. Holland
>Holland Kuhn, Inc.
>Multimedia Design & Development
>900 N. Lake Shore Drive, Suite 1414
>Chicago, Illinois 60611
>
>T: 312.274.0330
>M: 312.593.1554
>
>
>
More information about the FlashPro
mailing list