Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want my mc to be like a button - can I do this? 1

Status
Not open for further replies.

whoknows361

Technical User
Sep 22, 2005
228
0
0
US
Here's what I want.. Let's say I have a simple bar. I want this bar to be hilighted with a yellow box around it when a user rolls over & when they roll out, the bar goes back to normal w/o the yellow border. Then when a user clicks on the bar, it goes to another frame in the bar mc, like frame 3 where a user can choose other options, such as color choice or bar size, etc..

I tried to make a mc where you roll over & it goes to frame 2 of bar mc where the yellow border was, then when you roll out it goes back to frame 1 where there is no border. Then when you click it goes to frame 3 where the options are available... However, when you click on it & then roll off the mc, the options disappear because it goes back to frame 1 where the options are not.. Anybody have any ideas how I can get this accomplished?

I even tried using a button mc where on the over state I have the yellow border, & on the down state I have the mc where the options are available, but this only shows the bar options when the click is held down...

Thanks in advance

Jonathan
 
Use an invisible button in your MC to trigger your events. To create an invisible button create a new button (in the library) and draw a rectangle (square, etc..) in the "Hit" section only of the button. You will know you have it right if it appears (cyan) on the screen when added to the stage.

Use the button events to trigger your MC changes.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
I tried that initially, however the problem is that when you roll over the mc it goes to frame, when you click to frame 3 where user can choose options, but on the maintimeline I have this AS on the mc.

on(rollout){
this.gotoAndStop(1);
}

I want the mc to go back to frame one on a rollout, but I don't want this rollout code to work if the user clicks on the mc(which takes it to frame 3 of the mc).
I hope this makes sense
JOnathan
 
I am afraid you lost me. Can you be a bit more clear on how your movie is built? You have code on the main timeline?

Wow JT that almost looked like you knew what you were doing!
 
sorry.. here goes.
I have a mc with three frames. the mc is called "bar".
on the first frame of the bar mc is simply the bar,
on the second frame is the bar with a yellow border,
on the third frame is the bar with another mc where users can choose options (ie, color, etc) which will change the appearance of bar.

I put mc bar on the maintimeline, click on it & put the following AS on the mc bar:

on(rollover) {
this.gotoAndStop(2);
}
on(rollout) {
this.gotoAndStop(1);
}
on(press) {
this.gotoAndStop(3);
}

now it does what I want it to do, that is when I rollover its shows the bar with yellow border, etc... But when the user clicks on the mc, it does go to frame 3, the second you roll off of bar mc, it goes back to frame 1 of mc bar. What I want it to do is when a user clicks & even if they roll off of mc bar, I want it to stay on frame of mc bar. Or in ohter words, when a user clicks on bar mc, I don't want the rollout command to function anymore..
HOpe this helps

Jonathan
 
Oh well that would be easy enough by using a variable (if I understand you correctly). Try this:

Code:
on (rollOver) {
	if (this.varName != "active") {
		this.gotoAndStop(2);
	}
}
on (rollOut) {
	if (this.varName != "active") {
		this.gotoAndStop(1);
	}
}
on (press) {
	this.varName = "active";
	this.gotoAndStop(3);
}
Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
thanx pixl8r - that made my button work, but now my buttons on frame 3 don't work at all! is there a way I can upload files for you to see what I am talking about.. that would be perfect.. or maybe I can email them to you.. please let me know, because I can't figure out, now that your code works, why my button actions on frame 3 do not work.. Please let me know.

Jonathan thanks

 
Sure you can upload the files. Just place a link to them here and I will take a look.

Wow JT that almost looked like you knew what you were doing!
 
You have to post them on some web space that you have access to, like where ever your site is hosted... You can not upload them to Tek-tips.

Wow JT that almost looked like you knew what you were doing!
 
hope this works... the file seems to make my edit mc a button.. at least the cursor turns into a hand & all of my buttons on the edit mc don't work.. You'll see if this works...

Thanks in advance.

 
OK... your problem was pretty simple. You were using the MC as the criteria for over, out, and press. There is nothing wrong with that until you try to place other buttons inside that same MC. The script on the overall MC was over riding the scripts contained within it. The solution is another invisible button.

Get it here.

Hope that helps.

Wow JT that almost looked like you knew what you were doing!
 
dude, thanks so much for your help on this.. I have updated it so that it works like I want to.. but I have one more question...

Is there any way that I can get, after the user has made changes to the mc (namely color, position or sizes changes), to make it that when the user clicks the little x (close box) on the edit controls, whenever they roll over the box again, the yellow bar still shows up?, but shows up over the box with the new color, size, position changes...

Here is the updated. Thanks bro
 
On the close button set the "varName" value to nothing.

Code:
_global.varName = "";

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top