Copy link to clipboard
Copied
I'm trying to figure out a way to fix a bug in my application. The simple fix would be to have a single button that drives a MouseCLICK event on another button everytime the PlayBar in my application reaches the end of the screen and returns to its origin.
How would I achieve this? I have made a lot of headway since I last posted a question in the ActionScript 3 forum, which was only yesterday evening.
Thanks in advance,
markerline
If you simply need to execute the function that one of the buttons would otherwise execute when clicked, then just call that function when you need to. If you set the event argument to null in the function you can call it without havoing to have clicked anything...
function whateverBtnClicked(evt:MouseEvent=null):void {
etc...
}
So if you need to execute that function without having clicked the buttion you can just use...
whateverBtnClicked();
Copy link to clipboard
Copied
What do you mean by "drives a MouseCLICK event on another button" and what is that supposed to do that reconciles whatever bug you have?
Copy link to clipboard
Copied
The application is an audio application. It is like a drum machine sort of.
Currently there is a grid and whenever active cells get hitTest'ed by the PlayBar they become deactivated, the PlayBar returns to the origin, and when you relaunch the Play functionality the deactivated cells no longer play a sound.
I have a button which reactivates the sounds.
I also have a button which has a bug in it that loops the sounds.
To go around the looper button that has a bug in it I would like to use a Button "Z" which automatically clicks the "reactivate the sounds" button every time the PlayBar returns to the origin and the PlayBar will then continue to play and return to the origin in a looping fashion. If the Button Z is in an active state this looping will continue. To stop looping, click the Button Z until it is no longer in an active state and the PlayBar will then remain at the origin.
Copy link to clipboard
Copied
If you simply need to execute the function that one of the buttons would otherwise execute when clicked, then just call that function when you need to. If you set the event argument to null in the function you can call it without havoing to have clicked anything...
function whateverBtnClicked(evt:MouseEvent=null):void {
etc...
}
So if you need to execute that function without having clicked the buttion you can just use...
whateverBtnClicked();
Copy link to clipboard
Copied
Ned, I think that is the answer I was looking for. Because what was getting in the way was the MouseEvent that had to be passed into the function. Setting it to null may do the trick. If I set it to null though, will the original button still work with the MouseEvent handler passed in? Not sure if that's a valid question but I will try to execute this now and get back to you with results.
Thanks for your response.
Copy link to clipboard
Copied
The bug with the looper button is that activated sounds play redundantly on each hitTest using hitTestObject as the method. That is to say that sounds from a given cell are repeated at a rapid speed, giving the impression that there is an echo, which is not a desired effect that I am trying to achieve. I need clean breaks of sounds.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more