Dynamic text and stuff

I'm making a flash movie at home and I want to make an image that when hovered over makes a dynamic text box update with a different bit of writing (randomly chosen). I'm a bit confused as how to update the dynamic text box, any help?
smufflesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rascalpantsCommented:
put this in the first frame of the movie:

textArray = new Array("first statement", "second statement", "third statement");


put this on a button:

on(rollOver){
  n = Math.round(Math.random()*3);
  _root.text1 = _root.textArray[n-1];
}


this assumes that your dynamic text box has a Var of "text1"


does this answer your question?


rp
0
rascalpantsCommented:
I forgot to mention, that you should either turn the image into a button, or place an invisible button over it...

rp
0
rascalpantsCommented:
use this instead for three randome text statements:

on(rollOver){
  n = Math.round(Math.random()*2);
  _root.text1 = _root.textArray[n];
}


just replace the 2 with the total number of statements(minus 1) and you should be able make this work in your example...


rp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ZefferCommented:
it's quite tricky trying to just explain..as rp has found..:)
I have made a sample which uses a slightly different approach using 'if' statements..

www.redpearl.co.nz/misc/randomtext.zip

Z
0
rascalpantsCommented:
Z, your code is a little out of date :)

" random(3); "

random() is deprecated...  should be using the the most current code when possible...

also, it seems my code takes less typing, and is only located in two spots...  I had a little trouble trying to find your engine :)


rp

0
ZefferCommented:
fair comments..rp..and your solution is elegant and contemporary..
I personally don't have a problem with using 'deprecated' code though..it will be supported for the forseeable future..and two things about my example..
1. It works
2. It works :)

Z
0
rascalpantsCommented:
he he he :)

but so does mine...

so I guess I am just a bit more elegant than your are :)


either way, smuffles, come back and pick one... they both "work"


rp
0
smufflesAuthor Commented:
Yeah, thanks rj and Z, it all works now,

Smuffles
0
smufflesAuthor Commented:
rp even :P
0
rascalpantsCommented:
so who gets the points :)


rp(rj)
0
smufflesAuthor Commented:
hehe had flu, sorry it took a while
0
rascalpantsCommented:
smuffles had the sniffles :)

thanks

rp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.