dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Is there a way to do this?

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2006
    Posts
    248

    Is there a way to do this?

    I got this loop that should loop until it reaches the length of an array
    for (var i:int = 0; i < d_listDataArray.length; i++)
    The problem is that, it should NEVER be greater than 15.(The array can be all from 1-500)

    I guess the pseudo code for this would look like this:
    for (var i:int = 0; i < d_listDataArray.length but maximum 15!!; i++) {

    Is there any simple way to do this?
    It's kind of hard to explain and I don't really know what to google for either..

    Kind regards,
    Leo.

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Before the loop you do this:

    if (d_listDataArray.length <= 15)
    {
    var aLength:int = d_listDataArray.length;
    }
    else
    {
    aLength = 15;
    }
    for (var i:int = 0; i < aLength; i++)
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Senior Member
    Join Date
    Sep 2006
    Posts
    248
    Thanks a lot!
    Gonna work on it right away!
    Cherio!
    Leo.

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Also
    Code:
    for (var i:int = 0; i < d_listDataArray.length && i < 15; i++) {

  5. #5
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Or

    Code:
    var i:int;
    var max:int = Math.min(d_listDataArray.length, 15);
    for(i = 0; i < max; i++){
    
    }

  6. #6
    Senior Member
    Join Date
    Sep 2006
    Posts
    248
    Thank u all for ur replies!
    Got it working!
    :-)

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