dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Date to pick the month

  1. #1
    Hello all,

    I have a button that when I click it. It brings me to my callander page. Well I have created he Entire years callander and would like to be able to go to the correct month. How can I use the date function in the action of the button to take me to he right frame.

    Old day programe I would say if Month = December then goto 1. else if Month = January then goto 2 else if.....

    Anyone hae any clues would be realy helpfull instead of having to changethe calander section on a monthly basis.

    Thanks,
    Attila GnA

    http://server40.hypermart.net/gna/

  2. #2
    deva_station
    Guest
    the key to this is using frame labels, put all your months in an MC. lable each frame for your months january, febuary... and so on
    Code:
    onClipEvent(enterFrame){
    myDate=new Date();
    month=myDate.getMonth();
    MonthOfYear = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Devember"];
    this.gotoAndPlay(MonthOfYear[month]);
    }
    i think you can apply this code for scenes too, just name each scene with the names of the month. the code for scenes is show below:

    Code:
    onClipEvent(enterFrame){
    myDate=new Date();
    month=myDate.getMonth();
    MonthOfYear = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Devember"];
    _root.gotoAndPlay(MonthOfYear[month],1);//gotoand play frame 1 of any given scene based on date. change the figure 1 to any thing to suit your project
    }
    just remember to spell the names correctly as shown in the array... the slightest spelling error will cause it to malfunction

    then drag an instance of that MC on to the stage and copy and paste the code above. hope it works, good luck!

  3. #3
    deva_station
    Guest
    BTW if you are using scenes for your calendar thing... just remember to place the code on a blank MC, for every scene, otherwise it wont work.

    its best to have the blank MC on its own layer and spanning the entire length of the timeline so that its always in execution

    cya

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