• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

Confining hitarea of movieclip used as button

Hello. :)  I'm a newbie at Flash so bear with me....

I have a movieclip that I'm using as a button, and within the clip I have actionscript which tells the clip to gotoandplay a certain frame label on rollover. Part of that rollover animation is text which emerges out of the main area of the button (which also disappears upon rollOut). The problem is, once the text emerges, it then becomes part of the hit area within the movieclip, and that complicates the animation if the user rolls over the text before it fully disappears on rollout. Is there any way to disable the text's hitarea altogether? I tried making the text a movieclip and setting the hitarea = null, but that doesn't work because I have no idea what I'm doing. :D  Any help would be appreciated.
0
Coral3
Asked:
Coral3
2 Solutions
 
sam85281Commented:
The only way you can do that is to NOT use your movie clip as a button.  You can only define hit area in a button.

Best bet is to make an invisible button and put it over your movie clip.

To make an invisible button:
Use the paint brush to paint in your hit area (any color).  Select the splotch, F8 to covert to symbol, choose button and give it a name.

Now right click the splotch and choose edit from the menu.  Click the first frame in the button timeline and then drag it to the end (hit).

Now assuming your movieclip has an instance name of myClip your action for the button would be something like:

on (rollOver) {
     myClip.gotoAndPlay(10);
}
on (rollOut) {
     myClip.gotoAndStop(1);
}
on (release) {
     do whatever;
}

-Sam
0
 
blue-genieCommented:
i'd second that, unfortunately, the "hitArea" of a movieclip includes the entire bounding box of the movieclip, i.e when u select it that blue box is the whole hit area.

blu.
0
 
Coral3Author Commented:
Thanks Sam, this is working really well. :)  The only problem now is that part of my actionscript doesn't work.  I was using the enabled property to disregard all other actions after the button was released.  Let me give you an idea of what I mean by pasting my code:

on (rollOver) {
      leaf9.gotoAndPlay("rollover9");
      leaf9.rewind = false;
}
on (rollOut) {
      leaf9.rewind = true;
}
on (press) {
      leaf9.gotoAndPlay("pressdown9");
      leaf9.rewind = false;
}
on (release) {
      leaf9.gotoAndPlay("shrink9");
      leaf9.rewind = false;
                leaf9.enabled = 0;
}
on (releaseOutside) {
      leaf9.gotoAndPlay("normal9");
      leaf9.rewind = false;
}

After the button is released, I basically want all other actions to be disregarded, but that's not working anymore since I changed the script to fit the button.  I'm a newb to AS, any suggestions?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
BillystyxCommented:
you can add a variable to the on(release){
//like
scriptdisable=true;

and then on all other actions,
if(scriptdisable!=true){
//do stuff


but obviously, you need to be able to set it back to false again somewhere...

billystyx
0
 
Coral3Author Commented:
I'm not understanding...

What "stuff" would scriptdisable do?  Where could I set it back to false?
0
 
BillystyxCommented:
at the end of 'shrink9', you could set it back to false, so that the other buttons would be effective again.


billystyx

o/w might need to see a fla if we are on the wrong track:)

btw, <offtopic> Blu, could you take a look at http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21424172.html#14006597
, I am having trouble finding solution, and relates to slides (I think an area of your expertise), same for Sam if you can help:)
0
 
Coral3Author Commented:
Ohhh okay...that answers one of my questions. :)

This you said:

"if(scriptdisable!=true){
//do stuff"    <---do what stuff?  Could you give me an example of what you mean?  Thanks. :)
0
 
BillystyxCommented:
as in:
on (rollOver) {
if(scriptdisable!=true){
     leaf9.gotoAndPlay("rollover9");
     leaf9.rewind = false;
}
}
on (rollOut) {
if(scriptdisable!=true){
     leaf9.rewind = true;
}
}
on (press) {
if(scriptdisable!=true){
     leaf9.gotoAndPlay("pressdown9");
     leaf9.rewind = false;
}
}
on (release) {
scriptdisable=true;
     leaf9.gotoAndPlay("shrink9");
     leaf9.rewind = false;
                leaf9.enabled = 0;
}
on (releaseOutside) {
if(scriptdisable!=true){
     leaf9.gotoAndPlay("normal9");
     leaf9.rewind = false;
}
}

something like that.

billystyx
0
 
Coral3Author Commented:
Thanks billystyx...my apologies for my newbieness. :)  That solved most of the problem...now all I need is for it to also disable the ability to press & release the button once it already has been pressed & released (after "shrink9 starts to play).  
0
 
BillystyxCommented:
you don't want it happenng again for the duration of the movie?
0
 
Coral3Author Commented:
Not until a different button has been pressed and leaf9 appears again.
0
 
BillystyxCommented:
on (release) {
if(scriptdisable!=true){
scriptdisable=true;
     leaf9.gotoAndPlay("shrink9");
     leaf9.rewind = false;
                leaf9.enabled = 0;
}
}

just change that button then:)

billystyx
0
 
Coral3Author Commented:
Thanks! :)
0
 
Coral3Author Commented:
I'm trying to figure out how I can give both billystyx and sam85281 credit...is that possible?
0
 
BillystyxCommented:
yes, you can split points - not sure how (i haven't done it:)

billystyx
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now