Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-30-2012, 06:23 PM   #1
atlgirl
Registered User
 
Join Date: Apr 2012
Posts: 2
Unhappy Text appears when you hover

So, I've got 12 buttons which are all scrolling across the stage via a Classic Tween and when I hover over each one of the buttons, the whole animation stops which is great but what I want to do is when I hover over one of the buttons I want text to appear and I know how to do this via the 'over' bit on the button.

When you hover over the button, the text appears all and well but also when you hover over the blank stage where the text will appear, the text appears there as well but I just want the text to appear when you hover over the button, not where the text is!!

any help?!
atlgirl is offline   Reply With Quote
Old 04-30-2012, 07:11 PM   #2
JeremiahLight
Registered User
 
Join Date: Apr 2012
Posts: 23
Default

I would first ask: Where are you applying the hover event? Meaning, is it applied to the button or to the text field?

I am assuming you are using a dynamic text field to display the text. If your hover event is applied to the button, I really can't see why hovering over the text area also brings up the text.

If you could post the code you are using, it would be easier to diagnose the issue.

The only way I can see that your problem is happening is if the hover event is ran through the text field.

I just reread your post. You mention showing the text on hover via the "over bit on the button" Does this mean you have the text you want to show placed in the over state of the button? And, it seems as though the text will appear above the button or something similar.

If my above thinking is correct, by placing the text in the over state of the above and above the "button" itself, you have effectively increase the hit area of the button, which will be a rectangle encompassing all graphics, etc. . in the button.

You might think about using a movieclip as a button instead. This way, you can separate the button and the text as two separate elements. Placing the text inside the button makes it part of the button and react to any code applied.

JL
JeremiahLight is offline   Reply With Quote
Old 04-30-2012, 07:42 PM   #3
atlgirl
Registered User
 
Join Date: Apr 2012
Posts: 2
Default

Hey! yeah, the text I have at the minute is in the over state of the button and just as you suspected, the hit area of the button has increased to wherever the text is placed.

Effectively, all I want is to hover over the button (and only the button) and then for text to appear.

How would I go about using a movieclip as a button? because this sounds like the way to solve my problem!

Thank you so much, i've only been using flash for a short time so i'm pretty useless!
atlgirl is offline   Reply With Quote
Old 04-30-2012, 10:17 PM   #4
JeremiahLight
Registered User
 
Join Date: Apr 2012
Posts: 23
Default

Hey,

Using a movieclip as a button is pretty simple. There really isn't much difference. The main thing you will need to do is add the following code.

ActionScript Code:
instance.buttonMode = true;

The above code will simply create the mouse cursor behavior expected of a button.

From there, everything else is pretty much the same.

Say, you want your text to appear above the movieclip, since movieclips have their own timeline, you could place this text on frame 10 or so. Then, when you add an event listener to the symbol for a ROLL_OVER, you just say gotoAndPlay(10);

Being a movie clip, anything else you place on the movieclip's timeline will not affect this roll over. Meaning, rolling over the area where the text will appear will do nothing. Using movieclips will also open up a lot more possibilities. You can do pretty much anything you want.

I attached a simple file exampling how to do a very basic rendition of what you are wanting to do. Notice that I put a couple stop(); actions on the movieclip's timeline. You could actually do all of the code inside the movieclip itself. But, I juts put it on the main timeline for this purpose.

JL
Attached Files
File Type: zip movieclipButton.zip (7.1 KB, 36 views)
JeremiahLight is offline   Reply With Quote
Reply


Thread Tools
Display Modes 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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:46 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.