christamcc
asked on
Highlight Specific Dates on Flash's DateChooser
I'm using Flash 8. I have an instance of DateChooser named calendar_dc in a movie named calendar. I have an instance of calendar in my main scene name calendar_mc.
In my calendar movie frame 1 I have actionsscript setting the style of calendar_dc.
EX:
calendar_dc._y = -45;
calendar_dc._x = -120;
calendar_dc.setSize(269, 140);
calendar_dc.setStyle("back groundColo r", 0x094886);
calendar_dc.setStyle("disa bledColor" , 0x999999);
calendar_dc.setStyle("roll OverColor" , 0x000000);
calendar_dc.setStyle("head erColor", 0x002D61);
calendar_dc.setStyle("toda yColor", 0x000000);
calendar_dc.setStyle("sele ctionColor ", 0x003366);
calendar_dc.setStyle("colo r", 0x003366);
In frame 1 of scene1 I use action script to collect data from a database (using a web service) to list events that exist when you click on a date.
What I'm trying to do is change the font color of the dates where there is an event. I have a function that goes through the dates to highlight and outputs the appropriate col and row number to use in this setstyle:
_root.calendar_mc.calendar _dc.dateGr id["dayBlo ck4label4" ].setStyle ("color", "0xFFFFFF");
EX: _root.calendar_mc.calendar _dc.dateGr id["dayBoc k" + row + "label" + col].setStyle("color", "0xFFFFFF")
MY PROBLEM:
It seems that once the calendar is completely loaded I can't just set a style, so by the time my movie gets to the the ...dateGrid[..].setStyle.. . part of my code it's too late.
What would you suggest as a solution? Is there a way to Dynamically change the style of a DateChooser without having to reload it?
Thanks!
In my calendar movie frame 1 I have actionsscript setting the style of calendar_dc.
EX:
calendar_dc._y = -45;
calendar_dc._x = -120;
calendar_dc.setSize(269, 140);
calendar_dc.setStyle("back
calendar_dc.setStyle("disa
calendar_dc.setStyle("roll
calendar_dc.setStyle("head
calendar_dc.setStyle("toda
calendar_dc.setStyle("sele
calendar_dc.setStyle("colo
In frame 1 of scene1 I use action script to collect data from a database (using a web service) to list events that exist when you click on a date.
What I'm trying to do is change the font color of the dates where there is an event. I have a function that goes through the dates to highlight and outputs the appropriate col and row number to use in this setstyle:
_root.calendar_mc.calendar
EX: _root.calendar_mc.calendar
MY PROBLEM:
It seems that once the calendar is completely loaded I can't just set a style, so by the time my movie gets to the the ...dateGrid[..].setStyle..
What would you suggest as a solution? Is there a way to Dynamically change the style of a DateChooser without having to reload it?
Thanks!
ASKER
Thanks for you comment Dushan. I can confirm that "calendar_dc" is the instance I'm trying to change. I tested it by placing this:" _root.calendar_mc.calendar _dc.dateGr id["dayBlo ck4label4" ].setStyle ("color", "0xFFFFFF");" in the same frame as my calendar_dc (with the other setStyles in Frame1 of the Calendar Movieclip) and it did create the color of that date at dayBlock4label4 when the Calendar loads.
...but if I place that setStyle IN A FUNCTION in that same frame (Frame1 of Calendar Movieclip) then it doesn't change. When I step through the code I can see that the DateChooser Calendar is first being formatted by all the set styles (which sit in frame1 of my Calendar Movieclip) and the calendar looks completely loaded, then the script goes to back to my code in Frame 1 of the maintimeline (Scene1) collects the appropriate dates. There is a funtion call from Frame1 Scene1 that passes the array of dates back to my function in Frame1 of the Calendar Movieclip. I can see Flash stepping through and hitting the _root.calendar_mc.calendar _dc.dateGr id["dayBlo ck4label4" ].setStyle ("color", "0xFFFFFF"); line of the function but nothing changes. That's why I got the feeling that I can't change the style of the calendar once it was fully loaded. I also have used a trace to see that the right variable values have passed and have also tried it with constant instead of variables. I have tried a very stripped down version of what I'm doing for testing puposes with no luck. (fyi - I'm using an absolute path only because I've been trying this function all over my Movie.)
Hopefully some of what I said will give a clue of what is happening. I feel like my explination needs a diagram with it to make sense!
thanks for any trouble shooting suggestions!
Christa
...but if I place that setStyle IN A FUNCTION in that same frame (Frame1 of Calendar Movieclip) then it doesn't change. When I step through the code I can see that the DateChooser Calendar is first being formatted by all the set styles (which sit in frame1 of my Calendar Movieclip) and the calendar looks completely loaded, then the script goes to back to my code in Frame 1 of the maintimeline (Scene1) collects the appropriate dates. There is a funtion call from Frame1 Scene1 that passes the array of dates back to my function in Frame1 of the Calendar Movieclip. I can see Flash stepping through and hitting the _root.calendar_mc.calendar
Hopefully some of what I said will give a clue of what is happening. I feel like my explination needs a diagram with it to make sense!
thanks for any trouble shooting suggestions!
Christa
Hi Christa,
Thanks for yout big explaination!, and sorry for the delay...
Could try to replace in code
_root.calendar_mc.calendar _dc.dateGr id["dayBlo ck4label4" ].setStyle ("color", "0xFFFFFF");
as
_root.calendar_dc.dateGrid ["dayBlock 4label4"]. setStyle(" color", "0xFFFFFF");
And
_root.calendar_mc.calendar _dc.dateGr id["dayBoc k" + row + "label" + col].setStyle("color", "0xFFFFFF");
as
_root.calendar_dc.dateGrid ["dayBock" + row + "label" + col].setStyle("color", "0xFFFFFF");
BR Dushan
Thanks for yout big explaination!, and sorry for the delay...
Could try to replace in code
_root.calendar_mc.calendar
as
_root.calendar_dc.dateGrid
And
_root.calendar_mc.calendar
as
_root.calendar_dc.dateGrid
BR Dushan
ASKER
Well ...I even tried praying to the flash gods before trying your suggestion and it didn't work.
I had to take some time away from it for a little while to work on some other stuff, but I'm going to dive into the dataGrid and calendar Classes to see if I can get a clue.
If you think of ANYTHING please give a shout!
thanks Dushan!
Christa
I had to take some time away from it for a little while to work on some other stuff, but I'm going to dive into the dataGrid and calendar Classes to see if I can get a clue.
If you think of ANYTHING please give a shout!
thanks Dushan!
Christa
You are Welcome Christa!
Could you upload your Fla to some where. So I can have a closer look.
Or my email is on profile.
BR Dushan
Could you upload your Fla to some where. So I can have a closer look.
Or my email is on profile.
BR Dushan
ASKER
Ok...I've upload the very simple Test flash file that I made to fiddle with. I've commented all actionscript that needed it to make it easier to follow (although this is really basic).
http://www.girlnextdoordesign.com/flash_test/Christa_calendar_test.zip
Basically in the test the calendar loads and is formatted (from the action script in frame1 of the dc1 movie clip). Then theoretically when you click the button the date should change color (action script is on the button).
Let me know if you have any questions!
Thanks!
http://www.girlnextdoordesign.com/flash_test/Christa_calendar_test.zip
Basically in the test the calendar loads and is formatted (from the action script in frame1 of the dc1 movie clip). Then theoretically when you click the button the date should change color (action script is on the button).
Let me know if you have any questions!
Thanks!
ASKER
Still try to figure this out, question not abandoned. Hoping to hear from Dushan on anyone else! Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Aneesh for looking at this! ...and oh my gosh!! I can't believe, it does actually work!!
I could cry you've made me so happy! I've been all over the web and through so many books trying to get it to work.
Can I give you a billion points?
I could cry you've made me so happy! I've been all over the web and through so many books trying to get it to work.
Can I give you a billion points?
Thnks for appreciation,
you are satisfy with the result,
that's enough for me as consideration.
Rgds
Aneesh
you are satisfy with the result,
that's enough for me as consideration.
Rgds
Aneesh
BR Dushan