Jump to content
Search Community

szaqal

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by szaqal

  1. I've created a custom CirclePath2D class in with I've overridden the set progress function (see attached) so that I could calculate the progress change on flight. I'm tweening the progress value like this:

     

    var direction:String = Direction.COUNTER_CLOCKWISE;
    var progress_change:Number = -0.08333333; // it can also be -2.5 or 0.012222222 - it is beeing calculated dynamically
    TweenLite.to(circle_motion_path, 2, {progress: circle_motion_path.progress + progress_change,
    						onStart: motionPathDirection,
    						onStartParams: [direction]});
    //circle_motion_path is CustomCirclePath2D object
    //circle_motion_path.progress is 0 on start
    
    private function motionPathDirection(direction:String):void
    {			
    circle_motion_path.direction = direction;
    } 

    In onStart function I'm setting manually the direction of progress change to "tell" what kind on calculations should be made in overridden set progress function.

     

    But this doesn't always work well as I've made it. Especially when quick jumping from progress: 0 to progress: -1.25.

     

    Is it clearer now? Please chech this link to see the example: http://pszajna.ires.pl/index.html maybe it will explain the problem better. Each time I'm jumping to next point I want to calculate how the progress value changes from point 0 to point 1.

  2. Jack one more thing about MotionPath. How can I calculate "rotation" value of MotionPath? By "rotation" I mean the number of full revolutions based on progress value change. So lets say if I'm changeing the progress from 0 to -0.0833333

     

    TweenLite.to(circle_motion_path, 2, {progress: circle_motion_path.progress + (-0.0833333)});
    
    //circle_motion_path.progress is 0

     

    the "rotation" value should be 0.083333 and so on. In other words CCW direction should increase "rotation" value and CC should decrease it.

     

    Could You give me some advice how can I achieve that?

  3. Yep, I've found many articles about it. In my case it's generating a random error because I've a conditional like this:

     

    if(progress > 1 && progress < 0)
    {
      ...
    }
    else
    {
      // very important actions
    }

     

    and it is very important for me that progress is 0 not "almost" 0. I've fixed this by rounding progress prop to 12 decimal places. I hope it will work.

  4. hi I'm getting a weird progress value after tweening MotionPath progress property. I've created a CirclePath2D object (it progress prop is set to 0). Next I've calculated the progress change value:

     

    var progress_change:Number = circle_motion_path.anglesToProgressChange(circle_motion_path.progressToAngle(circle_motion_path.progress), -1110, Direction.COUNTER_CLOCKWISE);
    // result: -0.08333333333333333

     

    Finally I'm tweening:

     

    TweenLite.to(circle_motion_path, 5, {progress: circle_motion_path.progress + progress_change, onComplete: navigationToStopComplete});

     

    and trace'ing the circle_motion_path.progress prop in the navigationToStopComplete function results: 329.99999999999994 instead of 330. I'm guessing that this has something to do with the floating point math but I'm not sure.

     

    How can it be fixed?

     

    Please help.

  5. Because I've extended the PathFollower class to monitor the progress property in the progress setter. I'm building a carousel and I want to manage elements by PathFollower progress property like:

     

    override public function set progress(value:Number):void
    {
    super.progress = value;
    
    if(super.progress < 0.75)
    {
      super.target.alpha = 0;
    }
    }

     

    My current concept is that each of the pathFollowers should monitor its progress and perform actions on their targets.

     

    Jack if you have any suggestions how to achieve that please give me a tip :).

  6. Yes, that makes sens and answers my question :) but I've got one more is it possible to set onComplete handler other way then in constructor vars properties. Let's say that I want to call load() several times on the same loader object but with diffrent onComplete handlers and I don't want to call the whole constructor method each time but only set the new url and new onComplete handler like:

    var img_loader = new ImageLoader(imagePath, {name: "logo",
                                                     container: logo_container,
                                                     x: 0,
                                                     y: 0,
                                                     width: 50,
                                                     height: 27,
                                                     scaleMode: "proportionalInside",
                                                     centerRegistration: true,
                                                     onIOError: onLogoLoadError,
                                                     onComplete: onLogoLoadComplete});
    img_loader.load();
    
    function onLogoLoadComplete(le:LoaderEvent):void
    {
           img_loader.url = "some_url";
           img_loader.onComplete = newOnCompleteHandler;
           img_loader.load(true);
    }
    

  7. Not exactly :)autoDisposse: true fires dispose() automaticly onComplete that's clear to me. But is dispose() fired when loader dispatches IO_ERROR event or do I have to do it manually? What happenes then to the loader I mean after IO_ERROR occurs? Now I'm making it eligible for GC by this code

    private function onLogoLoadError(le:LoaderEvent):void
         {
            img_loader.dispose();
            img_loader = null;
         }

    is that ok? My previous question wasn't clear enough I think :).

  8. Hi I've just started my adventure with ImageLoader and I've got a question about IO_ERROR event. How can I clear the loader when it dispatches LoaderEvent.IO_ERROR? Can it be done by this code:

     

    private function loadLogo(imagePath:String):void
    	{			
    		img_loader = new ImageLoader(imagePath, {name: "logo",
    															  container: logo_container,
    															  x: 0,
    															  y: 0,
    															  width: 50,
    															  height: 27,
    															  scaleMode: "proportionalInside",
    															  centerRegistration: true,
    															  onIOError: onLogoLoadError,
    															  onComplete: onLogoLoadComplete});
    		img_loader.load();
    	}
    
    	private function onLogoLoadError(le:LoaderEvent):void
    	{
    		img_loader.dispose();
    		img_loader = null;
    	}
    
    	private function onLogoLoadComplete(le:LoaderEvent):void
    	{
    		TweenLite.to(blackout_layer, 1, {alpha: 0});
    
    		onLogoLoadError(null);
    	}

     

    I simply want to nullify img_loader in onLogoLoadError.

  9. Hi

     

    I've got a movie clip on stage with alpha set to 0 (in Flash CS5) and I want to tween it to 0:

     

    TweenLite.to(mc, 1, {alpha: 0, onComplete: showMC});

     

    and my problem is that tween is running for 1s (traceing mc.alpha in onUpdate function results always 0) instead of fire onComplete imediatley. Is this a bug or intended action?

×
×
  • Create New...