Mike Chambers

code = joy

DRK : Week View Example 1

with 16 comments

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:

//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 abbreviations
var 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 box
function onLanguageChange()
{
	var lan = language_cb.getValue();
	setLanguage(lan);
}

language_cb.setChangeHandler("onLanguageChange");

//change handler for week view component
function onWeekChange()
{
	var selectedDate = myWeekView_wkv.getSelectedDate();
	myCalendar.setSelectedItem(selectedDate);
	myCalendar.setDisplayedMonth(selectedDate);
}

//change handler for calendar component
function 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();

Written by mikechambers

April 25th, 2003 at 10:39 am

Posted in DRK

16 Responses to 'DRK : Week View Example 1'

Subscribe to comments with RSS

  1. this is great albeit a bit slow.

    ericd

    25 Apr 03 at 1:19 pm

  2. yeah, that is the calendar component that is slowing it down a little. ill post another example soon, with just the weekview.

    mike chambers

    mesh@macromedia.com

    mike chambers

    25 Apr 03 at 1:28 pm

  3. is the calendar component inherently this slow? if so, why?

    whatever the case, i do very much appreciate you posting these examples here. thanks!

    rob adams

    25 Apr 03 at 4:44 pm

  4. 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.

    Greg Burch

    25 Apr 03 at 4:54 pm

  5. 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

    rob adams

    25 Apr 03 at 9:49 pm

  6. 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

    rob adams

    25 Apr 03 at 10:12 pm

  7. 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.

    Greg Burch

    25 Apr 03 at 10:40 pm

  8. 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.

    llama

    26 Apr 03 at 4:40 am

  9. 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(

    Abhishek

    26 Apr 03 at 5:44 am

  10. >…in shockwave you would have bitmaps

    not 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

    rob adams

    26 Apr 03 at 10:35 am

  11. No, the calendar component is just particularly CPU intesnive. To be honest, I am not sure why.

    mike chambers

    mesh@macromedia.com

    mike chambers

    26 Apr 03 at 11:18 am

  12. 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.

    Jan

    26 Apr 03 at 9:45 pm

  13. 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.

    Matan

    27 Apr 03 at 9:16 am

  14. 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)

    Kmax

    28 Apr 03 at 1:13 pm

  15. 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.

    Bela

    3 Jul 03 at 10:41 am

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

    Saurabh

    saurabh

    27 Apr 06 at 11:21 pm

Leave a Reply