On Tue, Feb 2, 2010 at 11:12 AM, Glen Pike <g...@engineeredarts.co.uk>wrote:

> Try adding the ENTER_FRAME listener to Main instead of myThumb...
>
> //myThumb.addEventListener(Event.ENTER_FRAME, checkFrame);
>
> addEventListener(Event.ENTER_FRAME, checkFrame);
>

The following code:

package
{
   import flash.events.Event;
   import flash.events.ProgressEvent;
   import flash.events.Event;
   import flash.events.MouseEvent;
   import flash.display.MovieClip;
   import com.greensock.*;
   import com.greensock.easing.*;
// import CloseThumb;
   public class Main2 extends MovieClip
   {

//private var myThumb:CloseThumb = new CloseThumb();
                public var myThumb:CloseThumb;
private var counter:int = 0;
      public function Main2()
      {
         init();
addEventListener(Event.ENTER_FRAME, checkFrame);

      }

      public function init():void
      {
//                        CloseThumb();
theThumb();
}

public function checkFrame(e:Event):void {
       if (counter == 10) {
       doTween();
               counter = 0;
       } else {
               counter++;
trace(counter);
}
}

public function doTween():void {
addChild(myThumb);
TweenMax.to(myThumb, .4, {shortRotation:{rotation:60},
ease:Back.easeOut,onComplete:onFinishTween});
}

//If you want to get rid of the thumb after the tween has finished, then add
the "onComplete handler above to point here...
public function onFinishTween():void {
  removeChild(myThumb);
}
//Then in your theThumb function:


public function theThumb():void
              {
                      myThumb = new CloseThumb();
                      myThumb.x = 365;
                      myThumb.y = 355;
//// myThumb.addEventListener(Event.ENTER_FRAME, checkFrame);
                }

//// public function checkFrame(e:Event):void {
//// if (e.target.currentFrame == 2) {
////                       doTween();
//// }
//// }

   }
}

traces this:

at Main2/theThumb()
at Main2/init()
at Main2()

Nothing prints in the swf.
TIA,
beno
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to