Action script help needed for advent calendar
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Action script help needed for advent calendar

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    4

    Action script help needed for advent calendar

    Hello, very new here and this is my first post. So Im making an advent calendar and trying to use action script 2 to make the doors only open on their days and the previous doors automatically be open. I got it so that only the doors open on their days when clicked using(on the movie clip for door 14):
    onClipEvent (enterFrame) {
    this.displayDate = 14;
    }
    on (release) {
    if (_parent.checkDate(this.displayDate)){
    this.play();}

    }
    onClipEvent (enterFrame) {
    if(_parent.checkDate < (this.displayDate)){
    gotoAndStop(20);}

    }

    I've been using this code for the other doors eg here 13
    onClipEvent (enterFrame) {
    this.displayDate = 13;
    }
    on (release) {
    if (_parent.checkDate(this.displayDate)){
    this.play();}
    }

    onClipEvent (enterFrame) {
    if(this.displayDate<=14){
    gotoAndStop(20);}

    }

    The problem is I want this door to be click-able so the animation will play but it stays open at the end of the movie clip.

    Any help is appreciated.

    Jenna

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,155
    Hi,

    Perhaps attach your fla here

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    Hi fruitbeard this is my fla file thanks for replying calendar.fla.zip

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,155
    Hi,

    to get strated with, on each of your calender bits, use this instead of what you have now:

    PHP Code:
    onClipEvent (enterFrame) {
        if (
    this.displayDate _parent.currentDay)
        {
            
    gotoAndStop(20);
        }

    only replace the onClipEvent (enterFrame) parts
    nnow lets see what you need to do after that

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    Hi fruitbeard,
    That seems to have worked perfectly, I dont know how many different ways I tried with this code but obviously not that one, thanks so much for the help I would have been stuck on this forever otherwise .

  6. #6
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,155
    Hi,

    You may also want to put this on each clip too, replacing the on (release) values for each, so it is clickable or not

    PHP Code:
    on (release) {
        
    //Should the box be opened?
        
    if (this.displayDate == _parent.currentDay)
        {
            
    play();
        }
        else if (
    this.displayDate _parent.currentDay)
        {
            
    gotoAndStop(20);
        }
        else
        {
            
    gotoAndStop(1);
        }


  7. #7
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    I will add this now too, I've been using flash for awhile for animations but I'm quite hopeless when it comes to code, thanks for all the help .

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

Poll by Flashkit.com