-
refreshing and changing text in a SWF
Hello!
I have been asked to make some changes to some flash work I did on a clients homepage. http://www.storevault.com/
They want the opening text in the SWF file to change every time the page is refreshed, so the heading would change from "the perfect fit... for your growing storage needs" to something else, and then something else, etc.
Can I do this with an action script in Flash? Or would this be in the HTML of the page so that each time the page refreshes, it loads a different SWF file?
Thanks for any info, I am an action script rookie...
PS, I just built the SWF and sent it off, I have no control over the HTML.
cheers,
Zeech26
www.zeechproductions.com
-
-
Sure, it's possible.
Is that just a regular textfield within your SWF that contains the text or is it an image?
Either way...it's possible.
The basic principle is you load all of the text/items into and array. Then use the Math.random() function to randomly choose an index for the item.
If you want to hardcode the values, you could do something like this:
var slogans = array("Text 1", "Text 2", "Text 3");
var randomNumber = Math.ceil(Math.random()*3);
text_field.text = slogans[randomNumber]
You could also do it dynamically, with XML. This would allow your client (or you) to add as many slogans as he/she wanted by just adding it to an external XML file.
-
The Following User Says Thank You to Medyman For This Useful Post:
-
Thanks!
Thanks for the help Medyman, I am an action script rookie, but I will chew on what you posted and will figure it out!
It is just a text field, so I am assuming that will make it easier to do.
cheers!
zack
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks