CS3 [doubt]creating calender trouble
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [doubt]creating calender trouble

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    10

    Unhappy [doubt]creating calender trouble

    I just create an outline of a calander with 7x5 dynamic text blocks. And I set instance names starts from o0 to o34. how to I fill up these calender? the below code doesnt works.
    Code:
    time = new Date()
    var month = time.getMonth()
    var year = time.getFullYear()
    var arr:Array= new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    day1 = new Date(year,month,1,0,0,0,0);
    var weekday = day1.getDay()
    var str:Array = new Array(arr[month]);
    for(var i=0;i<=arr[month];i++){
    	str[i] = "o"+String(i);
    }
    var j=1;
    for(var i=weekday;i<=arr[month];i++){
    	str[i].text = j;
    	Math.floor(j++);
    }
    week.text = weekday+" "+arr[month];

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Just took a quick look at your code and there are too many holes to fill.

    If I were you, I would write out on paper exactly what you are trying to do, and then create some functions that will do what you desire. Parts of your code have the beginning of your solution such as the use of loops. But you may need some other arrays and logic to make it work like you want it to.

    Looking at your existing code, I have the following syntax errors:
    - missing var before time
    - missing var before day1
    - you are using same var i in both loops

    Things to think about
    - How will you call each dynamic text box? You could create an array that contains all of your dynamic text boxes
    - What if a month starts on Saturday? Depending on the month, you may need 6 weeks.
    - Are you just creating the current month calendar or do you want to create all months?
    - Will you want the name of the month?
    - How do you calculate Leap Year?
    - How will you determine which day of the week to begin on?

    Once you answer these questions, you can start populating your 7x5 or 7x6 grid of dynamic text boxes.

    Good Luck!

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    10
    that's the only the thing i want. How to call the dynamic blocks using an array? just creating array which have o0.text to o34.text and how to I fill up? the other things like leap year and saturday etc are ok. Can u pls post edited code here

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

Poll by Flashkit.com