Skip to main content
February 10, 2010
Answered

Standard button does not understand CLICK event.

  • February 10, 2010
  • 2 replies
  • 421 views

I have created a Flash presentation that includes the standard playback flat > flat grey forward and playback flat > flat grey back buttons from the Windows > Common Libraries > Buttons list.  These give me errors when I try to set an event handler to intercept a CLICK event from them.  What type ov event should I be trying to set up to handle if CLICK isn't an option?

This topic has been closed for replies.
Correct answer Zephyr-

The type of event is a CLICK event, but you need to use the MouseEvent.CLICK constant instead, clicking is a mouse event, so it's part of the MouseEvent class.

Sub in MouseEvent.CLICK into the listener statement, and (event:MouseEvent) in the listener functions.

2 replies

Zephyr-Correct answer
Inspiring
February 10, 2010

The type of event is a CLICK event, but you need to use the MouseEvent.CLICK constant instead, clicking is a mouse event, so it's part of the MouseEvent class.

Sub in MouseEvent.CLICK into the listener statement, and (event:MouseEvent) in the listener functions.

February 10, 2010

That did it!  Thanks!

Participant
February 10, 2010

Could I see a sample of the code or sample? That way everyone here could give you more help...

February 10, 2010

Here are the handler functions:

// Handlers for navigation buttons
btnBack.addEventListener(Event.CLICK, pageBack);
btnForward.addEventListener(Event.CLICK, pageForward);

function pageBack(event:Event):void {
    var currentPage:int = visiblePage;

    // Get the ID of the current page
    var previousPage:int = currentPage;
    if (currentPage == 1 ) {
        visiblePage = MAX_PAGES;
    } else {
        visiblePage -= visiblePage;
        currentPage = visiblePage;
        showPage(currentPage);
    }
}

function pageForward(event:Event):void {
    var currentPage:int = visiblePage;

    // Get the ID of the current page
    var previousPage:int = currentPage;
    if (currentPage == MAX_PAGES ) {
        visiblePage = 1;
    } else {
        visiblePage += visiblePage;
        currentPage = visiblePage;
        showPage(currentPage);
    }
}

...and here is the error message for both...

1119: Access of possibly undefined property CLICK through a reference with static type Class.