A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Date based frame selection

  1. #1
    Junior Member
    Join Date
    Sep 2005
    Posts
    7

    Question Date based frame selection

    Greetings!

    And long time no see! I created this account about 10 years ago, but haven't visited in years... I can't even remember if I posted all that much or if I mostly ghosted, but I frequented regularly. Unfortunately my skill set is WAY outdated, (as in Macromedia) but when I stumbled across Flash Kit today while trying to freshen up, I knew this would be the place! Glad to see the forums are alive and well. I'm glad to be back!

    Now I hope this is the right place to be asking said question, besides the occasional stop command I haven't really dabbled with scripting.

    I'm working on an animation for a HyperSpin theme that I want to have display a different series of graphics depending on what season it is. I was hoping there was some way I could set variables for certain segments of dates and then based off those, have Flash jump to a pre-determined frame when the animation starts. Sadly this is WAY beyond my skill level, and I am hoping that someone could help me out, or at the very least point me in the right direction. Most of what I've found involved showing the current date/time within the animation which doesn't really help me out.

    Anyway, thank you for any and all help!

    -Ashek

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,
    This might give you a start.
    PHP Code:
    import flash.display.MovieClip;

    var 
    today:Date = new Date();
    var 
    nowMonth:Number today.getMonth();
    var 
    trueMonth:Number nowMonth 1;
    var 
    months:Array = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

    var 
    movieClip:MovieClip = new MovieClip();

    trace(nowMonth " : Array month");
    trace(trueMonth " : True month");
    trace(months[nowMonth] + " : Month name");

    if (
    trueMonth 4)
    {
        
    movieClip.gotoAndStop(1);
    }

    if (
    trueMonth && trueMonth 7)
    {
        
    movieClip.gotoAndStop(2);
    }

    if (
    trueMonth && trueMonth 10)
    {
        
    movieClip.gotoAndStop(3);
    }

    if (
    trueMonth 9)
    {
        
    movieClip.gotoAndStop(4);


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