A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Error problem. Function does not have a body??

  1. #1
    Member
    Join Date
    Jun 2007
    Posts
    61

    Error problem. Function does not have a body??

    Hi There,

    I have a problem with a little project i'm working on and hope that someone out there can help me out.

    I have created a short animated movie clip symbol and called it post_it_mc. At the end of the timeline for this symbol is a simple stop action. In my main movie I have attempted to assign this movie clip to be a button that reacts to a mouse click. The instance name for this Movie clip is postit_mc. My action script is as follows;

    stop();

    postit01_mc.buttonMode = true;

    postit01_mc.addEventListener(MouseEvent.CLICK, onClick);

    function onClick(event:MouseEvent):void;
    {
    postit01_mc.play;
    }


    When I export the movie as a swf i get the error message;

    1126: Function does not have a body

    Any ideas what i'm doing wrong? I'm sure it can't be a big problem. I have not been scripting for a little while and am getting rusty it seems. Any help would be great. Cheers

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    remove the semicolon from this line:
    Code:
    function onClick(event:MouseEvent):void;

  3. #3
    Member
    Join Date
    Jun 2007
    Posts
    61
    Ah thanks very much for that.

    You've solved the problem of the error message. But annoyingly the swf now plays and stops, then won't replay when I click on the file. hmmmm, a little bit more chin scratching I think

    Thanks though my friend!

  4. #4
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    postit01_mc.play;


    that should be:

    postit01_mc.play();

  5. #5
    Member
    Join Date
    Jun 2007
    Posts
    61
    great thanks!

  6. #6
    Feeling adventurous? T1ger's Avatar
    Join Date
    Mar 2004
    Posts
    850
    if you are unsure of the syntax for a command, you can always press F1 and search for e.g. "function" or "play"
    I don't have a photograph, but you can have my footprints. They're upstairs in my socks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center