Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Dynamic text and stuff

Posted on 2003-02-26
12
Medium Priority
?
178 Views
Last Modified: 2010-05-18
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?
0
Comment
Question by:smuffles
  • 7
  • 3
  • 2
12 Comments
 
LVL 22

Expert Comment

by:rascalpants
ID: 8028782
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
 
LVL 22

Expert Comment

by:rascalpants
ID: 8028795
I forgot to mention, that you should either turn the image into a button, or place an invisible button over it...

rp
0
 
LVL 22

Accepted Solution

by:
rascalpants earned 200 total points
ID: 8029002
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 23

Expert Comment

by:Zeffer
ID: 8030051
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
 
LVL 22

Expert Comment

by:rascalpants
ID: 8034446
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
 
LVL 23

Expert Comment

by:Zeffer
ID: 8036392
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
 
LVL 22

Expert Comment

by:rascalpants
ID: 8037099
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
 

Author Comment

by:smuffles
ID: 8047214
Yeah, thanks rj and Z, it all works now,

Smuffles
0
 

Author Comment

by:smuffles
ID: 8047217
rp even :P
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8057318
so who gets the points :)


rp(rj)
0
 

Author Comment

by:smuffles
ID: 8093372
hehe had flu, sorry it took a while
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8103031
smuffles had the sniffles :)

thanks

rp
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question