Jump to content
Search Community

aliennoise

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by aliennoise

  1. Thank you for a quick response. Please, could you be more specific of where i should use the conditional if statement, I'm pretty new to AS3 and Flash in general. Im not asking for a tutorial, but i must say that the last video you did, made a lot of things much clearer regarding flash and GreenSock classes. Unfortunately i am still picking peaces together. And "Idiot proof Tut ver. 2.0" with Liquid Stage and some other classes seen trough your interpretation would be greatly appreciated :P

     

    You could just use a Boolean flag like imageLoaded or something that gets set to true after it's loaded (listen for the COMPLETE event of your loader) and then use that in conditional logic inside your updateBackground() method, like:

     

    var imageRatio:Number = this.bacgroundPic.width / this.bacgroundPic.height;
    
    this.stage.addEventListener(Event.RESIZE, updateBackground);
    
    this.stage.addEventListener(Event.RESIZE, updateBackground);
    function updateBackground(event:Event):void {
      var sw:Number = this.stage.stageWidth;
      var sh:Number = this.stage.stageHeight;
      var offset:Point = getStageOffset();
      var stageRatio:Number = sw / sh;
      if (stageRatio >= imageRatio) {
         this.bacgroundPic.width = sw;
         this.bacgroundPic.height = this.bacgroundPic.width / imageRatio;
      } else {
         this.bacgroundPic.height = sh;
         this.bacgroundPic.width = this.image_mc.height * imageRatio;
      }
      this.bacgroundPic.x = offset.x + (sw - this.bacgroundPic.width) * 0.5;
      this.bacgroundPic.y = offset.y + (sh - this.bacgroundPic.height) * 0.5;
    }
    

     

    if (!imageLoaded) {
       return;
    }

  2. Hi everybody my name is Igor .. and I'm a Newb.. sounds like AA meeting a?

    I'm a complete Newb trying to figure out how the AS3 code works..in general.

    What I'm trying go figure out how to make an animation execute on ROLL_OVER and ROLL_OUT

    i tried removing

    var timeline:TimelineLite = new TimelineLite();
    timeline.append(TweenLite.to(box1, 1, {x:"400", scaleX:0.5, scaleY:0.5, ease:Back.easeIn}));
    this.timeline.pause();

     

    and placing everything in

     

    	TweenLite.to(box1, 1,{scaleX:1, scaleY:1,  ease:Cubic.easeOut});
    TweenLite.to(box1, 1,{dropShadowFilter:{color:0x000000, alpha:0.5, blurX:5, blurY:5, strength:0.5, angle:195, distance:12}, alpha:0.5, ease:Cubic.easeOut});
    timeline.reverse();
    }
    function outHandler(event:MouseEvent):void {
    TweenLite.to(box1, 1,{scaleX:0.2, scaleY:0.2, ease:Cubic.easeIn});
    timeline.play();
    }
    

     

    but the animation then starts from the place ROLL_OVER executes and animation ends on a different X, Y, position.

     

    Any help would be appreciated, i tried searching forums and found some answers, but fundamentals i cant figure out where I'm making a wrong turn.

    Thx.. by the way.. GreenSock made my Newb status to Newb+ , very easy to understand and this is where it all started for me.

     

    import com.greensock.*;
    import com.greensock.easing.*
    
    
    var timeline:TimelineLite = new TimelineLite();
    timeline.append(TweenLite.to(box1, 1, {x:"400", scaleX:0.5, scaleY:0.5, ease:Back.easeIn}));
    this.timeline.pause();
    
    
    button.addEventListener(MouseEvent.ROLL_OVER, overHandler);
    button.addEventListener(MouseEvent.ROLL_OUT, outHandler);
    
    
    function overHandler(event:MouseEvent):void {
    TweenLite.to(box1, 1,{scaleX:1, scaleY:1,  ease:Cubic.easeOut});
    TweenLite.to(box1, 1,{dropShadowFilter:{color:0x000000, alpha:0.5, blurX:5, blurY:5, strength:0.5, angle:195, distance:12}, alpha:0.5, ease:Cubic.easeOut});
    timeline.reverse();
    }
    function outHandler(event:MouseEvent):void {
    TweenLite.to(box1, 1,{scaleX:0.2, scaleY:0.2, ease:Cubic.easeIn});
    timeline.play();
    }
    

×
×
  • Create New...