-
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
-
.
Hi,
Perhaps attach your fla here
-
Hi fruitbeard this is my fla file thanks for replying calendar.fla.zip
-
.
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
-
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 .
-
.
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);
}
}
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|