DRK : Week View Example 1

I have uploaded another component example from Flash UI Component Set 5 on DRK 3. This one uses the Week View component (DRK 3) as well as the Advanced Calendar Component from DRK 2.

This example is included on the DRK (one of the 66 component sample files).

You can view the on-line docs for the Week View componenthere.

You can find more information about the Flash UI Component Set 5 (which includes the Week View component) here.

You can find more information about DRK 3 here.

Here is the code:[code]//Set up the arrays of French day and month abbreviations.var days_fr = [“Dim”, “Lun”, “Mar”, “Mer”, “Jeu”, “Ven”, “Sam”];var months_fr = [“Jan”, “Fev”, “Mar”, “Avr”, “Mai”, “Jui”, “Jui”,”Aou”, “Sep”, “Oct”, “Nov”, “Dec”];//store the english day and month abbreviationsvar days_en = myWeekView_wkv.getDayArray();var months_en = myWeekView_wkv.getMonthArray();//this function sets the new languages for the components.function setLanguage(lan){myWeekView_wkv.setDayArray(this[“days_” + lan]);myWeekView_wkv.setMonthArray(this[“months_” + lan]);myCalendar.setMonthNames(this[“months_” + lan]);}//make sure the initial value matches the combo box.setLanguage(language_cb.getValue());//change handler for combo boxfunction onLanguageChange(){var lan = language_cb.getValue();setLanguage(lan);}language_cb.setChangeHandler(“onLanguageChange”);//change handler for week view componentfunction onWeekChange(){var selectedDate = myWeekView_wkv.getSelectedDate();myCalendar.setSelectedItem(selectedDate);myCalendar.setDisplayedMonth(selectedDate);}//change handler for calendar componentfunction onCalendarChange(){var selectedDate = myCalendar.getSelectedItem();myWeekView_wkv.setSelectedDate(selectedDate);}myCalendar.setChangeHandler(“onCalendarChange”);myWeekView_wkv.setChangeHandler(“onWeekChange”);//make sure both calendar components are synced up.onWeekChange();[/code]

16 Responses to DRK : Week View Example 1

  1. ericd says:

    this is great albeit a bit slow.

  2. mike chambers says:

    yeah, that is the calendar component that is slowing it down a little. ill post another example soon, with just the weekview.mike chambersmesh@macromedia.com

  3. rob adams says:

    is the calendar component inherently this slow? if so, why?whatever the case, i do very much appreciate you posting these examples here. thanks!

  4. Greg Burch says:

    Yea the calendar has a ton of redrawing and processing behind it. Having worked with the code it could be optimized but it still won’t ever be the fastest component. The weekview doesn’t have too much going on so by no means should you have a problem with performance.

  5. rob adams says:

    greg, thanks a bunch for chiming in. as a director guy, i don’t understand up front what would make the calendar component slow… it just seems ridiculously slow compared to something comparable done in shockwave. do you agree?thanks again,rob

  6. rob adams says:

    ok, so at home on a faster machine this thing is not so slow. but still not as snappy as it would be in shockwave.thanks again to everyone for contributing.–rob

  7. Greg Burch says:

    Well the main thing is its all vectors, and the redrawing routines aren’t optimized too well. I would say its the redrawing of the vectors that is the most intensive….in shockwave you would have bitmaps which wouldn’t require rendering.

  8. llama says:

    why is it slow? because Flash is slow (compared to Director). ActionScript is the most slowest interpreted language on the world ;)I heard, that Flash Player is playing animations in very stupid way, which was choosen for it’s simplicity to have small download size of the player. If there can be “broadband version” of the player (1-2MB), it would be much better.

  9. Abhishek says:

    I also have used Tree component, it also takes time and is very slow. This problem intensifies if you access the swf from a remote server say access a swf in India from a server in the US. Is there any solution to that also?? Otherwise I guess I’ll have to go around with a Tree in Javascript :o(

  10. rob adams says:

    >…in shockwave you would have bitmapsnot necessarily.at work, (on a 400mhz w/ 160RAM) this thing has almost a 2 second delay in simply highlighting a date. at home, (on a 1ghz w/ 512RAM) there is still about a half second delay in highlighting a date.neither actionscript nor vector rendering is that slow. is there some baggage associated with being a “component”?again, i truly appreciate the info here. i’m doing my best to not come off like a jerk…:)rob

  11. mike chambers says:

    No, the calendar component is just particularly CPU intesnive. To be honest, I am not sure why.mike chambersmesh@macromedia.com

  12. Jan says:

    It is obviously some inefficient code or design. Clicking on the “next month” button redraws the entire calandar quickly, so highlighting a single day shouldn’t be slow. Someone just needs to profile the code and find out where time is being spent.

  13. Matan says:

    I noticed that the Advanced Calander Component has some bugs in selecting multiple items (at least on this example, on my computer – IE6 Win98SE):- When you try to select multiple items (by dragging the mouse/holding SHIFT key and selecting/holding CTRL key and selecting), it only functions for earlier dates than the one selected first.

  14. Kmax says:

    I really dont know what you are all complaining about. Here on a average computer (amd 900mhz / 256mo / xp) its all good. Near realtime. But seeing that i’m alone to see it like this, probably the “problem” is on my side ;o)

  15. Bela says:

    I’ve noticed that it’s only slow when initially selecting a date. Using shift or ctrl to select additional dates doesn’t take quite so long.

  16. saurabh says:

    This is the calender which i want to create. It a great Help.Saurabh