?
Solved

Dynamic text and stuff

Posted on 2003-02-26
12
Medium Priority
?
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

771 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