Flash Advisor logo
:: Desktop Shortcut
:: Flash Help
Advice from Experts

Closed Thread
Results 1 to 4 of 4
  1. #1

    Default Action Scripting

    I am looking for recommended tutorials or tips for Action Scripting. I am very good with the basic Frame animation and layer control. But I have very little action scripting experience.

    I would like to develop a simple clock using action scripting. Where input is taken to establish current time. Through action scripting this input is used to orient the Hour, Minute, and second hands. Then action scripting will take over to continue moving the clock hands as if a traditional (non-digital clock)

  2. # ADS
    Join Date
    Always
    Posts
    Many
     
  3. #2
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Hi,

    The analog clock is not that difficult of a project but a good understanding of Actionscript is required. If you do a google search for "flash analog clock" you will probably find a few demo's. If you want to contruct one from scratch, I can help with some pointers and AS tips....

    Basics:

    Understand how to manipulate movieclip timelines in onEnterFrame events.

    Movieclip properties... namely.... rotation

    Ability to use the Date object in Actionscript

    Flash has the ability to use two different types of codeing...... object and frame. Object code is placed directly onto the object the code is written for. Frame code applies code to an object by instance name and is placed, as the name says, on a frame(usually the first frame of a movie). To make this easy to understand, I'll use an object code example....

    Create a movieclip to serve as a holder. Inside this movieclip create three layers that will each hold a single movieclip. The three movieclips will be the hands of the clock...... hours,minutes,seconds. Give each movieclip an instance name.........hour,min,sec.......Go back to the main timeline, select the holder clip and paste this code in the actionscript panel with the holder clip highlighted.....
    Code:
    onClipEvent (load) {
    	timer = new Date();
    }
    onClipEvent (enterFrame) {
    	hours = timer.getHours();
    	minutes = timer.getMinutes();
    	seconds = timer.getSeconds();
    	if (hours>12) {
    		hours = hours-12;
    	}
    	if &#40;hours<1&#41; &#123;
    		hours = 12;
    	&#125;
    	hours = hours*30+int&#40;minutes/2&#41;;
    	minutes = minutes*6;
    	seconds = seconds*6;
    	_root.holderInstanceName.hour._rotation=hours;
    	_root.holderInstanceName.min._rotation=minutes;
    	_root.holderInstanceName.sec. _rotation=seconds;
    	delete timer;
    	timer = new Date&#40;&#41;;
    &#125;
    Regards
    NTD
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

  4. #3

    Default Action Scripting

    Thank you! I am sure this will be helpful. I would like to learn more about action scripting. Are there projects or tutorials you recommend?

  5. #4
    Join Date
    May 2004
    Location
    U.S.A.
    Posts
    2,890

    Default

    Many people overlook the built in tutorials that come with Flash. They are very good at teaching basic actionscripting. Beyond that, it is just a matter of getting your hands dirty and trying new things. The more you build with Flash, the more you learn. Tutorials are all over the internet concerning Flash development. Do a google search for any particular Flash project and your sure to find lots of info.
    A mind once stretched by a new idea never regains its original dimensions.
    - Oliver Wendell Holmes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. General Action Scripting Loops, comparisons, loadMovie
    By kguerrero in forum Advanced Flash
    Replies: 1
    Last Post: 02-19-2006, 01:34 PM
  2. action scripting help please
    By designerindex in forum Newbies
    Replies: 1
    Last Post: 06-21-2005, 07:55 PM
  3. Slide Show using flash action scripting..
    By REfL3ct in forum Flash Scripting
    Replies: 0
    Last Post: 09-16-2004, 11:54 PM
  4. Scripting Help using Variables
    By sgiff in forum Advanced Flash
    Replies: 3
    Last Post: 03-28-2004, 09:38 PM
  5. Need scripting help
    By lindag in forum Flash Scripting
    Replies: 8
    Last Post: 03-01-2004, 11:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Sponsors
Create Speaking Characters for your website and Flash movies. 15 Day Free Trial