Making a simple ticking clock in AS3 with .as files

I'm making a simple clock in AS3 as seen on youtube (Doug Winnie) but I want to put the code into separate .as files. This is what I have so far but I keep getting the error 1046: Type was not found or was not a compile time constant: secondHand. But it's saying that the location of the error is Line 3 of Clock, but secondHand isn't even mentioned here?
package  {
import flash.display.MovieClip;
public class Clock extends MovieClip {
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.events.MouseEvent;
var clockTimer:Timer = new Timer(1000, 60);
    public function Clock(e:TimerEvent):void
        clockTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endTimer);
        function endTimer(e: TimerEvent): void
        trace("Finished");
// startButton and stopBtn are instances of GameButton.
package  {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class GameButton extends MovieClip {
    public var startButton : GameButton;
    public var stopBtn : GameButton;
    public function GameButton():void
    createListener();
    startButton.buttonLabel.text = "Start";
    stopBtn.buttonLabel.text = "Stop";
    public function createListener():void{
        startButton.addEventListener(MouseEvent.CLICK, startTimer);
        stopBtn.addEventListener(MouseEvent.CLICK, stopTimer);
    function startTimer(e:MouseEvent):void
            clockTimer.start();
            trace ("Timer started.");
            startButton.visible = false;
        function stopTimer(e:MouseEvent):void
            clockTimer.stop();
            trace("Timer stopped.");
            startButton.visible = true;
package  {
import flash.display.MovieClip;
import flash.events.TimerEvent;
public class secondHand extends MovieClip {
    public function secondHand(e: TimerEvent):void {
        // constructor code
        clockTimer.addEventListener(TimerEvent.TIMER, moveHand);
    public function moveHand(e:TimerEvent):String
        secondHand.rotation = secondHand.rotation + 6;
        trace("timer");

C:\Users\Claire\Desktop\CLOCK\secondHand.as, Line 8
1018: Duplicate class definition: secondHand.
C:\Users\Claire\Desktop\CLOCK\Clock.as, Line 1
5000: The class 'Clock' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
C:\Users\Claire\Desktop\CLOCK\GameButton.as, Line 1
5000: The class 'GameButton' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
C:\Users\Claire\Desktop\CLOCK\secondHand.as, Line 1
5000: The class 'secondHand' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

Similar Messages

  • Plz send simple bdc  code with flat file which is executable

    plz send a simple code for upload bdc with flat file which is executable.

    plz send a simple code for upload bdc with flat file which is executable.

  • NEED HELP!! White screen with ticking clock! cannot connect to OS 6.

    I noticed my curve 8900 was frozen on the white screen with the same ticking clock. It evolved from the frozen screen to sudden blackscreens and the flashing red light. I was looking for some answers on the forums. People seemed to point out to OS 6 and to try  backing up and reseting. Thing is I CAN connect to the blackberry desktop software but because my phone is off meaning the black screen keeps coming up with the red lights, so I CANNOT acces all the applications and files..... Can anyone shed some light? I know this may be a common issue but I could'nt find a solution. Thanks

    Hi alexonline,
    Welcome to BlackBerry Support Community Forums.
    Try following this KB article to reload your device software. You may need to allow up to 10 minutes for it to be detected by the Desktop Manager. http://bbry.lv/aPab3B
    -FS
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • Simple floating clock does not appear after shut down

    Hi,
    On my iMac oxs 10.9.4. my simple floating clock does not appear after shut down.
    Can anybody tell me how to overcome this?
    Cheers

    And now I am at the stage it wont automatically start despite it being ticked in the Log In Items.
    As Imp68 has asked, do you mean the "Hide" Checkbox is selected?
    If you have checked the box, that says, to start the application, however, hide it so it is not visible when you start.
    If you run Applications -> Utilities -> Activity Monitor, can you find Simple Floating Clock as a running app? (Activity Monitor has a Search box to make this easier).
    Is Simple Floating Clock on your Menu bar?
    Is Simple Floating Clock set to float?

  • Simple digital clock script

    Hi All,
    Since I am a new bee, I am seeking a simple digital clock MIDlet. Last two days I have been searching internet but I haven't found. If you do not consider me as RTFM or too lazy, could you please either post a script or simple give a shortcut?
    Many thanks in advance
    seyyah

    deepspace,
    this is my code but it is not updating. I know tha I am being too much. Help is really appriciated.
    * DrawImage.java
    * Draw mutable image on a canvas
    import java.util.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class emuezzin extends MIDlet
    private Display display; // The display
    private ImageCanvas canvas; // Canvas
    public emuezzin()
    display = Display.getDisplay(this);
    canvas = new ImageCanvas(this);
    protected void startApp()
    display.setCurrent( canvas );
    protected void pauseApp()
    protected void destroyApp( boolean unconditional )
    public void exitMIDlet()
    destroyApp(true);
    notifyDestroyed();
    * Class ImageCanvas
    * Draw mutable image
    class ImageCanvas extends Canvas implements CommandListener
    private Command cmExit; // Exit midlet
    private emuezzin midlet;
    private Image im = null;
    private String message = "developerWorks 1";
    public ImageCanvas(emuezzin midlet)
    this.midlet = midlet;
    // Create exit command and listen for events
    cmExit = new Command("Exit", Command.EXIT, 1);
    addCommand(cmExit);
    setCommandListener(this);
    * Draw mutable image
    protected void paint(Graphics g)
    // Clear the display
    Calendar now = Calendar.getInstance();
    int hours = now.get(Calendar.HOUR_OF_DAY);
    int minutes = now.get(Calendar.MINUTE);
    int seconds = now.get(Calendar.SECOND);
    String message = hours+":"+minutes+":"+ seconds;
    System.out.println("Current Time = "+message);
    // Create mutable image
    im = Image.createImage(100, 20);
    // Get graphics object to draw onto the image
    Graphics graphics = im.getGraphics();
    // Specify a font face, style and size
    Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
         graphics.setFont(font);
    // Draw a filled (blue) rectangle, with rounded corners
    graphics.setColor(0, 0, 255);
         graphics.fillRoundRect(0,0, im.getWidth()-1, im.getHeight()-1, 20, 20);
         // Center text horizontally in the image. Draw text in white
    graphics.setColor(255, 255, 255);
    graphics.drawString(message,
              (im.getWidth() / 2) - (font.stringWidth(message) / 2),
              (im.getHeight() / 2) - (font.getHeight() / 2),
              Graphics.TOP | Graphics.LEFT);
    g.setColor(255, 255, 255);
    g.fillRect(0, 0, getWidth(), getHeight());
    // Center the image on the display
    if (im != null)
    g.drawImage(im, getWidth() / 2, getHeight() / 2,
    Graphics.VCENTER | Graphics.HCENTER);
    public void run(){
    while(true){
    repaint();
    try{
    System.out.println("Current Time =");
    Thread.sleep(1000);
    } catch (Exception e){}
    public void commandAction(Command c, Displayable d)
    if (c == cmExit)
    midlet.exitMIDlet();
    }

  • Problems in CS3 and AS3 with embedded fonts

    Hi. I recently downloaded the trial version of CS3 to test it
    out. I'm an experience AS2 developper, and have 10 years of C, C++,
    C#, Java, PHP ... programming experience on BIG projects before
    starting flash.
    I have been trying to use an embedded font in AS3 with a
    dynamically created textfield. I've tried all the examples in
    O'Reilly's ActionScript 3.0 Cookbook. They suggest using the
    [Embed] meta tag, but quite honestly it does nothing in CS3. I had
    the Size Report option selected, and it shows clearly by the file
    size the font isn't present in the SWF.
    Then I tried doing it the way I did in Flash 8. Again there
    no luck. My TextField exists, but there is simple no font being
    rendered.. Here is my bit of code.
    In my library I have a symbol called arialBold. In the
    linkage settings, I have "Export for ActionScript" checked, and
    "Export in first frame" checked. The class is "arialBold" but I
    wonder if that's right? and the Base class is "flash.text.Font"
    I tried every variation I could think of. I must be doing
    something wrong. You can find my file here :
    http://www.newcommerce.ca/as3/fonttest.fla
    Thanks for your help! If you can fix this, i'll be very
    happy!

    this code works
    var tf:TextField = new TextField();
    var tfor:TextFormat = new TextFormat();
    tfor.font = new _TrebushetMS().fontName;
    tfor.italic = true;
    tf.width = 300;
    tf.height = 200;
    tf.embedFonts = true;
    tf.border = true;
    tf.defaultTextFormat = tfor ;
    tf.text = "this is a test";
    this.addChild(tf);
    This code does not work
    var tf:TextField = new TextField();
    var tfor:TextFormat = new TextFormat();
    tfor.font = new _TrebushetMS().fontName;
    tfor.italic = true;
    tf.width = 300;
    tf.height = 200;
    tf.embedFonts = true;
    tf.border = true;
    tf.setTextFormat(tfor) ;
    tf.text = "this is a test";
    this.addChild(tf);
    i don't know why

  • Why can't I move or delete a simple destop clock after instaLLING Lion?

    why can't I move or delete a simple destop clock after instaLLING Lion?

    Are your refering to the printer driver software? You'll need to go to HP's site and see if they have updated drives for Lion for your printer model. There site might also have oter useful information regardsing using this printer with Lion.
    In fact a quick Google search turned up this HP site OS X 10.7 Lion: Installing and Using the Printer with Lion which might answer your questions
    good luck

  • *Help* making a simple RPG for my AP CS class

    I am in desperate need of help, I am creating an RPG(of sorts, it is a purely a battle RPG in which characters level up and modify stats) there will be no storlyine (Yet) or adventure elements. I've reached a severe mental roadblock in the actual programming of the game but I have a very clear picture of exactly how the game runs. Here's how the game works, after starting a new game from the opening screen, the player begins with a simple battle against one monster. The player has four characters and each character starts with one basic attack. Battle continues in typical RPG style in which the player selects attacks, and then battle ensues in order based on the speed of each participant. At the end of each battle, all the characters level up once and the player can distribute a certain amount of stat points to each of the characters individual stats. The game continues like this for 40 levels with increasing difficulty, new attacks, and an upgrade to a new class at level 20. level 41 is a final boss fight against a typical RPG boss monster. Here is what i particularly have trouble on
    1. Determining how to create the attacks that the player can choose and figuring out how i can call upon them and have them do their damage based on certain specs
    2. Determining how to create an interactive interface that allows the player to choose the attack for each character, upgrade individual stats after each battle, and save (this will be a point and click menu system)
    3. Figuring how to create and input my own homemade graphics into the game (the book i have doesn't seem to cover putting in graphics that you create on your own, just the graphics that are part of the java package)
    Any help on this would be greatly appreciated becuase it is a major grade in my class

    Hello,
    I have been programming (in various languages) for years now. I also am in AP CS and I have been trying to think up a good game to make, i'm about 2 months ahead of my coursework in class and spend my time making and re-making various games during class.
    If i were to program this game i would go about the Attack issue by having a class called Attack (as was mentioned early). In it have the methods and variables and such for the attack, i would have a database or something along those lines of all the attacks (but for now start small with a basic one) and then each player could have one (or multiple - depending on whether or not they have an assortment of attacks) class attached to it (or if multiple perhaps an array or vector of classes). The attack class would contain basic information like the Name of the Attack, the Damage, Type, etc. And the class could even include methods which get the 'Level' of the player and calculate the damage multiplier or something along those lines.
    As far as choosing what to have the characters/players do i would (for yours and simplicity's sake) make a side menu which allows you to choose whatever attack, etc. you want. It's simple and easier to work with, just have a JPanel within the JFrame which controls the players, and it will control each player when it's their turn. This shouldn't be too difficult to do.
    The graphics part (you have already recieved some suggestions about), i prefer to use ImageIcons in my games. They're simple and easy to work with and are painted just as a circle or rectangle is. You just draw the images outside of the program and use them in the program through ImageIcons. If you have a good image-edittor (Photoshop, Flash even), you can make Animated Gifs which will add to the look and quality of the graphics of your program.
    The trick with big projects like this (and the goal of Object Oriented Programming) is to take a big problem (Like and Entire RPG Game -- The Program) and break it up into smaller problems and tackle each one, one at a time (divide the Program into an assortment of Classes).
    I wish you the best of luck, i myself am starting a small game (Something similar to Zelda i'm thinking), i'm still designing it on paper and I personally think if you design and organize everything on paper and make a checklist of sorts, things go much smoother and more organized (not to mention faster).

  • Clock Domain Crossing with FIFO

    Hi,
    I have a project for Spartan 6 xlx16. In this project I have:
    - clk_in: 20 MHz from an external Quart
    This clk_in (20 MHz) has the followin path:
    - 20 MHz -> Clock Wizard -> 20 MHZ -> Clock Wizard -> Out1: 22 MHz, Out2: 44 MHz.
    The 22 MHz is used to acquire data, and 44 MHz is used to transmit the data. So I used a FIFO: 
    en_fifo_nempty <= not en_fifo_empty;
    my_fifo : fifo_generator_v9_3
    Port map (
    rst => reset_ien,
    wr_clk => clk22,
    wr_en => '1',
    din => data_in,
    rd_clk => clk44,
    rd_en => en_fifo_nempty,
    dout => data_out,
    full => open,
    empty => en_fifo_empty);
    I have a analog channel where I can compare in parallel the original data with Acquired + Transmitted Data. I synthesize one and I notice that Data bit 7 is not stable. Make some changes Data bit 4 in not stable. Some more changes data bit 5.. and son on. 
    What am I missing here? What am I'm doing wrong? In *ucf file I have no special constrains (only clock constrains).
    There are no timing/setup errors. 
    PS: I'm not allowed to change the Acquisition and Transmission Modules so I have to stick to 22 MHz and 44 MHz.
    Thaks,
    Paul
     

    The input data is aquired synchronous from an ADC and processed with the 22 MHz (digital filtering, adder ...). ADC clock is generated dividing the 22 MHz clock with /2 ( simple clock divider). 
    With 20 MHz and 40 MHz everything is ok.
    I have to increase the dynamic of the system with 10% and not allowed to change some VHDL modules so I tried this overclocking (ADC can work at way higher frequencies). With 22 MHz and 44 MHz and absolutely no error from ISE Tool it doesn't work correctly any more.

  • Magic Mouse  question. I have set this in Preferences by ticking Swipe between pages with  one finger and also Swipe between full-screen apps with two fingers,  however when I try to do the latter, the 2 finger swipe will take me only to the dashboard and

    It's a Magic Mouse question. I have set this up in Preferences by ticking Swipe between pages with one finger and also Swipe between full-screen apps with two fingers,  however when I try to do the latter, the 2 finger swipe will take me from the app that I am on to the dashboard only and not to my other open apps.
    I also find that Smart zoom only works with some apps, for instance not with Word docs or email.
    How can I correct this please?

    Just figured out it also does not work with the Mail app.

  • Music files / itunes conversion - making it simple!

    Hello
    I am looking for some general and probably simple help with the file formats of my music.
    I have a vast amount of music which is stored on my computer hard drive, some of which is stored in m4p format and some in wma and some in mp3? Some of my music files are stored twice and some are in different formats. When i convert my music to itunes i find that most of the music converts 3, 4 and sometimes 5 times? I dont understand this!
    I really want to have a simple system for storing and converting music. If my music is to be stored on my hard drive i just want each music file stored once and in the same file format so when i search my music it is easy to find the artist i want. With itunes i just want the music to convert once. This all may seem very simple to someone but to me i feel like i have a complicated system and i just want to tidy it up and make it easy to manage. Can anybody help! Thank you.

    I really do not understand what all the different formats are so even trying to talk about this is difficult but i will try. I have all my music stored on my hard drive but it seems to be in different places. When i click on my music i have a number of artists listed with their music. I then have a folder in this section called itunes which has also got a big list of artists in it which seems strange. So i have one big music folder with all the music in plus an itunes folder with a lot of the music in also. Do i need to just copy all of the music to the itunes folder on my hard drive?
    When i use itunes to organise my music i click on file and then add folder to library and then send all the music in the folder 'my music' to itunes. Obvisouly i have just done this once at the start. When i add the folder a pop up comes with - some files are not in the itunes format, do you want itunes to convert them for you. When itunes has finished adding and converting i have 4 or 5 copies of each track in the itunes library??? I then have to use the delete duplicate option to get rid of tracks. When i then take my music to other computers and want to copy it into itunes it does the same so it seems to be a problem with the files on the hard drive.
    Ideally, i would like one copy of each music file in my hard drive plus when i copy to itunes it just copies once. Also when i take this music to a seperate computer i want it to copy into the itunes library once.
    If you require further info then no problem
    I appreciate your time and help
    Thank you.

  • Is there a (relatively simple) way to skip tracks with an iPod touch 5th gen using a physical button? I'm aware songs can be skipped on-screen without unlocking the iPod, but I'm looking for a method that doesn't require taking my eyes off the road.

    Is there a (relatively simple) way to skip tracks with an iPod touch 5th gen using a physical button? I'm aware songs can be skipped on-screen without unlocking the iPod, but I'm looking for a method that doesn't require taking my eyes off the road while driving. For that reason, I'm also not interested in adding in headphones or additional devices that have the desired button functions. Going both forward and back would be great but I would be pleased just to have a "sight-free" way to go forward.
    I've seen some mention here and there about ways to maybe change it so the volume buttons change tracks and holding the volume buttons changes the volume... but I don't know what's involved in that or if its even possible/recommended for a new 5th gen iPod. I think its a great device but its sadly lacking in music oriented functions and features... which is disappointing since music is why most people would bother getting one instead of some other "iDevice" :/

    Given that you cannot do what you have asked for, perhaps you simply need to find another solution to your root problem.
    Presumably, you want to skip to the next track because you don't want to hear the current one, and that is because...
    You don't like it.
    You've heard it recently and don't want to hear it now.
    Simply don't want to hear it at this time.
    For problem number 1. Don't put it on the iPod in the first place. (I know, obvious answer!)
    For problem number 2. How about playing from a Smart Playlist (initially created in your iTunes Library) which has only songs you've not played recently?
    For problem number 3. Hhhmmm! Create alternative Playlists for use in the car.
    As for going back to the start of the "now playing" track.... Well, if your Playlist has only songs that you really, really want to hear, then you'll be looking forward to that rather go back to the beginning of the current song.
    I'm not trying to be prescriptive, just giving you food for thought.
    (They are all cheaper options than buying a car which can control the iPod from the steering wheel.)

  • Ticking sound in sync with cooling fan

    I just started hearing a ticking sound in sync with the frequency of the cooling fan speed. I'm guessing it's a bearing going bad in the cooling fan but that sounds like the diagnosis on a car engine. Anybody have any experience with this?

    You could, but it would probibly get better results if you measured the output of an audio amplifer that is being driven by the microhone. The problem is that microphones tend to be pretty low-level devices so reading them directly could cause noise problems.
    In terms of an amp, unless you are particularly concerned about amplitudes, any cheap thing you could pick up at radio shack would work.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Best way to interface flash AS3 with CF

    Does anyone know of any good examples of how to interface
    Flash AS3 with Coldfusion?
    Thanks!!!
    Carlos

    Unfortunately the camera does something with flash media, which could confuse the question. Do you mean that you want to use this camera for creating Adobe Flash Video content? If that's the case I would argue to use its 720p/24p mode, that would give you 24 fps 1280x720 movies that ought to work nicely in Flash, and could scale to smaller 16:9 sizes better than say a 1080i video would. You could use 720p/30p too if you want it a little smoother.
    If you have Studio 8 installed on the machine you're using, you can export straight from FCP to FLV, by choosing the Export to FLV option in the Export using QuickTime Conversion dialog.

  • Iphone 4 the mike does not work when making a call.  it does work with speaker phone and face time

    Just activated new Iphone 4 and the mike does not work when making a call.  it does work with speaker phone and face time. Any known fixes?

    My wife's iphone 4 also has your same no ring problem as does my iphone 5 just less often.  I called her iphone 4 at home from where I work 20 miles away on my iphone 5.  With her phone in 3G mode ONE call went through and 9 went to voice mail in 10 tries.  This is a 10% sucess rate!!  I also could listen in real time from the wired work phone and the wired home phone.  She turned off 3G mode and it went to "O" mode at  the top left of the screen after the ATT.  In this mode it rang on the first ring tone 5 times out of 5 tries which is 100% of the time.  I have learned that the calling party will hear up to 4 ring tones when placing a call on the ATT network.  If the ring tone changes volume slightly before the 4th ring then and only then will the cell phone start to ring.  If the ring tone does not change after the 4th ring you get voice mail.  If the calling party does not leave a voice message there is never a missed call displayed on the iphone.  If the calling party does leave a voice message a few minutes later the iphone dings for arriving voice mail but still no missed call indication. 
    This appears to be related to the time of day and the ATT tower that the receiving caller is using.  Tried other towers and it works in 3G mode 10 times out of 10 tries.  Apple replaced the first iphone 4 with a new phone, no improvement.  ATT replaced the SIM card and no improvement.  ATT so far is clue less.  This has been going on every since we got the new iphones which is 4 months.  The ATT web site also describes this same problem from several years ago.  Has anyone got better information?
    Thanks

Maybe you are looking for

  • IMac 2013 and Windows 8.1 Connectivity

    Up until I installed Yosemite, I could connect my new Windows 8.1 computer to my iMac external hard drives. ( I have 5 of them hooked up to the iMac) and could access all of my files.) without a problem. Now I can't access not 1 one of them. I can ge

  • BPM Fault Message Exception error !

    Hi here is what I am doing Sync webservice-->Sync webservice call using ccBPM. This is what I defined in the BPM 1.)Sync rec 2.)Block with Exception handler. 3.) Sync send inside the Block with Fault exception defined. I defined fault messages for th

  • Help text unreadable (fonts too small)

    SQL Developer v.1.0 patched RHEL4 AS Nahant Update 3 Linux Sun jdk1.5.0_06 Help text font in SQL Developer is too small and almost unreadable, specially monotype font used to describe SQL queries. Help text in JDeveloper is much better. How to increa

  • Accounts Payables

    Hi All, I am in the project of upgrading from 11.5.10.2 to R12, in the 11i system the client is having a customised payment format (i.e) payment to the vendors. For which in 11i they are using a table called ap_selected_invoice_checks_all. But in R12

  • How to get the internal user id from oCompany object

    Hi, Right now, i need to get current user object from oCompany object. But the problem is I can only know the username from oCompany object. But it seems Users object only supports GetByKey(int internal_key). I can use SQL query to get that internal