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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rollover problem almost fixed.....

Status
Not open for further replies.

wavo7

Technical User
Jul 18, 2001
11
US
Hey all,
I posted yesterday about wanting to rollover a button and having text appear. Well the good news is, I can make text appear when I rollover a button, but not it won't disappear when I roll off the button. BUT~!! IT WILL disappear when I rollover the button on the second time!! So....I am so close! What am I missing? Anyone's help would be greatly appreciated..

Micah
 
Wavo...
How are you doing this? Are you just adding some text on the over state when in edit mode of your button?
Or are you using a movie clip, controlled by your button on stage?

;-)ldnewbie
 
Idnewbie,
Ok, my text is a movie that appears to type itself. The button doesn't have anything in the over state because I couldn't get anything to work like that. Instead the button on my scene contains this:
on (rollOver) {
tellTarget ("text") {
play ();
}
}

that's basically it. So yes my button is controlling my movie clip. Thanks again...

Micah
 
Wavo... As I just told Jenny, my handle is oldnewbie! It's subtle... but the smiley replaces the "o".

Ok! Here's what you should try:

First add and empty keyframe at the beginning of your text mc with a stop() action. Also add a stop() action in the last frame of your text mc.

Then correct/add the bold to your above script:
on (rollOver) {
tellTarget ("text") {
gotoAndPlay (2);
}
}
Now since this is not done in the button's edit mode (which could work also!), you'll have to add the following to the above:
on (rollOut) {
tellTarget ("text") {
gotoAndStop (1);
}
}
Here's what's happening. Your text mc is up and ready to go. You don't see it because it's stopped on an empty keyframe. When you roll over the button, it tells the mc to go to frame 2 and play. Since there's a stop action on the last frame, it will stop on this last frame, and just lay there. On roll out, it's told to go to frame 1 and stop, and is thus ready for your next rollover.

Note: Although tellTarget will still work in Flash 5, Macromedia is phasing it out as a command. You should start using this type of code:

on (rollOver) {
_root.text.gotoAndPlay (2);
}


;-)ldnewbie
 
why are they phasing out tell target old do you know?.
e.gif


carlsatterwhite@endangeredgraphics.com
 
OLDnewbie,
thank you thank you!! I got it! I WAS close, but it is now totally fixed:) That was one of those little things that was holding me back, but now you have opened the floodgates!! I truly appreciate it.

Micah

P.S. Sorry about your name, I noticed it after I sent it.
 
They are phasing out TellTarget because they believe it is a substandard command...it can only address certian things...they replaced it WITH, the 'with' command...the with command is able to access multiple objects at once, and also able to access many more things with its use.
Regards,
AnthLOLny
----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
What is the "with" command? I only ever use this way.

on (rollOver) {
_root.text.gotoAndPlay (2);
} roda B-)

Learning is like rowing against the current. As soon as you stop, you start going backwards.
 
Hold on a second, I'll go get my handy-dandy notebook...

ahh, here it is...I'll type it out word by word...it is under Using Multiple methods or actions to target a timeline in the actionscript reference guide...

You can use the
Code:
with
action to address a targeted movie clip once, and then excecute a series of actions on that clip. The
Code:
with
action works on all ActionScript objects (for example Array, Color, and Sound), Not just movie clips. The
Code:
tellTarget
action is not preferred because it does not work with all actionscript objects and is not ECMA-262 compliant.

The
Code:
with
action takes an object as a parameter. The object that you specify is added to the end of the corrent target path. All actions nested inside athe
Code:
with
action, are carried out inside the new target path, or scope. For example, in the following script on the main Timeline, the
Code:
with
action is passed the object donut.hole to change the properties of hole:

Code:
with (donut.hole){
   _alpha = 20;
   _xscale = 150;
   _yscale = 150;
}

It is as if the statements inside the with action were called from the timeline of the hole instance.

In the following example, note the economy of using the
Code:
with
methods of the MovieClip object to issue several instructions:

Code:
with (myMovieclip) {
   _x -= 10;
   _y += 10;
   gotoandplay(3)
}
Regards,
AnthLOLny
----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
Sorry, I got a little jibberish in that 3rd paragraph...
corrent = current
and
athe = the

I hope Roda and Virt see this, Yoda too...everyones been asking and I've been jittering because I had remember seeing it here and I wanted to look big...;)
Regards,
AnthLOLny
----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top