[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.
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]);
str[i] = "o"+String(i);
str[i].text = j;
week.text = weekday+" "+arr[month];
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.
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
Click Here to Expand Forum to Full Width