A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: New to Arrays... help please!

  1. #1

    New to Arrays... help please!

    Hey there... was wondering if anyone could help me on building an array.

    I've looked into tutorials and stuff but they all do different things and none are what i'm looking for.

    Here's what i'm looking for: There will be an Array with a list of quotes, and a MC containing a dynamic text box. The MC animates, and when it's done animating, the quote inside the dynamic text box is changed to the next quote. It continues animate, then switch, animate, switch, and so on until it restarts the list (array). Can anyone help me?

    Thanks alot!

    -Andrew

  2. #2
    Senior Member
    Join Date
    Oct 2003
    Posts
    388

    Re: New to Arrays... help please!

    quoteArray=["quote1","quote2","quote3","quote4","quote5"]
    i=0



    on the end of animation (when you have to change quote):

    textVar = quoteArray[i]
    i++
    if(i==quoteArray.length) {
    i=0
    }

  3. #3
    ...and the law won TheSheriff's Avatar
    Join Date
    Feb 2004
    Location
    Philly
    Posts
    235
    Is there anyway instead of quotes, to import data from a database to be displayed and if so would I just import the url?

  4. #4
    Senior Member
    Join Date
    Oct 2003
    Posts
    388
    you'll have to use PHP to import data from database... instead of that you can import quotes from TXT file...

  5. #5
    ...and the law won TheSheriff's Avatar
    Join Date
    Feb 2004
    Location
    Philly
    Posts
    235
    DuJo,

    Are the 'quotes' being pulled from an external file (.txt)? If not how would you set that up?

    Man I don't know how some of you guys know how to do all of this.

  6. #6
    Senior Member
    Join Date
    Oct 2003
    Posts
    388
    you can write this in TXT file..


    quotes=quote1
    quote2
    quote3
    quote4
    quote5




    and then write this in frame action...



    loadQuotes = new LoadVars()
    loadQuotes.onLoad = function() {
    _root.quoteArray = this.quotes.split("\n")
    }
    loadQuotes("name_of_txt_file.txt")


    and you'll get this...

    quoteArray=["quote1","quote2","quote3","quote4","quote5"]

  7. #7
    ...and the law won TheSheriff's Avatar
    Join Date
    Feb 2004
    Location
    Philly
    Posts
    235

    Dujo you rock

    Thanks for replying its getting harder to get good help these days.

    My text is scrolling however it is displaying '_level0.quoteArray.textVar' instead of any of my quotes. Any ideas?

  8. #8
    ...and the law won TheSheriff's Avatar
    Join Date
    Feb 2004
    Location
    Philly
    Posts
    235
    Also

    Does this string need to be edited 'this.quotes.split("\n")' what is the .split and "\n" for?

  9. #9
    Senior Member
    Join Date
    Oct 2003
    Posts
    388

    Re: Dujo you rock

    loadQuotes = new LoadVars()
    loadQuotes.onLoad = function() {
    _root.textVar = this.quotes
    }
    loadQuotes("name_of_txt_file.txt")

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center