A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: use one button/mc to ease another

  1. #1
    Member
    Join Date
    Jun 2004
    Posts
    32

    use one button/mc to ease another

    Okay, so i've looked and looked and I havent been able to find anything I can understand to help with this problem. I know how to ease a movie clip to the position of my mouse coordinates. What I want to do is use a movieclip that - when clicked- will ease two OTHER movieclips into fixed coordinates.

    The movie clips only need to move on the Y axis, but since i have been trying so hard to understand this, getting help for x and y coordinates would be cool. I'm attaching a file with no code in it, but its for visuals. I want the pressed movie clip to move the color blocks down/up according to coordinates I enter into the AS. Can ANYONE help? btw, i'm using Flash 8
    Attached Files Attached Files

  2. #2
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    it's pretty easy actually... but i know personally how easily this stuff seems to overwhelm and frustrate the hell out of you...
    try this
    Code:
    MovieClip.prototype.moveY = function(targetY, speed) {
    	this.onEnterFrame = function() {
    		this._y += (targetY-this._y)/speed;
    		if (this._y> targetY-1 && this._y< targetY +1) {
    			this._y = targetY;
    			delete this.onEnterFrame;
    		}
    	};
    };
    
    // PARAMETERS:
    // targetY = your destination point
    // speed = how quickly you want to get there/degree of easing...
    
    
    // USAGE : (from a button like you need..)
    btn.onRelease = function(){
        mc_1.moveY(300, 3);
        mc_2.moveY(Stage.height-mc_2._height, 4);
    };
    you can easily use this for x-axis tweening as well... just swap all the Y's for X's.... see... now wasn't that easy?!?!
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

  3. #3
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    heres one way.

  4. #4
    Member
    Join Date
    Jun 2004
    Posts
    32
    Quote Originally Posted by madzigian
    it's pretty easy actually... but i know personally how easily this stuff seems to overwhelm and frustrate the hell out of you...
    try this
    Code:
    MovieClip.prototype.moveY = function(targetY, speed) {
    	this.onEnterFrame = function() {
    		this._y += (targetY-this._y)/speed;
    		if (this._y> targetY-1 && this._y< targetY +1) {
    			this._y = targetY;
    			delete this.onEnterFrame;
    		}
    	};
    };
    
    // PARAMETERS:
    // targetY = your destination point
    // speed = how quickly you want to get there/degree of easing...
    
    
    // USAGE : (from a button like you need..)
    btn.onRelease = function(){
        mc_1.moveY(300, 3);
        mc_2.moveY(Stage.height-mc_2._height, 4);
    };
    you can easily use this for x-axis tweening as well... just swap all the Y's for X's.... see... now wasn't that easy?!?!
    thank you thank you thank you!!

  5. #5
    Can't Re-Member madzigian's Avatar
    Join Date
    Apr 2004
    Location
    Boston MA
    Posts
    2,662
    lol.. no problem
    Please DO NOT PM me simply for individual help. Post in the public forums...that's what they are for, and they allow others to benefit as well. - Thx
    OS X 10.3.9 || Flash MX04 Pro
    | del.icio.us || furl || Helpful Source Files || Free Pixel Fonts |

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