A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: calendar numbers

  1. #1
    Senior Member green_eye's Avatar
    Join Date
    Apr 2004
    Location
    Sarasota, Florida
    Posts
    1,496

    calendar numbers

    I don’t know if the way that the flash file is set up if it can or can’t be done with the existing code.

    This is what I want to happen …

    get the system day (number)

    If day is the current number when the present is clicked a popup box appears loads the event details for just that day… Until popup box is the closed the remaining presents are inactive.

    If day(number) is in the future displays text not yet...

    If the day (number) has passed the present is not active…

    Any help would be much appreciated…

  2. #2
    Senior Member green_eye's Avatar
    Join Date
    Apr 2004
    Location
    Sarasota, Florida
    Posts
    1,496
    var currentDate=new Date();
    var day=currentDate.getDate();
    trace(day);


    day gives me the current day number ... I have 24 buttons

    when the button is clicked for on that day a popup should appear...

    when a button is clicked in the future then text should appear ..

    when a button is clicked that has passed it should be inactive..

    How do I tie the buttons to the current day from the system clock?

  3. #3
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    When you build your buttons, give them each a Number property equal to the day that it represents. Then in your dayButton click handler, get the current day as you have and compare it to the number property of the button.
    If less than, run your inactive event code, if equal, run that day's event code, if greater, run the not yet code.


    Your button code might have something like this
    Actionscript Code:
    var myDate:Number = 24;

    Then in the clip holding all of the buttons (or where you want to put it and safely scope the buttons)
    Actionscript Code:
    myButton.addEventListener(MouseEvent.CLICK, onMyButtonClick);

    function onMyButtonClick(event:MouseEvent):void{
      var buttonClicked:MovieClip = MovieClip(event.target);
      var currentDate=new Date();
      var day=currentDate.getDate();

      if(buttonClicked.myDate < day){
        // do old dates
      }else if(buttonClicked.myDate == day){
        // do same date
      }else if(buttonClicked.myDate > dat){
        // do future dates
      }
    }

  4. #4
    Senior Member green_eye's Avatar
    Join Date
    Apr 2004
    Location
    Sarasota, Florida
    Posts
    1,496
    Thank you for taking the time to help me.


    The xml/text file will hold 24 entries each of which will contain [ Heading Text, Text Content and a url to the event ] …

    I know how to load simple xml file but not what portion will load for that day. Do I need to use a switch case … I don’t understand how this is done.

    Or each button needs to obtain its own xml file specially...
    Last edited by green_eye; 11-22-2011 at 06:50 PM.

  5. #5
    Senior Member green_eye's Avatar
    Join Date
    Apr 2004
    Location
    Sarasota, Florida
    Posts
    1,496
    XML File has 24 entries

    button1
    Heading
    Content
    URL to event

    button2
    Heading
    Content
    URL to Event
    .
    .
    .
    button24 ...

    When button1 is selected loads just what is in button1
    button2 loads button2 text and so on

    Will a single xml file work this way depending on what button is selected OR do I need to create 24 separate files?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center