Groups | Blog | Home
all groups > flash actionscript > november 2005 >

flash actionscript : mouse over text?


faithmusic
11/23/2005 11:47:46 PM
Hi,
Please excuse my "technical terms",but I am trying to use the mouse over
effect for my text links and I am using symbols. I'm not sure if this is
correct? What is happening is on my stage, everything is working fine. The
mouse over effect is working. But when I go to test the movie, the mouse over
ONLY works when you are right on the letters, not between the letters. If I go
over the letter "O" nothing happens when I am pointing in the middle of that
letter. But it does work when I am exactly on the letter. Does any of this make
sense?

I would like to figure out what I am doing wrong, but I don't know what the
problem is. Can anyone help? I would like either a backround color, or a
underline, or just a different color to pop up when using the mouseover.

Thank you for your time.
jonnybennett
11/23/2005 11:53:55 PM
faithmusic
11/23/2005 11:59:18 PM
I'm sorry, but how do a paste the script. This is new to me.

faithmusic
11/24/2005 12:00:00 AM
Thank you so much for your help! It worked, drawing in the rectangle over the textfield.

Thanks. Have a great Thanksgiving.

Faithmusic

faithmusic
11/24/2005 12:00:00 AM
Thanks again!

I appreciate it.

NSurveyor
11/24/2005 12:00:00 AM
faithmusic
11/24/2005 12:00:00 AM
If I also wanted to have an "underline" with my mouse over effect, how would I do that?

NSurveyor
11/24/2005 12:00:00 AM
No problem.

NSurveyor
11/24/2005 12:37:27 AM
Are you placing text inside a Button symbol? If so, open up your Button. Right
click (or Command click) on the HIT Frame (frame 4) and select Insert
Keyframe. Using the Rectangle Tool, draw a (filled in) rectangle over your
textfield, so it is completely covering it. Now test your Movie. The Hit frame
defines the hit area of the button.
kglad
11/24/2005 1:07:37 AM
faithmusic
11/25/2005 12:00:00 AM
Hi again. I have another question about having an "underline" show up when
mouse over. Is there another way or command that I can use, instead of drawing
a line? I'm gonna have a page full of links.

Thanks.
NSurveyor
11/25/2005 12:00:00 AM
kglad
11/25/2005 7:08:25 AM
NSurveyor
11/25/2005 10:27:58 AM
Kglad, faithmusic doesn't want to use the line method because there is a full
page of links. So instead, remove all the buttons, just put normal (Dynamic)
textfields on the Stage. Give each textfield an instance name and apply the
link in the Properties Panel. Then, click on the current frame and open the
Actions Panel. Paste in:

txt_array = [tfield1,anothertfield,putyourtfieldhere];//put textfields in this
array
my_css = new TextField.StyleSheet();
my_css.setStyle('a:link',{color:'#FFFFFF'});
my_css.setStyle('a:hover',{color:'#000000',textDecoration:'underline'});
my_css.setStyle('a:active',{textDecoration:'none'});
for(var t in txt_array){
txt_array[t].styleSheet = my_css;
}

Make sure you enter the instance names of your textfields in the txt_array on
the first line of the code!
faithmusic
11/26/2005 12:00:00 AM
I'm sorry, where in the action panel do I paste this text?

I'm not sure what I am looking for.

NSurveyor
11/26/2005 12:00:00 AM
Here's a small example.

Create a new Blank Document. Create three dynamic textfields with "Google" in
the first, "Yahoo" in the second, and "MSN" in the third. For each textfield:
click on the textfield, open the Properties Panel, click the Enable HTML
button (looks like < >), then type in a URL in the link box, (for example, give
the google textfield, the url, http://google.com/) Select the google textfield,
and type in: tf1_txt for the <Instance Name> Give the Yahoo textfield the
instance name tf2_txt and the MSN textfield the instance name, tf3_txt. Then,
click on the current frame (Frame 1) in the Timeline Panel and then open the
Actions Panel. Click in the big white box, and paste in the following:


txt_array = [tf1_txt,tf2_txt,tf3_txt]
my_css = new TextField.StyleSheet();
my_css.setStyle('a:link',{color:'#FFFFFF'});
my_css.setStyle('a:hover',{color:'#000000',textDecoration:'underline'});
my_css.setStyle('a:active',{textDecoration:'none'});
for(var t in txt_array){
txt_array[t].styleSheet = my_css;
}
faithmusic
11/26/2005 2:15:54 PM
Hi,
When I open the Action Panel, there isn't a big white box waiting for me. What should I open to find it? So I can paste the info?

faithmusic
11/26/2005 2:19:43 PM
Hi,
I just sent this email to you, but I don't know if it went thru. So I'll send
it again:

When I open the Action Panel, there isn't a big white box waiting for me to
paste to. What should I open to find this panel?

Thanks.
faithmusic
11/26/2005 2:41:32 PM
Hi,
I'm sending this email for the third time. The first two does not show up as a
reply to your last message. So I am sending it again, sorry:

When I open the Action Panel, there isn't a big white box waiting for me to
paste the code. What do I have to do to find this box? Is there a command I
need to open?
Thanks.
faithmusic
11/27/2005 12:00:00 AM
Hi,
I'm still trying to find where to paste the code when I go to the Action
Panel. What am I supposed to open in order to paste this code?
Thanks.

P.S. Nothing is happening when I open the action panel to paste.
NSurveyor
11/27/2005 12:00:00 AM
NSurveyor
11/28/2005 12:00:00 AM
Look in the top right corner of the Actions Panel. You should see a little menu
image. Click on it. Then, you should see the option of 'Expert Mode' - click on
it. Then, underneath the + - [search icon] [find and replace icon] you should
see a white box. Click inside of it. Then, paste the code I gave you.

Oh now that I looked carefully, I notice you have Flash MX... which doesn't
support StyleSheets... sorry - my code won't work for you.
faithmusic
11/28/2005 12:00:00 AM
Is there another way to do this?



Thanks.

NSurveyor
11/28/2005 12:00:00 AM
Originally posted by: NSurveyor
Here's a small example.

Create a new Blank Document. Create three dynamic textfields with "Google" in
the first, "Yahoo" in the second, and "MSN" in the third. For each textfield:
click on the textfield, open the Properties Panel, click the Enable HTML
button (looks like < >), then type in a URL in the link box, (for example, give
the google textfield, the url, ;
var ch = createEmptyMovieClip('hit_t'+t,t+1000);
ch.tfield = ct;
ch.text = ch.tfield.text;
ch._x = ct._x;
ch._y = ct._y;
with(ch){
beginFill(0,0);
lineTo(ct.textWidth,0);
lineTo(ct.textWidth,ct.textHeight);
lineTo(0,ct.textHeight);
}
ct.setTextFormat(normal_tf);
ch.onRollOver = function(){
this.tfield.setTextFormat(hover_tf);
}
ch.onRollOut = function(){
this.tfield.setTextFormat(normal_tf);
}
ch.onPress = function(){
this.tfield.setTextFormat(active_tf);
getURL(this.tfield.getTextFormat().url,'_blank');
}
}
faithmusic
11/28/2005 12:00:00 AM
No, nothing happened.

After I pasted it, I went to the control tab and tested the movie, but nothing changed.

faithmusic
11/28/2005 12:00:00 AM
I'm sorry, was I supposed to try your sample with google and yahoo?

If so, I didn't. I tried my page. Let me go try your sample.

faithmusic
11/28/2005 12:00:00 AM
okay, it kinda worked. The links are coming up underlined, but I can't see the
text until I mouseover where the text would be. The test page is blank.

IN other words, the text is invisible until I mouseover.

???
faithmusic
11/28/2005 12:00:00 AM
Hi,
I tried changing the backround color of the stage and now I can see the text
in the test movie page. The text, google, yahoo and msn is in white. So with
the white backround I couldn't see it. : )

How would I change the color of the text? Probably in the code itself, correct?

Thanks.
faithmusic
11/28/2005 12:56:11 AM
I'm sorry, again, how do I make a screenshot of my actions panel?

NSurveyor
11/28/2005 12:35:58 PM
Look in this section:

normal_tf = new TextFormat();
normal_tf.color = 0xFFFFFFF;
normal_tf.underline = false;
//
hover_tf = new TextFormat();
hover_tf.color = 0x000000;
hover_tf.underline = true;
//

You need to use the hexadecimal value of your color in ActionScript. If you
don't know it, then just open the Color Chooser (fill or line) and select a
color. You should notice a number at the top, something like #123456. In
ActionScript, just get rid of the # and put in 0x, so it would be: 0x123456.
The first hexadecimal number in the code is the normal look to the hyperlinke
and the second one is the roll overed color.
faithmusic
11/28/2005 2:49:23 PM
Thanks, that worked!
I have a question about how the underline comes up. In each link(google, Yahoo
and so on) when mouseover, you can see hand informing you that there is a
hyperlink, but the line does not show up unless you move the mouse back and
forth until the line pops up. You know what I mean? How can I fix that?

And hopefully my last questions are, if I wanted to create the underline
effect for the page I sent you, how would I create the actionscript for it? Am
I supposed to follow the sample code you gave me, COPY and PASTE it, change the
"INSTANCE NAME for each link? Also, does the entire page have to be in the
Dynamic text mode? Can I still use pictures? (sorry about all the little
questions)
Thanks again for all your time and help.
faithmusic
11/28/2005 3:15:55 PM
I've noticed that when I have my mouse pointing just above the text links, the
underline works. But when I am pointing on the first couple of letters of the
text, the underline does not show up.

???
faithmusic
11/29/2005 10:58:51 PM
Hi,
Thanks for all your help with the underline text link.
I have a question about mouseover with audio track? How would I have an audio
clip of a song play when you mouseover, lets say a picture, like a cd cover?

Can you help me with this?
Thanks.
NSurveyor
11/29/2005 11:04:13 PM
The quickest and easiest way...

Convert your picture into a button (Select your picture, go to Modify >
Convert to Symbol -- might be Insert > Convert to Symbol on MX think , and
select Button). Then, open up your button, to enter it's timeline. Go to File >
Import. Select the audio track. Then, open up the Library (Window > Library).
Drag your audio track onto the UP frame.
NSurveyor
11/29/2005 11:04:32 PM
helllllll8
12/1/2005 12:00:00 AM
hey that is a simple problem when you make a button by directly converting it
from a text it is seen.so to remove that problem make another layer over your
button ,then make a simple graphic with the size of the text,and make it's
alpha 0.
AddThis Social Bookmark Button