View Full Version : Simple rollover one
Martha Tabram
11-29-2001, 10:15 AM
Hello again,
Coming back to Flash after about a year, I find I've forgotton rather more than I'd like to admit.
For example,
I have some standard buttons that change colour when rolled over. I also have a line pointing to each of these buttons. How do I change the colour of the lines when I rollover the buttons ?
It seems so straight forward, but I'm a little dim.
Many thanks.
Martha.
dj fuzzline
11-29-2001, 10:28 AM
hi, do you want the complete code or just the idea. i'm not at my computer so i can't open flash and i don't know it out of my head, but here's the idea.
on your button you need the on (rollover), and then you need setProperty, then the name of your line instance, and there sould be something to change the tint effect to whatever colour you want.
using normal mode in the actionscript box it should be easy to do this.
hopefully this should jog your memory, but i'll post the full script when i get home.
oh yeah, dont forget to have the on (rollout) to set the colour back
dj fuzzline
11-29-2001, 12:14 PM
ok, i was wrong there is no code to set the tint of an object so this is how you can do it:
make the line into a movie clip (if the lines are the same you only need one movie clip). in that clip have two frames, in frame one have the line as appears normally, in frame two have it as you want it when you roll over the button. put the following action on both frames:
stop ();
now go to your main stage and put two of the line movie clips onto it (if the lines are different then you have to make two movies clips and put one of each on the main stage). name the movies clips 'line1' and 'line2' using the 'instance' box.
now on your first button put:
on (rollOver) {
tellTarget (line1) {
gotoAndStop (2);
}
}
on (rollOut) {
tellTarget (line1) {
gotoAndStop (1);
}
}
and on your second button put:
on (rollOver) {
tellTarget (line2) {
gotoAndStop (2);
}
}
on (rollOut) {
tellTarget (line2) {
gotoAndStop (1);
}
}
hope this helps!
Martha Tabram
11-29-2001, 03:01 PM
Cheers, Fuzzy.
That appears straight forward enough.
I gotta admit, I did pull my hair out for 15 minutes looking for the _tint property.
Martha.
robert penner has created a prototype to change the tint of an object. goto [PROTO]type (http://www.layer51.com/proto/d.asp?p=10&f=143) if you are interested.
Jungl3M4n
11-30-2001, 12:46 AM
Why do not ask first if she wants to do the stuff in the Over state of the button???:D :D :D
With Tell Target too a way could be this.
Make a movie clip with the lines that do you want to change the color, give to it an instance name "Lines" (I will supose that you have 3 buttons and 3 lines), then add 3 frames more and 2 layers to that movie clip, add a stop action on each frame, in the first frame put the tree lines in black(if you want the lines to point the buttons allways), in the next frame change the color of the line that points to the button 1, in the next one change the color of the line that points to the button 2, and in the 3rd frame change the color of the line that points to the button 3, add a label to each frame (Frame 1 Label = Start, Frame 2 Label = Button1, Frame 3 Label = Button2, Frame 4 Label = Button3), then in the buttons add the following code:
on (rollOver) {
tellTarget (lines) {
gotoAndStop (Button1);
}
}
on (rollOut) {
tellTarget (lines) {
gotoAndStop (Start);
}
}
in the second button put:
tellTarget (lines) {
gotoAndStop (Button2);
}
}
on (rollOut) {
tellTarget (lines) {
gotoAndStop (Start);
}
}
in the 3rd button:
on (rollOver) {
tellTarget (lines) {
gotoAndStop (Button3);
}
}
on (rollOut) {
tellTarget (lines) {
gotoAndStop (Start);
}
}
There you have a little interactive movie without making 3 movieclips. ;).
Be cool and keep posting,
Regards,
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.