Paul,
You are right. I thought we want to stop initially...

In case of simple frame based animations I would add one method to the
Main class, triggered on ENTER_FRAME events, that would be checking
all single animations progress (their currentFrame) and then could
stop() at desired frame.

In such case mcHandInstance should be a Main class property. Probably
all other animated clips too, so all could be controlled easily from
one AS file.

Example:

package
{
 import flash.events.*;

 //...

 public class Main extends MovieClip
 {

   private var mcHandInstance1:mcHand; // <-- the hand instance as Main class 
property

   public function Main():void
   {
      addEventListener(Event.ENTER_FRAME, progress);
   }

   // the controlling method...
   private function progress(evt:Event):void
   {
       if(mcHandInstance1.currentFrame == 20) mcHandInstance1.stop();

       // other animations could be controlled as well here around
   }

   //....
   
   public function rightHand():void
   {
    mcHandInstance1 = new mcHand();  //<- removed declaration and type
    addChild(mcHandInstance1);
    mcHandInstance1.x = 400;
    mcHandInstance1.y = 200;
  }

  //....
  }
}

I understand Beno is starting his way. This code is just an example
and there are many other solutions to control animations. Adding
stop() to timeline is one of them and it is completely fine for me,
unless there are too many animations to control...

g



Tuesday, November 24, 2009 (8:03:39 PM) Paul Andrews wrote:

> Greg Ligierko wrote:
>> I am not much into this topic, but ...
>> you do not have to drag Library instance to the stage to get into its
>> timeline. If you mark the item (e.g. mcHand) in the library and press
>> right mouse button, there is "Edit" (the same if you doubleclick the
>> item). 
>>
>> As soon as you are in the "edit mode" of the library item, then the
>> only timeline you can see is an "internal" timeline of this item (it
>> is not the main timeline). You can select the first frame, press F9
>> (or actions) and add this.stop().
>>
>> But... I don't think adding code to timeline is a good idea. I would
>> rather try to stop the looping tween here:
>>
>>        public function rightHand():void
>>        {
>>               var mcHandInstance1:mcHand = new mcHand();
>>               addChild(mcHandInstance1);
>>               mcHandInstance1.x = 400;
>>               mcHandInstance1.y = 200;
>>
>>               mcHandInstance1.stop(); // <--- here
>>        }
>>   
> I understand where you are coming from, but, if my understanding of the
> problem is correct, this won't solve benos problem.

> He needs the stop() at frame 20 of the mcHand timeline - your suggested
> code does not achieve this.

> Generally I try and put code where it is appropriate. Where I have 
> MovieClips with animation on the timeline, stop() actions are required
> to get the timeline to behave as required - in this case not to loop.

> Paul.


>> As I mentioned, I not into this topic, so I may be completely wrong.
>>
>> g
>>
>>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to