Solved

Actionscript 2.0 animating with onEnterFrame

Posted on 2008-10-25
2
3,828 Views
Last Modified: 2013-11-11
The following function is called when a button is released:
function upThumbs(){
      dx  = 0
      lowerLeft = thumbnail_mc._y + thumbnail_mc._height
      trace("Lower Left " + lowerLeft);
      if (lowerLeft > 480){
            this.onEnterFrame = function(){
                  dx += 10;
                  if (dx < 480){
                        thumbnail_mc._y -= 10;
                  };
            }
            
      };
}

i wanted to make sure that the movieClip would animate and move up until the lower left corner reached above the 480.  If lowerLeft is less than 480, i don't want the "this.onEnterFrame" code to work.
But it still does!  After clicking the button once, the lowerLeft corner is 320.  The code should not run again.  I'm stumped by this.  I'm not sure why it's not working.

Any help would be appreciated!!!

0
Comment
Question by:steverguy
2 Comments
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 500 total points
ID: 22805906
try following update code, it should work for you:


function upThumbs() {

	this.onEnterFrame = function() {

		lowerLeft = thumbnail_mc._y+thumbnail_mc._height;

		trace("Lower Left "+lowerLeft);

		if (lowerLeft>480) {

			thumbnail_mc._y -= 10;

		} else {

			delete this.onEnterFrame;

		}

	};

}

Open in new window

0
 
LVL 1

Author Comment

by:steverguy
ID: 22805953
Thank you so much!  I am so rusty at ActionScript, i would've never thought of deleteing the onEnterFrame.

I appreciate your help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now