flash event listener for movieclip end?

前端 未结 8 1200
执念已碎
执念已碎 2021-01-02 09:29

Could anyone advise the best way to trigger a functiont when a movieclip animation finishes? I figure an eventlistener could handle this, but not sure the best way to go abo

8条回答
  •  星月不相逢
    2021-01-02 10:09

    It's been awhile since I played with flash. I mostly do flex now, but this should work.
    Using the enterFrame Event would be a huge waste of resources, and creating a custom event class is not nessesary. On the last frame put this

    dispatchEvent(new Event("INSERTSTUPIDEVENTNAMEHERE"));
    

    And in your code on your "root"

    movieInstanceName.addEventListener( "INSERTSTUPIDEVENTNAMEHERE", someCallBackFunction );
    
    function someCallBackFunction ( e:Event ):void{
      trace( "Last frame hit");
    }
    

提交回复
热议问题