A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: AS Easing in Tweening

  1. #1
    Junior Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    24

    AS Easing in Tweening

    I have 3 movieclips all held within another movieclip.

    And, using the below code - the clips scale up when you click them - however, there is no "easing" at the moment, can anyone let me know how I could do that?!

    Thanks!!

    Code:


    for(i=0;i<3;i++){
    this["b"+i].onRollOver = function(){
    this.alphaTo(50,1);
    }
    this["b"+i].onRollOut = function(){
    this.alphaTo(100,1);
    }
    this["b"+i].onPress = function(){
    b0.enabled = false;
    b1.enabled = false;
    b2.enabled = false;
    num = parseFloat(this._name.toString().substr(1));
    _parent._parent.doOption(num,true);
    this._visible = 0;
    }
    }

    this._alpha = 0;
    this.alphaTo(100,1,"linear",.1);

  2. #2
    Member
    Join Date
    Oct 2007
    Posts
    65
    Oh when you say "scale" I'm assuming you mean in alpha. Your writing alphaTo. Are you using a tween engine like mcTween? If so then just include the file you'll have to look it up online

    #include "mc_tween2.as"

    you could write:

    var easeout: "easeOutExpo";

    and just replace the word linear with the word ease and you should have some easing going on. oh and you wouldn't have to write quotes there if you declare a variable

    so it would look like

    this.alphaTo(100, 5, easeout, .5);

    Hope that helps
    Last edited by nick1572; 05-01-2009 at 12:49 PM.

  3. #3
    Junior Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    24
    Hi Nick,

    I've been supplied this file via someone else - and I'm not brilliant with AS by a long way, so I do get SOME of what you said - and I know that the person that supplied this to me was using mc_tween - however when it comes to editing correctly, I'm at a loss!

    Could I send you the file to have a look at?!

    Thanks a million!
    Last edited by arrannknott; 05-02-2009 at 05:08 AM.

  4. #4
    Member
    Join Date
    Oct 2007
    Posts
    65
    Sure I think you need to attach it somewhere in here

  5. #5
    Junior Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    24
    Ha ha! I was trying to be polite! You have a PM!

  6. #6
    Member
    Join Date
    Oct 2007
    Posts
    65
    Ha ha! Cool. One clarification. When you say scale are talking about the "scale" or the "alpha"? When I add this variable to the top. I do get a bounce ease on the alpha. Let me know if this is what you are talking about.

    PHP Code:

    var ease "EaseOutBounce";

    for(
    i=0;i<3;i++){
        
    this["b"+i].onRollOver = function(){
            
    this.alphaTo(50,1);
        }
        
    this["b"+i].onRollOut = function(){
            
    this.alphaTo(100,1);
        }
        
    this["b"+i].onPress = function(){
            
    b0.enabled false;
            
    b1.enabled false;
            
    b2.enabled false;
            
    num parseFloat(this._name.toString().substr(1));
            
    _parent._parent.doOption(num,true);
            
    this._visible 0;
        }
    }

    this._alpha 0;
    this.alphaTo(100,1,ease,.1); 

  7. #7
    Member
    Join Date
    Oct 2007
    Posts
    65
    But if you talking about the scale then you would have to open up, for instance, the optionA_mc. There you will find the code that is needed to make the one mc scale up with some easing applied. Try this. Pay attention to the scaleTo part. I added the variable - ease - instead of "ease" with the quotes since I declared it above.

    PHP Code:

    btn
    ._visible 0;

    var 
    ease "EaseOutBounce";

    doBtn = function(){
        
    btn._visible 1;
    }

    if(
    skipIt == true){
        
    b0.tween("_x",768,0)
        
    b0.tween("_y",364,0)
        
    b0.alphaTo(100,0);
        
    b0.scaleTo(180ease,0);
        
    detailspanel.tween("_width",468,0);
        
    detailspanel.tween("_height",311,0);
        
    extras.alphaTo(100,0);
        
    textdetailscombined.alphaTo(100,0);
        
    this._alpha 0;
        
    this.alphaTo(100,1,"linear",1,doBtn);
    }else{
        
    b0.tween("_x",768,2,"linear")
        
    b0.tween("_y",364,2,"linear")
        
    b0.alphaTo(100,2,"linear");
        
    b0.scaleTo(180,2ease);
        
    detailspanel.tween("_width",468,1,"linear",1);
        
    detailspanel.tween("_height",311,1,"linear",1);
        
    extras.alphaTo(100,1,"linear",2.5);
        
    textdetailscombined.alphaTo(100,1,"linear",2.5,doBtn);
    }
    _parent._parent.backSlide "coreoptions_mc"
    I haven't looked at all of those buttons but this should do it. Let me know if this is cool or not. How's the weather in London? Never been there would love to get there some day. Oh, I added the bounce purely so I could easily see the easing
    Last edited by nick1572; 05-05-2009 at 02:23 PM.

  8. #8
    Junior Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    24

    Perfect! One more thing...!

    That last chunk of code is exactly the kind of thing I was after - not sure I'll use the bounce though!

    You star!

    And the weather is not too bad (by British standards!) and you should certainly try and visit London, I LOVE living here! Whereabouts are you then!? Also - I have another question for you.

    I have this issue from the client:

    "The reason why we cannot mirror/clone your AV presentation on both screens, is that the PC has to be set to run dual screens to utilise the full potential of our large HD screen. The touch screen only supports a max resolution of 1024x768. So, if we set these screens to clone each other the PC shrinks the large screen to the lower resolution of the touch screen.

    What we need to do to rectify this is have two flash presentations that work together. One at 1920x1080 which will appear on the back projection screen without the navigation appearing on screen. And then a separate presentation that runs at 1024x768 to work with the sympodium, with navigation tools etc. These two presentations will need to ‘talk’ to each other."

    Soooo.... I had a look at an application called jugglor - do you think this could solve the problem or do you have any other solution you can think of?! Sorry to pile this on top of you as well!!!

  9. #9
    Member
    Join Date
    Oct 2007
    Posts
    65
    Ah great! I'm glad to be able to help. I'm living in Maryland - usually sunny but has been raining for quite sometime now . Not to be cheesy but I'm a huge Joy Division/ New Order fan and their other spin offs. You guys always have the best music! IMO.

    Ok. So I looked at Jugglor and I'm not sure if that would be the answer or not. But if they are asking for two swf's(1 with the nav and 1 with the content) then localConnection() might work but may be tricky implementing it because of how it's built. It basically allows to swf's to talk to each other. You could have the nav in 1 swf control the other parts in the other swf. I am only familiar with two swf's that are embedded in an html. Check localConnection that might be good start. I'm ok at AS but far from an expert. Sorry I couldn't be of more help but let me know how this turns out

  10. #10
    Junior Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    24
    Hmmm - that localConnection thing looks a little complex for me, but it might do the trick. I think my client would be happy with the same file running on 2 screens, as long as they resize to EACH screen - which is what the main issue appears to be.

    Makes a change for us to be dry and sunny, think I'm going to make a note of it in my diary!!! New Order are the nuts, I'm a big fan - not such a Joy Division fan but each to their own! :-)

    Cheers for all your help on this - you have been a hero!

  11. #11
    Member
    Join Date
    Oct 2007
    Posts
    65
    Cool - then I would think that Jugglor may help.

    Ah - I prefer rainy mostly and yes I too prefer NO over JD. Yes they are nuts!

    Your welcome. Hope it works out for you and your client.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center