Link to home
Start Free TrialLog in
Avatar of smuffles
smuffles

asked on

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?
Avatar of rascalpants
rascalpants
Flag of United States of America image

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
I forgot to mention, that you should either turn the image into a button, or place an invisible button over it...

rp
ASKER CERTIFIED SOLUTION
Avatar of rascalpants
rascalpants
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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

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
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
Avatar of smuffles
smuffles

ASKER

Yeah, thanks rj and Z, it all works now,

Smuffles
rp even :P
so who gets the points :)


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

thanks

rp