Countdown to christmas ActionScripting help

I'm trying to make a countdown clock and was following a tutorial online. Heres the link.
http://www.youtube.com/watch?v=XrTHOUqaS-o&feature=related
Good news! I have the clock working and it is counting down to Sunday like his. But I need it to countdown to christmas and I dont know enough about coding. I tried targetDate but since the coding wasnt setup for it, it didnt work. So any ideas would be great.
stop();
var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTimer);
countdownTimer.start();
function updateTimer(Event:TimerEvent):void{
    var today:Date = new Date();
    var year = today.getFullYear();
    var dtsBegin:Date = new Date(year, 2, 13);
    var dtsEnd:Date = new Date(year, 10, 6);
    if((today >= dtsBegin) && (today <= dtsEnd)){
        today.minutes -= 240;
    else{
        today.minutes -= 300;
    today.minutes += (today.getTimezoneOffset());
    var sunday = 0;
    var s:int = 59 - today.seconds;
    var m:int = 59 - today.minutes;
    var h:int = 0 - today.hours;
    var d:int = sunday - today.day;
    if(s < 0){
        s += 60;
        m--;
    if(m < 0){
        m += 60;
        h--;
    if(h < 0){
        h += 24;
        d--;
    if(d < 0){
        d += 7;
    var days:String = new String(d);
    var hours:String = new String(h);
    var minutes:String = new String(m);
    var seconds:String = new String(s);
    if(days.length < 2) days = "0" + days;
    if(hours.length < 2) hours = "0" + hours;
    if(minutes.length < 2) minutes = "0" + minutes;
    if(seconds.length < 2) seconds = "0" + seconds;
    var time:String = days + ":" + hours + ":" + minutes + ":" + seconds;
    time_txt.text = time;
    if(s + m + h + d <= 0){
        countdownTimer.stop();
        gotoAndPlay(2);

use:
stop();
var countdownTimer:Timer = new Timer(1000);
countdownTimer.addEventListener(TimerEvent.TIMER, updateTimer);
countdownTimer.start();
function updateTimer(Event:TimerEvent):void{
    var today:Date = new Date();
    var year = today.getFullYear();
    var dtsBegin:Date = new Date(year, 2, 13);
   var dtsEnd:Date = new Date(year, 11, 25);
    if((today >= dtsBegin) && (today <= dtsEnd)){
        today.minutes -= 240;
    else{
        today.minutes -= 300;
    today.minutes += (today.getTimezoneOffset());
    var sunday = 0;
    var s:int = 59 - today.seconds;
    var m:int = 59 - today.minutes;
    var h:int = 0 - today.hours;
    var d:int = sunday - today.day;
    if(s < 0){
        s += 60;
        m--;
    if(m < 0){
        m += 60;
        h--;
    if(h < 0){
        h += 24;
        d--;
    if(d < 0){
        d += 7;
    var days:String = new String(d);
    var hours:String = new String(h);
    var minutes:String = new String(m);
    var seconds:String = new String(s);
    if(days.length < 2) days = "0" + days;
    if(hours.length < 2) hours = "0" + hours;
    if(minutes.length < 2) minutes = "0" + minutes;
    if(seconds.length < 2) seconds = "0" + seconds;
    var time:String = days + ":" + hours + ":" + minutes + ":" + seconds;
    time_txt.text = time;
    if(s + m + h + d <= 0){
        countdownTimer.stop();
        gotoAndPlay(2);

Similar Messages

  • Actionscript help with symbol control (Flash 8)

    I have a bunch of symbols on the stage and want to control
    them with actionscript to cut down on the workload. The attached
    code is what I've created that works for the most part with 3
    problems/customization desires:
    1) When I test this the POST still sends my variables in a
    querystring like a GET (only read by request.querystring). How to
    make the POST act like a POST.
    2) My mouse over creates a larger symbol. How could I get
    this to animate the growth to a larger symbol?
    3) My shadow effect is just a transparent copy of the
    original symbol. How can I change the color to be transparent
    black? Or is there a better way?

    let's see if i can help...
    1) you should use LoadVar.sendAndLoad - rather than just send
    in order to maintain the current swf file - even if you only
    specify a "POST" method param.
    2) you should use the Tween class to 'grow the scale of the
    button - and shrink back to size it onRollOut - without a need to
    create a duplicate instance.
    3) you should use the DropShadowFilter to achieve this with
    code
    so this should look like:

  • Actionscript help on semi-advance flash

    So I'm trying to create a flat carousel similar to the one
    located here
    http://www.square-enix.com/na/index_f2.html
    (as a side note before reading the 2nd half, my trouble is with
    the thumbnail loop buttons)
    I have created all the graphic elements, now I'm in the
    planning stage of the actionscript, and this is where I'm hitting
    some trouble, so if I could barrow some actionscript pro's mind
    that would be awesome.
    My thought process is to create a movie clip and have it be
    replaced with images imported through an XML file (for easy
    updating). After this part I run into trouble, I'm planning on
    taking the MC that got replaced and duplicating it and running the
    MC's side by side, and when one goes too far to the left or right
    move it to the other end of the other MC, this way I create an
    infinite loop.
    My Questions:
    so like how would you make one of the MC's reposition it's
    self on the X axis to the end of the other movie clip once it has
    moved far enough left or right ? (also what is the method you would
    use to tell flash the limit that the MC is far enough left or right
    and it should reset it's self?)
    How would you make each thumbnail button change the image on
    the main stage upon clicking the thumbnail button when all the
    images are imported through the xml document?
    Thank you for help and time spent reading this.
    if you have any questions, please ask.
    thanks once again.
    -Mark

    Rob,
    First of all I would like to greatly thank you for all you
    have done for me. It has been so useful and such a learning
    experience getting to go through your personal code. and
    manipulating it to my personal flash. Thank you so much!
    However, I'm reaching some trouble when I try to import my
    XML file, or something is just missing.
    so here is the break down:
    in my main .fla file I have this actionscript to import your
    .as file (with modifications made to the name and package)
    var Carousel:carousel = new carousel();
    trace(Carousel);
    now that seems to import into my FLA just fine, the trace
    tells me that [object carousel] which I assume that means the
    object has loaded into the FLA.
    So anyway there is nothing on my stage in the main FLA, which
    I assume is because the XML is not getting loaded properly into the
    flash/actionscript.
    My XML (minus all the images but one):
    <icons>
    <icon image="icon1.jpg" />
    </icons>
    so this is the basic of my XML, when I import the xml into a
    more simpler file the jpgs work just fine.
    now I thoroughly went through your script examining every
    functions and var and I'm able to understand majority of it however
    parts of the import section is what confuses me, so if you could
    help me understand the script more that would be amazing.
    (the line numbers are probably off a little because I deleted
    a couple unnecessary variables for my flash)
    in line 57: urlLoader.addEventListener("complete", loaded);
    why do you have "complete" instead of Event.COMPLETE... is
    there a difference?
    in line 81 & 82: var count1:uint = source.indexOf("/") +
    1;
    var count2:uint = source.indexOf(".");
    please explain what "/" and "." means... do I replace it with
    location of the nodes in my xml?
    so yeah this is the gist of it, if you could help me figure
    out how to import my XML properly that would be great, or if you do
    not have the time do that maybe you could let me check out your
    XML, piece it all together and figure out the difference of your
    working copy and my unworking copy.
    Once again Thank you so MUCH! for taking your time in helping
    me out, I hope things are going well for ya.
    -Mark

  • Easy ActionScript - helper Class for everyone

    I have put together a number of methods that help do common tasks in ActionScript 3 in an easier way.
    Providing powerful flexibility and consistency in AS3 is amazing but we have all probably grumbled at the steps involved in setting a color, a volume, a URL, getting a random number between two numbers, applying a font via code, accessing server data and XML, etc.    Easy ActionScript lets you do these in a line or two using static methods of the Easy class.
    http://easyactionscript.wordpress.com/
    The code is helpful for beginners and even time saving for advanced coders.
    Please let others know if you think it will be helpful.  Also, leave a comment on the blog if you have any additional requests or suggestions.
    Thanks,
    Dan Zen

    Thanks for the question.  It adds about 3K.  I can't imagine there would be any speed difference.  It is just calling the same methods that you would call but one method removed ;-)

  • Simple Actionscript Help

    Ok, well i was playing around attempting to make a website (which will not be used)... but i want to know anyway.
    Here is a link to what it looks like at the moment.
    http://tozzel.webs.com/index.htm
    I want:
    The black 'curtains' to stop before moving.
    To make a 'play' button that enables the 'curtains' to draw back.
    When the 'curtains' draw back i want it to be the 'home' page and not the 'requirements' page.
    I understand you will probably need the FLA file, so if you know where i can upload it, please post or PM. (I've looked on google and couldn't find anywhere.)
    Please help!

    Make two layers: one for the curtain and one for the words. You make a button and press F9 to add actionscript:
    on(press){
         _root.curtains.play()
    You need to put the stop code at the beginning of the curtain MC, and give it the instance name:curtains
    At the other layer, put the "Home" page at frame 1.
    P.S. put the stop code on every frame of the words
    P.S. You can upload the file at the attach Files below! ( when you post the message )

  • Actionscript help needed for website

    Hey everyone,
    I am just beginning to learn the basics of creating web sites in flash. I posted this in site design a while ago, but no one has responded yet and I need help asap.
    I have been following a tutorial and have it done pretty well, but they only cover one main button, and I am at the point where I need several more, but I am doing something wrong.
    The tutorial is at this page: http://www.flash-game-design.com/flash-tutorials/advancedWebsite-flash-tutorial- 3.html
    You can skip to the end and download the .fla if you want.
    What I want to do specifically is to add probably 4 other main buttons that can also have drop down menus. Please be as specific as possible because the extent of my code knowledge isn't very far.
    Thanks in advance
    The code for the main page is as follows:
    menu = ["About", "Bio", "Contact"];
    this.createEmptyMovieClip("content", 1000);
    this.attachMovie("sectionBackground","mask",1001);
    mask._y = content._y=208;
    mask._x = target=68;
    content.setMask(mask);
    content._x = -1000;
    imageScrollSpeed = 5;
    xStart = 125;
    yStart = 51;
    bWidth = 79;
    bHeight = 17;
    interval = 50;
    countDown = menu.length;
    menuOpen = false;
    theTime = 0;
    buttonScrollSpeed = 2;
    for (var i = 0; i<menu.length; i++) {
    var section = content.attachMovie("section_"+menu[i], "section_"+menu[i], i+100);
    section._x = section._width*i;
    var b = this.attachMovie("subButton", "subButton"+i, countDown);
    countDown--;
    b.stop();
    b._x = xStart;
    b._y = ySwtart;
    b.interval = interval*i;
    b.target = yStart+(bHeight*i);
    b.txt = menu[i];
    b.pos = target+(i*-section._width);
    b.onPress = function() {
      target = this.pos;
      closeMenu();
      this.gotoAndStop(1);
    b.onRollOver = function() {
      this.gotoAndStop(2);
    b.onRollOut = function() {
      this.gotoAndStop(1);
    b._visible = false;
    function closeMenu() {
    for (var i = 0; i<menu.length; i++) {
      var b = this["subButton"+i];
      b._visible = false;
      b._x = xStart;
      b._y = yStart;
    menuOpen = false;
    mainButton.onPress = function() {
    if (!menuOpen) {
      theTime = getTimer();
      menuOpen = true;
      for (var i = 0; i<menu.length; i++) {
       _root.main["subButton"+i]._visible = true;
    } else {
      closeMenu();
    mainButtoncopy.onPress = function() {
    if (!menuOpen) {
      theTime = getTimer();
      menuOpen = true;
      for (var i = 0; i<menu.length; i++) {
       _root.main["subButton"+i]._visible = true;
    } else {
      closeMenu();
    function scrollButtons() {
    if (menuOpen) {
      for (var i = 0; i<menu.length; i++) {
       var b = this["subButton"+i];
       if ((theTime+b.interval)<getTimer()) {
        b._y += (b.target-b._y)/buttonScrollSpeed;
    this.onEnterFrame = function() {
    content._x += (target-content._x)/imageScrollSpeed;
    scrollButtons();

    That's all AS2 code, so you'll be beter off posting in the AS2 forum.

  • Publishing/actionscript help needed

    Okay, first time poster and this is a complete newb cry for help:
    I had someone create a template site for me that is pretty simple - a single swf that pulls resources from a directory of xml files and assets. In theory, I should be able to update the xml for my site and provide new assets. Simple.
    I'm not a total neophyte, i know some code and within the xml there are some <font> tags that over ride the swf's formatting or provide and href. Again simple.
    My problem is that I now have to update our logo, which is hard coded into the source .fla file, which I know how to get in and swap out (the guy who did the work is not available). My problem is, when I publish, the new swf with the new logo does not want to read the <font> tags anymore. I have tried everything and I can't crack this. I've narrowed it down to two possibilities:
    1. Something in the Publish settings, though I've tried every conceivable variation to no avail.
    2. Something in the .as file that defines page template.
    I know I need to provide more info but this is a start. I'm working on a Mac (as was the coder) and we were both using CS4.
    Thanks for any and all help/direction.

    If your in the .fla, and you are simply swapping one symbol in the manner that your speaking, I would probably do a couple things, first I would make sure that the logo your swapping is the same type of object/symbol, same size is good, and then I would backup a copy of the original, and then delete the logo symbol and bitmap, import and name the new logo image the exact same as the other, and then convert it to a symbol with the exact same name as original, then either drag it to the stage in the layer and position it should be with the exact same instance names.
    I'm thinking in terms of a currently working product that I don't want to recode. So simply by taking a working one, and doing absolutely nothing more than changing the object, with everything identical, the code should do what it did before because all the actionscript instances, objects, var, event, and function names are identical, and therefore should use the proper instances at runtime.
    I think.

  • Actionscript Help Needed

    So this is how it goes...I've already made my website, I have
    all the pages and everything made BUT...I have a few bugs. The
    first starts at my login page, it is a universal login, so it has 2
    usernames and passwords, I have the code for it but, It does not go
    when I press the submit button. The next is when I get to my actual
    website, all the webpages but one are all in different scenes. I
    type in the code: on (press) {gotoAndPlay ("1","Corp") ; } but it
    just goes the scene up next. I have no clue what is wrong here. I
    also have a flaw with my loading page, whether than just loads fast
    or not, the loading movie does not loop until the movie is loaded.
    This page is also part of the movie. Can anyone help? The web
    address is:
    http://www.freewebs.com/cliop/
    The code I am using on the button in my intro is:
    on (press) {
    if (username == "Cliop" or username == "X844495") {
    if (password == "*********" or password == "*********") {
    if (username== "Cliop" & password== "*********" or
    username== "X844495" & password== "*********") {
    gotoAndPlay("1", "Main");

    there's an actionscript forum for your issue. Better chance
    of getting help there.
    --> **Adobe Certified Expert**
    --> www.mudbubble.com
    --> www.keyframer.com
    Cliop wrote:
    > So this is how it goes...I've already made my website, I
    have all the pages and
    > everything made BUT...I have a few bugs. The first
    starts at my login page, it
    > is a universal login, so it has 2 usernames and
    passwords, I have the code for
    > it but, It does not go when I press the submit button.
    The next is when I get
    > to my actual website, all the webpages but one are all
    in different scenes. I
    > type in the code: on (press) {gotoAndPlay ("1","Corp") ;
    } but it just goes the
    > scene up next. I have no clue what is wrong here. I also
    have a flaw with my
    > loading page, whether than just loads fast or not, the
    loading movie does not
    > loop until the movie is loaded. This page is also part
    of the movie. Can anyone
    > help?
    >

  • Basic actionscript help, tracing properties of my class object

    Hi all,I'm just starting to learn about classes in actionscript, I am following along with Moocks book Actionscript for Flash MX and are trying to execute a trace on the properties of my ballclass but all I get is undefined. He is what I have in my actions panel.
    function Ball () {
        this.radius = 10;
        this.color = 0xFF0000;
        this.xPosition = 59;
        this.yPosition = 15;
    var boucyBall = new Ball();
    trace (bouncyBall.radius);
    trace (bouncyBall.color);
    trace (bouncyBall.xPosition);
    trace (bouncyBall.yPosition);
    Any help would be great

    Since you are learning about classes, you might want to use one to help you:
    class Util{
    public function Util(){
    // empty constructor because you don't need one for this kind of class
    public static function traceProps(obj:Object,label:String):Void{
    if(label != undefined){
    trace(Properties for "+label+":");
    for(var a in obj){
    trace("   "+a+": "+obj[a]);
    trace(newline);
    Then place that class file somewhere in your class path so it will always be available to you. And then you can always add these lines.
    import com.complexity.Utils;
    If the file is in your class path you don't really need the above line, but it will help you remember that you are using it. Also I'm just making up what your class path might be based upon your screen name. You would need to use whatever actual path you had. And then...
    Utils.traceProps(bouncyBall,"trouble maker here");
    Of course don't use it with an 10,000 element array, unless you really like to suffer.....
    or just
    Utils.traceProps(bouncyBall);

  • My daughter's Ipod has no sound when attempting to playback music and also no radio reception. Just got it for Christmas. HELP!

    My daughter's Ipod 7th generation -- which she just got for Christmas -- has no sound when playing back her music and also has no radio reception. Tried different headphones and resetting the Ipod -- no difference. I was working fine Christmas and the day after. HELP!

    do you have headphones plugged into it?
    the headphones act as an "antenna"

  • Its Christmas, please help :)

    Hi,
    Any help greatly appreciated.
    My Apple TV had been working fine. Today (Christmas Day!!!!) Got a new TV, unplugged Apple TV, plugged it into the new TV and it will not accept my username/password in order for me to stream movies. It did however, work perfectly in order to view photo's and listen to music through iTunes. Movies, different story. I turned off home sharing in iTunes on my MacBook Pro, turned it back on, signed in fine using iTunes, however on my Apple TV, it does not recognise my username/password and now i cannot stream anything via. Apple TV. PLEASE HELP!!!
    Basically, Homesharing refuses to work.
    Many Thanks in advance,
    Reece

    And now I feel like a right dummy because I have just realised that it is the display!! I have a 2 year old Thunderbolt Display and it's making everything look disgusting.
    I'll get onto it. Sorry to ask such a dumb question.
    P x

  • Christmas Presents - HELP!!!!!

    Hello my fellow Verizon customers,
    I need your help!!! My dad is getting a droid for his account and wanted to use the buy one get one free deal that Verizon has going on for the droids and give the other phone to me. I am on a separate account. Verizon wont let him get the free phone though because he doesn't have another eligible line on his account. Is there any way of getting around this?? If he goes into the store is there any way to get them to work with him on this? This was supposed to be a Christmas present.

    So there is absolutely no way at all to get around this? What if he added a line for 9.99 with an old phone he has at home and then went in to buy the buy one get one free droid and added the free droid to the second line? would this work? Or are there any other ways to do this? He does not want to pay full price for the phone when they have a BOGO going on with Droids right now.

  • Actionscript help with interactive poster

    Hi All,
    I need some desperate help with a university assignment. I can't find any really good tutorials out there, so I was wondering if there were any kind people out there that I could get some on-on one help from?

    If you need one on one guidance for every aspect of the assignment then you probably need to look to your classmates or your instructor. 
    If you can show what you have done so far and what specific aspect you are having a problem with then someone might offer some help.

  • Actionscript Help for Simple Button Events

    Hey everyone,
    I'm pretty new to flash and I think this is a fairly simple animation, but I'm not quite sure how to write out the action script for it. I have a website that has very similiar animations to www.cookstreet.net. I have shapes and text that fly in from the bottom when a button is clicked, but I want to get them to fly back out of the top of the screen when any other button is clicked before any new content loads back in from the bottom. What should I add to the action script to tell flash to first check and see if there is content loaded on the screen when a button is clicked, and if there is, to go to the animation that flies that content out of the top and then return to the animation of the new content coming in from the bottom? What I currently have set up for my buttons is:
    function handleClick( pEvent:MouseEvent):void
        if( pEvent.target == reel )
            gotoAndPlay("Reel");
        else if( pEvent.target == home)
            gotoAndPlay("Home");
        else if( pEvent.target == news)
            gotoAndPlay("News");
        else if( pEvent.target == film)
            gotoAndPlay("Film")
        else if( pEvent.target == about)
            gotoAndPlay("About")
        else if( pEvent.target == contact)
            gotoAndPlay("Contact")
    reel. addEventListener(MouseEvent .CLICK, handleClick );
    home. addEventListener(MouseEvent .CLICK, handleClick );
    news. addEventListener(MouseEvent .CLICK, handleClick );
    film. addEventListener(MouseEvent .CLICK, handleClick );
    about. addEventListener(MouseEvent .CLICK, handleClick );
    contact. addEventListener(MouseEvent .CLICK, handleClick );
    Thanks for the help!
    -Sofi

    What you can probably do is have a variable that you use to keep track of who's present on the stage, starting it off as a null value.  That way when you click a button if the value is null is skips processing a moving out scenario and jumps to the moving in one.  So your event listeners would be calling a different handler function that first takes care of the moving out needs, if any, which in turn calls the moving in function after the moving out activity is done (or the timeline for moving out does... I don't know how you plan to implement the moving out stuff).  If it is a functiob to function process, the moving out function could pass the event.target to the moving in function so that wouldn't have to change at all, except to add in somewhere wha the new variable value should be.
    If what I just offered is one big ball of confusion... take your time and inch your way thru it.

  • Website Actionscript Help Needed

    So this is how it goes...I've already made my website, I have
    all the pages and everything made BUT...I have a few bugs. The
    first starts at my login page, it is a universal login, so it has 2
    usernames and passwords, I have the code for it but, It does not go
    when I press the submit button. The next is when I get to my actual
    website, all the webpages are all in different scenes. I type in
    the code: on (press) {gotoAndPlay ("1","Corp") ; } but it just goes
    the scene up next. I have no clue what is wrong here. I also have a
    flaw with my loading page, whether than just loads fast or not, the
    loading movie does not loop until the movie is loaded. This page is
    also part of the movie. Can anyone help? The web address is:
    http://www.freewebs.com/cliop/
    The code I am using on the button in my intro is:
    on (press) {
    if (username == "Cliop" or username == "X844495") {
    if (password == "*********" or password == "*********") {
    if (username== "Cliop" & password== "*********" or
    username== "X844495" & password== "*********") {
    gotoAndPlay("1", "Main");

    I've tried a new code for my submit button:
    on (press) {
    if (username === "Cliop" or username === "X844495"); {
    if (password === "moocowman" or password === "shadowman"); {
    if (username === "Cliop" & password === "moocowman" or
    username === "X844495" & password === "shadowman"); {
    gotoAndPlay("1", "Main");
    else on (press){
    if (username !== "Cliop" or username !== "X844495"); {
    if (password !== "moocowman" or password !== "shadowman"); {
    if (username !== "Cliop" & password !== "moocowman" or
    username !== "X844495" & password !== "shadowman"); {
    stop();
    I still have problems, I type in the right username &
    password, yet I don't enter the website. It keeps giving me this:
    **Error** Scene=Intro, layer=otherpages, frame=212:Line 11: 'else'
    encountered without matching 'if'
    else on (press){
    Can anyone help me? I'm also still having problems with the
    navigation.

Maybe you are looking for

  • Dynamically selecting values for filter in power pivot

    Hi, I am creating a power pivot report. I want the values of its filters to be set dynamically based on certain critreria. For Example, if some one changes the Iteration Path then the range of dates should change automatically to Iteration start date

  • ALV Output to Excel file

    Hi All, I am downloading the ALV output to Excel file.I am making use of  LIST--->EXPORT--->SPREADSHEET option. My list is having Header, Footer, sub totals and totals.When i transfer the list i am facing following problems 1.Even i am getting the em

  • Inconsistency PR in MD04

    Hello SAP gurus, one MRP generated PR is existing in MD04, when I checked the PR no line item is there. Because of that PR I am getting inaccurate MRP records for the material numbers. Can some one please let me know how to resolve this issue? I just

  • MRP indiactor mandatory in MIGO

    Hello Freinds, Can we make MRP indicator box mandatory in MIGO , for dealer PO Regards, Divakar

  • HFM Server / Cluster Registration

    Is there any way to run this utility silently? If we are to deploy the client to remote workstations silently i would think there was a away to configure the cluster per workstation as well. Any input is appreciated. Thanks.