Jump to content


Play frames and stop


  • You cannot reply to this topic
4 replies to this topic

#1 cng

    Young Padawan

  • Members
  • Pip
  • 55 posts

Posted 02 August 2006 - 11:34 AM

I have frames a, b, c, d, e, f. These frames are all motion tweened so they have a smooth movement from one to another. It wouldnt make sense to have a suddenly skip to d so it must play through b and c. However, I need them to stop at d. If I put a code on the frames b and c to stop, it wont reach d. If I press another button that wants to play from a to c but there is no stop at c, then it'll go straight to d. See my problem? I'm looking for a way to play from a to b, or backwards, b to a and then stopping at the letter I want. How should I do this? Think of this scenario like an elevator to help you understand what I want. Thanks for the help in advance!

#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 02 August 2006 - 12:38 PM

you can't achieve that by animating on the timeline, I recommend you start reading the help file on the tween and easing class :P

#3 cng

    Young Padawan

  • Members
  • Pip
  • 55 posts

Posted 02 August 2006 - 01:15 PM

What is the best way to do an elevator effect?

#4 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 02 August 2006 - 02:10 PM

I would create a complete mc without stop actions, put it underneath a mask, and then move it using the tween and ease class.

#5 icio

    Young Padawan

  • Members
  • Pip
  • 10 posts
  • Location:Perth, Scotland

Posted 03 August 2006 - 12:09 PM

You can achieve that by animating on the timeline. You simple need to use the functions `nextFrame()`, `prevFrame()` and the property `_currentframe` to navigate.

Unfortunately, you will have to hard-code in the frames that you want to stop on because you can not read the frame labels from within actionscript - these are lost when the .swf file is compiled.

The following code goes on the main timeline, frame 1. Am I correct in thinking the animation is done on the main timeline?
var targFrame:Number = 1;

_root.onEnterFrame = function() {
	if (targFrame > _currentframe) {
		nextFrame();
	} else if (targFrame < _currentframe) {
		prevFrame();
	}
}

Then, to move to a different frame, all you need to do is put something like
_root.targFrame = 10;
on a button event (or any event you want) and it will play in the correct direction to that frame (ie. 10)

Hope this helps :D

Edited by icio, 04 August 2006 - 12:56 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users