A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: ARRAY and while

  1. #1
    Owner of the ™ thread tublu's Avatar
    Join Date
    Nov 2000
    Posts
    2,430
    OK ...
    here's the prob .
    I have got a array named months for eg.
    where i am collecting some Movie Clips Instance names which I will make invisble . by creaing a simple function .
    Code:
    monthname = new Array();
    mydate = new Date();
    monthname[0] = january;
    monthname[1] = february;
    monthname[2] = march;
    monthname[3] = april;
    monthname[4] = may;
    monthname[5] = june;
    monthname[6] = july;
    monthname[7] = august;
    monthname[8] = september;
    monthname[9] = october;
    monthname[10] = november;
    monthname[11] = december;
    function clscr () {
        x = 0;
        while (x<=11) {
            monthname[x]._visible = false;
            x++;
        }
    }
    clscr();
    Now I want to use the mydate.getmonth to get the current month . Do i store that in another variable ?
    If so , now I wan't to make it so , whatever month it gets ... say for eg. it is August .... then How do I make that month MC visible ?
    If I put it in another While Loop , then it gets thecurrent month OK ... but then due to the Increment i.e x++
    it forwards to the last month i.e Array Element 11 and goes to the last month

    Hope you understood what i want !!
    If I can use a break statement somehow ... I can't seem to . when it reaches the current month ... then it will go out of the loop , my problem would be solved i guess .


  2. #2
    Junior Member
    Join Date
    May 2002
    Posts
    24
    try this:
    Code:
    i=mydate.getmonth
    monthname[i]._visible = true;
    hope that helps.
    -matt

  3. #3
    Owner of the ™ thread tublu's Avatar
    Join Date
    Nov 2000
    Posts
    2,430
    Originally posted by matticiousg
    try this:
    Code:
    i=mydate.getmonth
    monthname[i]._visible = true;
    hope that helps.
    -matt

    bump ... any more suggestions ? ??

  4. #4
    Junior Member
    Join Date
    May 2002
    Posts
    24
    Woops, I guess I shouldn't have used "i" for my variable. It reads like an italics tag. The code should be like this:
    Code:
        j = mydate.getMonth ();
        monthname[j]._visible = true;
    that should work.
    -matt

  5. #5
    Owner of the ™ thread tublu's Avatar
    Join Date
    Nov 2000
    Posts
    2,430
    that was just great ... thank you very very much

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