Skip to main content
Participant
December 3, 2021
Question

need help (need identifier before dot error) on animate cc

  • December 3, 2021
  • 1 reply
  • 235 views

import.flash.events.MouseEvent;

 

function ClickStop(Event: MouseEvent) {
stop();
}


StopButton.addEventListener(Mouse.Event.MOUSE_UP, ClickStop);

function ClickPlay(Event: MouseEvent) {
play();
}

PlayButton.addEventListener(Mouse.Event.MOUSE_UP, ClickPlay);

thats the code the one that gets the error is this 
import.flash.events.MouseEvent;

    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    December 3, 2021

    Hi.

     

    There are a few errors on your code.

    // there's no dot between import and flash
    import flash.events.MouseEvent;
    
    function ClickStop(event:MouseEvent):void // event should be lowercase
    {
    	stop();
    }
    
    StopButton.addEventListener(MouseEvent.MOUSE_UP, ClickStop); // there's no dot between Mouse and Event
    
    function ClickPlay(event:MouseEvent):void // it's a good practice to indicate that the function doesn't return any value
    {
    	play();
    }
    
    // you should use camel case in AS3. It means, for example,
    // that the first word of instance names should be lowercase
    // and the other words should start with uppercase letters.
    // The same goes for functions and variables.
    PlayButton.addEventListener(MouseEvent.MOUSE_UP, ClickPlay);

     

    I hope this helps.

     

    Regards,

    JC

    Participant
    December 3, 2021

    tyyy for the answer
    I did it all but still the error pop up
    the same one

    Iam a Student last activity so I can go to college
    tyy for the answers again:))

    JoãoCésar17023019
    Community Expert
    Community Expert
    December 3, 2021

    You didn't fix all the errors.

     

    In you screenshot you're writing Mouse.event instead of MouseEvent, for example.

     

    Please double-check the syntax.