0
votes

I'm using the code below to have button "legalBtn" access the layer and instance name of "legalOverlay." Then after the legalese has been read, the enduser can close the "legalOverlay" via "closeBtn" and return to the last frame of the banner ad. The code below has no compiler errors, but the "legalBtn" is still not working. Any ideas?

import flash.events.MouseEvent;

function init(){
    legalBtn.addEventListener(MouseEvent.CLICK, legalClick);
    legalBtn.visible=true;

    legalOverlay.clickthru.addEventListener(MouseEvent.CLICK);
    legalOverlay.clickthru.buttonMode=true;
    legalOverlay.closeBtn.addEventListener(MouseEvent.CLICK);
    legalOverlay.closeBtn.buttonMode=true;

    legalOverlay.visible=false;
}
    function legalClick(e:MouseEvent){
        if(legalOverlay.visible==true){
        legalOverlay.visible=false;
        } else {
        legalOverlay.visible=true;
        }
}

stop();
1

1 Answers

0
votes

You have to call the init() function to add the click event listener on your legalBtn object and make it visible.