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("backgroundColor", 0x094886);
calendar_dc.setStyle("disabledColor", 0x999999);
calendar_dc.setStyle("rollOverColor", 0x000000);
calendar_dc.setStyle("headerColor", 0x002D61);
calendar_dc.setStyle("todayColor", 0x000000);
calendar_dc.setStyle("selectionColor", 0x003366);
calendar_dc.setStyle("color", 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.dateGrid["dayBlock4label4"].setStyle("color", "0xFFFFFF");

EX: _root.calendar_mc.calendar_dc.dateGrid["dayBock" + 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!
christamccAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dushan De SilvaTechnology ArchitectCommented:
Please make sure the instance of  position your trying to change styles is "calendar_dc" and in the same frame.

BR Dushan
christamccAuthor Commented:
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.dateGrid["dayBlock4label4"].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.dateGrid["dayBlock4label4"].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
Dushan De SilvaTechnology ArchitectCommented:
Hi Christa,
Thanks for yout big explaination!, and sorry for the delay...
Could try to replace in code
_root.calendar_mc.calendar_dc.dateGrid["dayBlock4label4"].setStyle("color", "0xFFFFFF");
as
_root.calendar_dc.dateGrid["dayBlock4label4"].setStyle("color", "0xFFFFFF");

And

 _root.calendar_mc.calendar_dc.dateGrid["dayBock" + row + "label" + col].setStyle("color", "0xFFFFFF");
as
 _root.calendar_dc.dateGrid["dayBock" + row + "label" + col].setStyle("color", "0xFFFFFF");

BR Dushan


Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

christamccAuthor Commented:
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
Dushan De SilvaTechnology ArchitectCommented:
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
christamccAuthor Commented:
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!
christamccAuthor Commented:
Still try to figure this out, question not abandoned.  Hoping to hear from Dushan on anyone else!  Thanks!
Aneesh ChopraCommented:
Hi,

actually you are trying to set the style of wrong property....

use "textColor" instead of "color"

following code will work for you...

replace your button code with the following:
--------------
on (release) {
      _root.calendar_mc.calendar_dc.dateGrid["dayBlock4label4"].setStyle("textColor", "0xFF0000");
      txt.text = "Button Works!";
}
------------

Rgds
Aneesh

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
christamccAuthor Commented:
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?
Aneesh ChopraCommented:
Thnks for appreciation,
you are satisfy with the result,
that's enough for me as consideration.

Rgds
Aneesh
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.