A question

Hi, didnt know what to put as the title sorry :slight_smile:

Ok, what I want to do is:

When the mouse hovers over an image, or an area on my flash, i want a piece of text to appear in an area, and when the mouse goes onto another image then the text changes to the relevent piece of imformation.

Do I need to use action script? Or can I do it easily another way in MX?

I have a very rough idea on what to do using dynamic text boxes, but I dont know where to start really!!!

If there is a tutorial on this I have over looked, please feel free to point in the right direction!

Thanks, Pez.

It’s really easiest to do with action script…or I should say… the only way to do it properly is with action script.

You could just put the text in the rollover state of the button in question. It would apear as you desire it, every time someone rolls over the button… but that’s not efficient and it’s really just too darn easy. :slight_smile:

Are you only using Flash MX, or do you have Flash 5.0?.. because I can only describe how to do it in Flash 5.0 terminology. They changed the panels around on us in Flash MX.

I only have MX, sorry. I only started using flash last weekend, so I really dont know how to do anything, this is just something I’ve always wanted to do :smiley:

Well… give me a little time and I’ll work out something for you. I’m sure Pom will correct me if I make any minor mistakes. For the most part, 5.0 and MX are the same… it’s just the location of the panels that is a little different.

Thanks, i will work on the rest in the mean-time… :smiley:

Well the easiest way is to start simple and learn the basics first… so I want to you work on a new movie… not the one you’re currently working on.

Create a button on the main timeline.

Create a new layer.
Select your text tool.
Now… here’s where I’m not sure how MX differs. Look in your text panel. There should be a place for “text options”. However, this might be in the properties panel at the bottem of the main window. Look for a pull down where you can choose, “Dynamic text”.

Once you’ve got that chosen, in the blank layer, click and drag with the text tool until you’ve described a box which will be large enough for the text you want to have in it. For now it doesn’t have to be really large, and you can always resize it later.

You’ll see that the text box stays there and if it is selected with the black arrow tool will have a blue bounding box around it.

With this text box selected, you should see a text field in the properties panel which lets you enter a variable name. Enter “myFirstTextField” into that field.

Now for the button.

Select the button you’ve got on the main timeline and open your “action” panel. Paste the following code.

on(rollOver){
myFirstTextField=entryNumber1;
}

With the button still selected, choose menu option “Edit/Copy” and then “Edit/Paste”. Another button will be pasted on the stage. Move it a little to the right of the first one. Paste another copy and move it a little to that one’s right. Just basicaly line them all up down near the bottom of the screen somewhere.

Select the second one and change the script so that it looks like this.

on(rollOver){
myFirstTextField=entryNumber2;
}

then do the same for the third button so that it says 3 instead of 2.

Now… as a final step.

create a new layer. Select frame one of that layer and paste the following script

entryNumber1=“Hello… this is my first dynamic text message.”;
entryNumber2=“Flash MX Rocks”;
entryNumber3=“DHTML eat your heart out.”;


I know that the above looks a little confusing… but just do it step by step. If it doesn’t work right the first time, write back to me and I’m sure we can fix it.

Basicaly what I’ve done is set you up with the most dynamic of all situations. Your dynamic text field is going to change to whatever the variable myFirstTextField is equal to. The buttons on rollOver, set that variable to equal each of three separate variables that we’ve set on the main timeline. If you want to you can add this to each of the buttons

on(rollOff){
myFirstTextField="";
}

that will make the feild go blank when you roll off of any of the buttons…

let me know how it works out.

I just attempted it, and it didnt work, i think i messed up somewhere, so i will run through it again… by create a button, do you just mean make a circle, convert it to a symbol and make it a button? Because thats what i did.

Just attempted it again and failed, I see the theory behind it, and it should work, i must be doing something wrong.

Do you have AIM? Message me and I’ll walk you through it; my sn is: RenaissanceGerl

and if not… just let me know… I’ll make the example here in Flash 5.0 and send it to you.

Maybe this should help you out. Start with a fresh new movie. Create a textbox on the main timeline. Note that you have to label the textbox in two places. I have no idea what those kooky Flash people were thinking either… just do it. It should look something like this:
<img src=“http://members.tripod.com/renaissancegirl/direct/textbutton1.txt” width=“540” height=“370”>

Now create a button. It doesn’t matter what the button looks like and for time’s sake, I just used one from the components library. Select the button from the stage and add this script:
<img src=“http://members.tripod.com/renaissancegirl/direct/textbutton2.txt” width=“540” height=“370”>

We’re almost there! Finally, just add some default text that will appear when nothing has been clicked yet.
<img src=“http://members.tripod.com/renaissancegirl/direct/textbutton3.txt” width=“540” height=“370”>

Now, just add a couple more buttons and add the exact same button scripts from the second step, with a slight modification of the text ofcourse, and you should be all set! See:

<EMBED src=“http://members.tripod.com/renaissancegirl/direct/textbutton.swf” quality=high bgcolor=#FFFFFF WIDTH=“300” HEIGHT=“200” NAME=“textbox” ALIGN="" TYPE=“application/x-shockwave-flash” PLUGINSPAGE=“http://www.macromedia.com/go/getflashplayer”></EMBED>

By the way, if you want the text to change when the mouse hovers (or in Flash’s case: rollOver) over an image, convert the image to a button and change the scripts to this:

on (rollOver) {
_root.stuff = “Whatever your text might be…”;
}

not to confuse you but you only have to name it in the variable area. Giving it an instance name has no effect one way or the other for everything that I have tried…

Thanks a lot, i will try that this afternoon when I’m not half asleep and dying from hayfeaver :smiley:

I just did it quickly and it works fine, thanks a lot :smiley:

Just one thing; is there any way of making my text box triangular instead of rectangular?

i Don’t think so, but maybe you could modify my Animated Text Tutorial in the Special Effects Actionscript tutorial section of Kirupas site to get a triangular kind of effect…

ahhh… you illiminated half of the dynamicness of my example… :slight_smile: … well whatever works.

I like my method because all your text is set in a single place where it’s easy to find and get at… plus it’s only one step away from loading that information from an external source…

however… for the sake of learning… it’s only important to see how the text box is changed. Thanks for the help Reni. I appreciate it. :slight_smile:

You’re absolutely right upu - I butchered it down to a very simple form so it’s easier to follow. Besides - pezdemon can figure it out I’m sure… it’s the basic concept I was going for.

Thanks for clarifying the intance name/ variable thing Jubs - I really wasn’t sure what that whole thing was, but I put the label on both and it worked and I just left it at that. I’ll keep this in mind in the future.

yeah at first when I convered to MX i was trying to do my own tutorial to make sure everything went off without a hitch, and I accidently kept naming the instance of the Text box and i couldn’t get the effect to work. I tried and tried and tried, and then I realized “Hey, theres another box! Why the @#%$ did Macromedia do that?!!!”

[Edited because I can’t spell “did” and I didn’t want to look stupid. :lol: :slight_smile: ]

Thats what I was doing before :blush: