A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Pulling Data out of Arrays

  1. #1
    Junior Member
    Join Date
    Jun 2001
    Posts
    14
    Okay so what I want to do is this:

    I have an array pulled in from a .csv file.
    Looks something like this after I turn the String into an Array:

    myArray =["productA"|"companyA"|"myProductA"|"productB"|"com panyB"|"myProductB"] etc... etc....

    What I want to do is only List the "myProductA" out of this Array. All of the myProducts actually: myProductA, myProductB, etc.

    How would I go about extracting a list from the Array and creating a newArray? How would I loop it maybe? Say every 3rd item pull somehow?

    Time is of the essense here for me so I appreciate all of your help!!

    Thanks!

  2. #2
    Junior Member
    Join Date
    Nov 2001
    Posts
    21
    Originally posted by dmigreg
    Okay so what I want to do is this:

    myArray =["productA"|"companyA"|"myProductA"|"productB"|"com panyB"|"myProductB"] etc... etc....

    What I want to do is only List the "myProductA" out of this Array. All of the myProducts actually: myProductA, myProductB, etc.
    How would I go about extracting a list from the Array and creating a newArray? How would I loop it maybe? Say every 3rd item pull somehow?
    Thanks!
    A loop should do the trick
    somthing like this (this is not working code)

    for loopcount = 0 to myArray.length / 3

    NewArray[loopcount] = MyArray[((3*loopcount) + 2)]

    loop

    so when loopcount = 0
    NewArray[0] = myArray[2] which is the third array position (starts at 0)
    NewArray[1] = myArray[3+2] = myArray[5]
    NewArray[2] = myArray[6+2] = myArray[8]....

    regards

  3. #3
    Junior Member
    Join Date
    Jun 2001
    Posts
    14
    Thanks I will try this. Do you think there is an easier or more stable way to do this though?

    Should I try using something other than Arrays to pull in the data? This will be on a CD so I cannot use any type of 3rd party scripting such as ASP, CGI, Perl etc.

    Thanks again!!

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