A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11337 Flash Movies | 1 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Bugra Ozden
» Title: Skatalog v9 - product catalog
» Description: Create your product catalog easly and publish on your website or Create your image gallery, documents list, portfolio. Fully XML Driven
» More by Bugra Ozden


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5828 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Creative DW Image Show PRO
» Description: Creative DW Image Show PRO is a Dreamweaver extension which enables the user to create multimedia presentations. It combines the features of the popular Creative DW Image Show with the ability to add professional text effects to slides (similar to After Effects). The product is very customizable: the user can choose the duration of the transition effects, the slide motion start and end position, zoom and panning type for both images and texts.


Random Links | Add your own Flash Related Links
Flash Tutorials 1280 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make a Flash Slide Show Screen Saver
» Simple flash making tutorial for thanksgiving
» Create flash banner for website
» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» Unknown Tag: Title10
Random Tutorial | Add Site

Trading Customer Accounting (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Actionscripting/Basic

Categories 12 HOUR Digital Clock
Author: Daniel Agostinelli

 
Page 3
«prev 1 2 3 4 next»

select the PM and AM using the shift key. press Ctrl+G to make them a group. double click on the new group, and you will be taken to a new editing screen for the AM and PM, which will now be separated. Select PM and press F8. name the symbol PM and set behavior to movie clip. do the same with the AM text, naming it AM. right click on AM, and select actions from the context menu. Copy in the following code:

onClipEvent (load) {
 time = new Date();
 ampm = time.getHours();
}
onClipEvent (enterFrame) {
 if (ampm>=12) {
 setProperty(this, _visible, false);
 }
}

CODE EXPLAINED:
The first part says when the clip is loaded, we will assign two variables to values. A variable is a name that stores certain data, whether it be a number, a word or a time, whatever. In this case, we set time to new Date(). All this does is creates a new date/time slot with the name time. ampm is also a variable, but this time, it assigns only the hour of the day/night. We will be getting the hours from the date called time, thus we use time.getHours(). Now we can say that ampm is the same as the current hour (eg. if the time is 6:30am, ampm is the same as 6, or if it was 1:20pm, ampm is the same as 13, since flash is based on 24hr time.

In the next part, when the frame is entered, we create a loop, or conditional statement. All this says is if ampm (the current hour of the day) is greater than or equal to 12, the AM movie clip is invisible, so all we see is PM. The first part is easy to understand, we use 12 because if on a 24hr clock, the hour is greater than or equal to 12, it is PM, therefore, we do not need the AM clip. The next part under the code is what happens if the if statement is true. setProperty is just telling flash that we want to change a certain property of a certain movieclip. the parameters within the brackets, (&) are as follows:

this is the target path of the clip we want to alter. since we are applying the script directly to the clip, we can just write this. the next part is telling flash the property we want to change. in this case, it is the visibility of our clip. we use _visible to tell flash the property we want to change. the final part is the value we want to change the property to. Visibility can have one of two values, true or false. these are known as boolean values. they can also be represented as a 0 or 1. We want to make the clip invisible, so we say its visibility is false.

«prev 1 2 3 4 next»

» Level Basic

Added: : 2004-05-10
Rating: 5.87 Votes: 25
Hits: 1115
» Author
I am very new to flash, and have just learnt about actionscripting. This is my first tutorial, so please bear with any mistakes.
» Download
Download the files used in this tutorial.
Download (8 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs