Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-27-2007, 12:21 PM   PM User | #1
tomyknoker
Regular Coder

 
Join Date: Mar 2006
Posts: 459
Thanks: 3
Thanked 0 Times in 0 Posts
tomyknoker is an unknown quantity at this point
Using an If Statement here...

I have 5 buttons and the below code, basically the way it works is onRelease it send the playhead to a frame label. On rollOver it plays an animation, and onRollOut it reverses the animation. Works really well. The buttons all sit on top of each other, so when the first button is rollOver I need to move the others down, i.e. btn2, btn3, btn4. And if button 2 is rolled over I only need to move btn3 and btn4 (hopefully that makes sense) but the statement can't fit in with my code... Can I use an If somewhere? Can anyone see that working?

Current Code
Code:
numOfBtn = 5;
stop();
for (i=0; i<numOfBtn+1; i++) {
	this["btn"+i].num = i;
	this["btn"+i].onRelease = function() {
		gotoAndStop("frm"+(this.num+1));
	};
	this["btn"+i].onRollOver = function() {
		this.play();
	};
	this["btn"+i].onRollOut = function() {
		this.onEnterFrame = function() {
			if (this._currentframe != 1) {
				this.prevFrame();
			} else {
				delete this.onEnterFrame;
			}
		};
	};
}
Edited not written in code though

Code:
numOfBtn = 5;
stop();
for (i=0; i<numOfBtn+1; i++) {
	this["btn"+i].num = i;
	this["btn"+i].onRelease = function() {
		gotoAndStop("frm"+(this.num+1));
	};
	this["btn"+i].onRollOver = function() {
		
if "btn1" pressed
btn2.tween("_y", btn2.originalY + 25, .5, "easeOutQuad");
		btn3.tween("_y", btn3.originalY + 25, .5, "easeOutQuad");
		btn4.tween("_y", btn4.originalY + 25, .5, "easeOutQuad");

else  "btn2" pressed
		btn3.tween("_y", btn3.originalY + 25, .5, "easeOutQuad");
		btn4.tween("_y", btn4.originalY + 25, .5, "easeOutQuad");

else "btn3" pressed
		btn4.tween("_y", btn4.originalY + 25, .5, "easeOutQuad");

		this.play();
	};
	this["btn"+i].onRollOut = function() {
		this.onEnterFrame = function() {
			if (this._currentframe != 1) {
				this.prevFrame();
			} else {
				delete this.onEnterFrame;
			}
		};
	};
}
If anyone can get that too work in code form would be much appreciated! Do I even have the right idea? I hope so...

Last edited by tomyknoker; 03-27-2007 at 12:52 PM..
tomyknoker is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:31 AM.


Advertisement
Log in to turn off these ads.