PDA

View Full Version : Day Activated Message Scroller


BarPhotoGuy
07-18-2004, 07:29 PM
I am trying to creade a Drink Specials scroller for my website ( www.barphotoguy.com ). The objective that I am trying to accomplish is that when the page loads it will grab the date from the computer and then display the correct drink special. The way that I set it is as follows: I have a scene named "actions" which is a blank scene containing the following code ->

scrollerDate = newDate( );

today = scrollerDate.getDay( );

switch( today ){
case 0:
gotoAndPlay( "sunday", 1 );
break;
case 1:
gotoAndPlay( "monday", 1 );
break;
case 2:
gotoAndPlay( "tuesday", 1 );
break;
case 3:
gotoAndPlay( "wednesday", 1 );
break;
case 4:
gotoAndPlay( "thursday", 1 );
break;
case 5:
gotoAndPlay( "friday", 1 );
break;
case 6:
gotoAndPlay( "saturday", 1 );
break;
default:
gotoAndPlay( "actions", 1 );
}

Then I have my scroller scenes named "sunday, monday, tuesday, etc." Within each scene there are 2 layers "background and message". "message" just contains the text tweens which makeup the scroller. "background" just contains the background information and within the last frame is the action->

gotoAndPlay( "actions", 1 );


When I load the files it will continuously play the "friday" scene. It never changes with the calendar.

Any ideas?

maglez
07-19-2004, 06:18 PM
It works fine for me if you change your first line to

scrollerDate = newDate( );

...see the space between new and date.

BarPhotoGuy
07-19-2004, 06:19 PM
I am at work so, I can't try this until tonight, but would it work better if I did each day's scroller as MC's instead of using different scenes?

maglez
07-19-2004, 06:22 PM
Sorry...

scrollerDate = new Date( );

About what is better MC's or scenes it depends of how big your application will be, how dynamic and flexible you want to do it, etc... In your case it seems a small one, so do it with scenes since it will be faster for you to do it.

BarPhotoGuy
07-19-2004, 06:59 PM
Thanks for the feedback. I can't believe that I didn't catch it before. I am just now getting into ActionScript, and it is not such a bad transition seeing how closely it resembles Java.