A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: actionscripting! (Ugh).

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Posts
    126

    actionscripting! (Ugh).

    Can anyone tell me why this isn't working? I'm learning actionscript and my first lesson isn't working. I made a movie clip with the instant name 'mcQuit'.

    mcQuit.onPress = function():Void {
    trace("Why isn't this working?")
    };

    In this case the lessons from Lynda.com are created from MX and I'm using 8, is there an actionscript conflict here?

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    the only reason for this (correct script) to not work is that you probably didn't give mcQuit an instance name, or that that instance is not present at the time and/or place of the call.

    gparis

  3. #3
    Senior Member
    Join Date
    Apr 2003
    Posts
    126
    I have one frame and I have the symbol named mcQuit. Heres the error:

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
    mcQuit.onPress = function():Void {

    Total ActionScript Errors: 1 Reported Errors: 1

  4. #4
    All 1s and 0s dmonkey's Avatar
    Join Date
    Nov 2005
    Location
    Leeds, UK
    Posts
    606
    Hi,

    The problem is that you've placed the actionscript on the movieclip itself. You want to attach the code to a frame on the timeline. You should place the code on the first frame that the clip appears at.

    Hope this helps.
    "If I have seen further, it is by standing on the shoulders of giants." - Sir Isaac Newton

  5. #5
    Senior Member
    Join Date
    Apr 2003
    Posts
    126

    Oh yea!

    Thanks so much! I knew it was gonna be something stupid on my part. I'm accustomed to adding the onPress/release event handler to the button that i'm controlling. I'm trying to learn actionscript, its cool but taxing on my brain!


    Thanks again.

    P

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