Navigaton menu. Pressing buttons in the AS3 application without keyboard and mouse

I am writing an application for Arduino on AS3. Keyboard and mouse are not provided. There are a lot of buttons in the application. All of them can work with keyboard and mouse. Management is planned to be carried out by changing the number taken from the array. The application accepts data only from Arduino.

if Data[5] = 200, then the keyboard button with the left arrow should be pressed. This will be "KEY_DOWN". If Data[5] = 0, then it will be "KEY_UP". for example:

dynamic public class Main extends MovieClip
{
    public function Main()
    {
        addFrameScript(0, this.frame1);
        return;
    }// end function

    public function myFunctions() : void
    {
        //myCode
        if (this.Data[5] = 100) {selected target my buttons (TAB)}
        if (this.Data[5] = 200) {move target left (Arrow left)}
        if (this.Data[5] = 300) {move target righ(Arrow right)}
        if (this.Data[5] = 400) {move target up(Arrow up)}
        if (this.Data[5] = 500) {move target dwn(Arrow dwn)}
        if (this.Data[5] = 600) {mouse click on the selected button }
        return;
    }

    public function onBtn1(event:MouseEvent) : void     
    {
        trace("pessed btn1")
        return;
    }// end function    
    
    public function onBtn2(event:MouseEvent) : void     
    {
        trace("pessed btn2")
        return;
    }// end function    
    
    public function onBtn15(event:MouseEvent) : void        
    {
        trace("pessed btn15")
        return;
    }// end function    

    
    function frame1()
    {
        this.Btn1.addEventListener(MouseEvent.CLICK, this.onBtn1);
        this.Btn2.addEventListener(MouseEvent.CLICK, this.onBtn2);
        this.Btn15.addEventListener(MouseEvent.CLICK, this.onBtn15);
        return;
    }// end function

}

How to make an imitation of pressing a button from the value of a variable, please help.



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)