[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Highlight Specific Dates on Flash's DateChooser

Posted on 2006-03-27
10
Medium Priority
?
789 Views
Last Modified: 2008-02-01
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!
0
Comment
Question by:christamcc
  • 5
  • 3
  • 2
10 Comments
 
LVL 17

Expert Comment

by:Dushan De Silva
ID: 16306985
Please make sure the instance of  position your trying to change styles is "calendar_dc" and in the same frame.

BR Dushan
0
 

Author Comment

by:christamcc
ID: 16307104
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
0
 
LVL 17

Expert Comment

by:Dushan De Silva
ID: 16423872
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


0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:christamcc
ID: 16458442
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
0
 
LVL 17

Expert Comment

by:Dushan De Silva
ID: 16485763
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
0
 

Author Comment

by:christamcc
ID: 16490510
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!
0
 

Author Comment

by:christamcc
ID: 16672499
Still try to figure this out, question not abandoned.  Hoping to hear from Dushan on anyone else!  Thanks!
0
 
LVL 34

Accepted Solution

by:
Aneesh Chopra earned 2000 total points
ID: 16673385
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
0
 

Author Comment

by:christamcc
ID: 16696621
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?
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16696629
Thnks for appreciation,
you are satisfy with the result,
that's enough for me as consideration.

Rgds
Aneesh
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question