A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: go to frame if date is between...

  1. #1
    theSWEEN thesween's Avatar
    Join Date
    Nov 2005
    Location
    Hertfordshire, England
    Posts
    305

    go to frame if date is between...

    Hi guys,

    I'd like to make it so a mc will go to one of it frames if the date is between say 1st January and 2nd February (or even using the day of the year if that's easier).. Is this possible? I was trying to work it out but am finding it difficult..

    I was thinking something like...

    janstart = 1
    janend = 31

    currentday = ?? no idea how to work out the day

    onEnterFrame = function(){
    if(currentday >= janstart and currentday <= janend ){
    mc1.goto.frame2;
    } else {

    }
    }

    Is that even close??

    Cheers
    Steve

  2. #2
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    If you are using ActionScript 3, you can use the Date class to construct a date or get the current date.
    http://help.adobe.com/en_US/FlashPla...pt/3/Date.html

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    With AS2, this will guide you along
    PHP Code:
    janstart 1;
    janend 31;

    today = new Date();
    currentdate today.getDate();
    currentmonth today.getMonth() + 1;

    if (
    currentdate >= janstart && currentdate <= janend)
    {
        
    trace("Yes, you are within the set dates. Current date is " currentdate);
        
    trace(currentmonth);
    }
    else
    {
        
    trace("No, you are out of the set dates. Current date is " currentdate);
        
    trace(currentmonth);


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