I have an instance of a button called myBtn
on stage, and an instance of a square movie clip called myContainer
- all of which published from flash.
Within myContainer
i have a movieclip instance named mySquare
which is animated via classic tween from one point of the stage to another.
When the stage is loaded i use this.myBtn.on("click", startBtnOnClick)
to add an event listener to the button, and the function startBtnOnClick(evt)
is indeed successfully called.
What i'm trying to achieve is to tell myContainer
to start playing when the button is clicked, and to do so i currently need to use:evt.target.parent.parent.myContainer.gotoAndPlay(0)
which works, but doesn't seem to be a best practice here.
What would be a more suitable approach?
Perhaps i should dispatch a new event when the button is clicked and listen for it in the container?