A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Using AS to ease in then out?

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2005
    Posts
    5

    Using AS to ease in then out?

    Hi everyone.

    I am new at AS and am working on a movie where when I click a link the menu will go left and a window will go right. The first open always works fine its when I click another link and I want it to close then open again both easing in and out. The problem is that when I click the link it will barly move. If I take out one or the other then it works fine.

    It seems like its doing the last part just skipping over the first part.

    Thanks for your time.

    function orb_tween() {
    easeType = mx.transitions.easing.Regular.easeOut;
    var begin = 400;
    var end = 165;
    var time = .9;
    var mc = interface_mc.orb_mc;
    ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
    easeType = mx.transitions.easing.Regular.easeOut;
    var begin = 165;
    var end = 400;
    var time = .9;
    var mc = interface_mc.orb_mc;
    ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
    }

  2. #2
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    just at first glance.... it looks like the problem is with your variables. In the same function you are giving the vars "begin" and "end" 2 conflicting values. in one declaration you have begin = 400 and then you have begin = 165. There are a couple ways to fix this... From what you wrote above i think the following will work fine for you, although i wrote it to work using only a single button.
    Code:
    function orb_tweenR() {
    //move object Right
    	easeType = mx.transitions.easing.Regular.easeOut;
    	var begin = 400;
    	var end = 165;
    	var time = .9;
    	var mc = interface_mc.orb_mc;
    	ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time, true);
    };
    //
    function orb_tweenL() {
    // move object Left
    	easeType = mx.transitions.easing.Regular.easeOut;
    	var begin2 = 165;
    	var end2 = 400;
    	var time = .9;
    	var mc = interface_mc.orb_mc;
    	ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin2, end2, time, true);
    };
    //
    var clicked = false;
    //set a variable to determine direction of movement
    //
    btn.onRelease = function (){
    	if (!clicked) {  // check the var
    		orb_tweenR();  //value is false so tween RIGHT
    		clicked = true;  // sets var value to true
    		trace(clicked);
    	} else {  //value of clicked is true
    		orb_tweenL();   //we tween LEFT
    		clicked = false;  //reset the value back to false
    		trace(clicked);
    	}
    };
    hope that helps you... let me know if you need anything else

    M

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