Results 1 to 3 of 3

Thread: refreshing and changing text in a SWF

  1. #1
    Join Date
    Mar 2008
    Posts
    46
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default 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

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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.

  3. The Following User Says Thank You to Medyman For This Useful Post:

    zeech26 (03-14-2008)

  4. #3
    Join Date
    Mar 2008
    Posts
    46
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Thumbs up 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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •