How can I control mouse click event (properly) in a multidimensional array?

Hi all!

I have a question about the use of the events of mouse clicks in a multidimensional array (or a '2D' table that we refer to them in Java and C++).

Background

I have an array of objects of each with a corresponding mouse click event. Each object is stored in a place between [0] [0] and [5] [8] (so a 9 x 6 grid) and has the specific column and thus associated line number (i.e. tile [2] [4] has a 2 line number and a column 4 number, even if it's on the third row, fifth column). With each click of mouse, the tile that is selected is stored in a temporary table. Table is disabled if a tile is clicked that is not a value line or column equal to, less than or more 1 with the currently targeted tile (i.e. clicking tile [1] [1] clears the table is there are no stored tiles bearing the number of row/column)

[0] [0] [0] [1] [0] [2],

[1] [0], [1] [1], [1] [2],

[2] [0] [2] [1], [2] [2]

(or any column/line contiguous with another tile stored in the array, which means that the newly selected tile must only be sharing a border with one of the tiles of the temp table but not necessarily with the last tile stored).

Question

What is somehow clean and tidy this programming in AS3? Here are some parts of my code (although the mouse click event is not finished/working correctly):

service public tileClick(e:MouseEvent):void
{
var tile: Object = e.currentTarget;

tileSelect.push (uint (tile.currentFrameLabel));
selectArr.push (tile);

If (tile.select.visible is false)
{
Tile.Select.Visible = true;
}
on the other
{
Tile.Select.Visible = false;
}
for (var i: uint = 0; i < selectArr.length; i ++)
{
If ((tile.rowN == selectArr [i].rowN-1) |)
(tile.rowN == selectArr [i] .rowN).
(tile.rowN is .rowN selectArr [i] + 1))
{
If ((tile.colN == selectArr [i].colN-1) |)
(tile.colN == selectArr [i] .colN).
(tile.colN is .colN selectArr [i] + 1))
{
trace ("jackpot!" + i);
}
}
on the other
{
for (var ii:uint = 0; ii < 1; ii ++)
{
for (var iii:uint = 0; iii < selectArr.length; iii ++)
{
selectArr [iii].select.visible = false;
}
selectArr = [];
trace ("Err!");
}
}
}
}

so, no matter what tiles are clicked, you only added to selectArr?  That is to say, if someone clicks on tiles randomly contiguous or not, what they added to selectArr?  If so, let the way you have it but change contigF().

If you want to add a tile of selectArr if selectArr is empty, and when the user click on a tile adjacent selectArr, move the push() method to run If contigF() returns true and change contigF() to:

function contigF(tile:DisplayObject):Boolean {}

{if(selectArr.Length==0)}

Returns true;

}

for (var i: int = 0; i<>

if(Tile!=selectArr[i]&&math.) ABS (selectArr [i] .rowN - Tile.rowN)<2&&Math.abs(selectArr[i].colN><>

Returns true;

}

}

Returns false;

}

Tags: Adobe Animate

Similar Questions

  • How to force a mouse click event?

    How can I force a click event of mouse anywhere on the page?

    The application is not updated to point up what a user clicks somewhere in the Flex/Flash application. But you can apparently write a javascript function to set the focus on the player on the timing of the charges (and then use callLater()).

    Check out this thread where I got some tips: http://www.nabble.com/-flex_india:17015 - text-entry-cursor - td20828507.html

    Let me know if that helps...

    Ben Edwards

  • How can I remove mouse clicks

    Hi all.

    How can I delete my demo mouse clicks before you publish?

    Hope you can help. Thank you.

    Tim.

    Hi Tim.

    Mouse click sounds can be removed by following the steps:

    1. open the mouse properties dialog box by double-clicking the mouse , present object on your slide.

    2 uncheck the nattering of the mouse checkbox.

    3. check the apply to all checkbox.

    4. Select ' apply to all' and ' apply only changed properties' options in the parameters of drop-.

    5. click on OK.

    6. now publish the project.

    Mouse clicks will not appear in the published movie.

    Thank you.

    Michel.

  • Windows 7 system can detect the mouse click event

    Hi, I have a user with a fresh install/update of Windows 7 64-bit. For some strange reason, it continually records clics.2 seconds in duration. We tried to restart, replacing the mouse and even unplug the mouse entirely without any change in behavior. Anyone know what may be causing this? This machine was installed Friday (today is Monday) and worked perfectly all day Friday.

    Hello WindowzNoob,

    Thanks for posting your query on Microsoft Community forum.

    As you mentioned that this computer is a new installation of Windows 7, so there might be a chance that the drivers are not updated. Then I suggest you to update all the drivers of devices from the link provided below and see if it works for you.

    Before you update the drivers, you try to run the troubleshooter under construction for hardware devices.

    Open the hardware and devices Troubleshooter

    http://Windows.Microsoft.com/en-us/Windows7/open-the-hardware-and-devices-Troubleshooter

    Now if you're talking about drivers then you can follow the steps described in the following Microsoft article and see if it helps to update the drivers.

     

    Update drivers: recommended links

    http://Windows.Microsoft.com/en-us/Windows/update-drivers-recommended-links#update-drivers-recommended-links=Windows-7

     

    Automatically get recommended drivers and updates for your hardware

    http://Windows.Microsoft.com/en-in/Windows7/automatically-get-recommended-drivers-and-updates-for-your-hardware

     

    If the problem persists, try to update the drivers from the manufacturer's website and if you can't find it, please provide us with brand and model of your computer and we will help you find the latest driver available.

    Hope it would help. If problem persists always post back with the current state of your computer and the result of the proposed suggestion, we will be happy to help you.

    Thank you.

  • How can I disable the clicks of mouse for 8 Captivate?

    How can I disable the clicks of mouse for 8 Captivate?  It seems that the most recent set of instructions are from 2013 and the dialog box has changed.  I'll also say that I'm all new to Captivate

    Not quite true: you can select a mouse object in the project, disable the mouse click. Then use the menu at the top right in the properties panel (Hot Dog or hamburger icon) and choose "Apply to all elements of this type" and click of the mouse is disabled throughout the project.

  • How can I restore "double click-to-open" on my touch pad.

    Original title: the touch pad settings

    How can I restore "double click-to-open" on my touch pad. using window 7

    It depends on who built your touchpad.  Each company has different settings and put them in different places. You can check this common location, but it is not a guarantee.

    1. Open start and select Control Panel
    2. Click on hardware and sound
    3. Click the mouse
    4. Search for touchpad options.  If you don't see everything, go to the Hardware tab, highlight your touchpad in the list, and then click settings.
    5. If there are still no touchpad options, you will need to consult your manual to the owner for where your portable computer specific company set their parameters.
  • How can I control what FEED my CC from Adobe to?

    How can I control what FEED my CC from Adobe to?

    I did it!

    The cloud control creative program location

    CC App - file locations

    > Open creative cloud App (Image below)

    > Right click on it (gear, drop-down) (Image below)

    > Select and click on 'Preferences' (Image below)

    Applications TAB >-install Locatotion (F:\Programs)

    The files tab >-location of the folder (F:\)

    There you GO! (Image below)

    Useful links of video

    https://helpx.Adobe.com/creative-cloud/help/install-apps.html#download and install applications

    Download, installation, setting up

    How to properly set up the SSD as boot drive and the HARD disk as disk storage - YouTube

  • How can I control a button from a swf file to another swf file?

    Hello

    I have a file main.swf . From this file I can access the file external.swf which is an external file.

    Now, how can I write code on my file main.swf to the button that is on my external.swf file?

    Activities.MainPanel.close_btn.addEventListener (MouseEvent.CLICK, btnClickClose);

    Activities.MainPanel.close_btn (This button is actually the external.swf file, but I want to write code on main.swf file to run it on external.swf) How can I control a single swf in another swf file button?

    Thank you.

    Some examples of code that you should be able to adapt to your needs.

    create a new instance of the loader object.

    var loader: Loader = new Loader();

    make the download request...

    var request: URLRequest = new URLRequest ("external.swf");

    Add a full event for the loader listener

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, completeHandler);

    start the actual loading process...

    Loader.Load (request);

    Create a new empty movieClip instance, you place the movie loaded into this movieClip after loading

    var externalMovie:MovieClip;

    This function is called when the download is complete and the file is ready for use.

    function completeHandler(event:Event):void {}

    set the contents of the film to the new empty movieClip...

    externalMovie = MovieClip (event.target.content);

    Add this new film to the display list.

    addChild (externalMovie);

    }

    Now you can reference the film loaded with the name of the instance 'externalMovie '. So if, for example, you want to address a button in the film loaded, you can write something like that on the main timeline:

    externalMovie.addEventListener (MouseEvent.CLICK, btnClickClose);

    function btnClickClose(event:MouseEvent):void {}

    }

  • How can I enter a recurring event?

    For the purposes of schedule on OS X, how can I enter a recurring event?

    What works for me, under the Mavericks, is to click with the right button on the day I want.  The pop-up, I put in the name of the event (and sometimes the location).  In the block that speaks of time and alarm, click 'Repeat' and then chose how I want it repeated.

    Good luck

    SRB

  • How can I disable the click Hover funtion

    How can I disable the click Hover funtion? It is so annoying

    moving the cursor on the screen sometimes opens a multitude of programs

    or if I move the mouse to a position he clicked, without pressing a key

    also, it highlights or selects the text without me wanting that he selected (entire pages?)

    Hello

    ·        Did you change to the computer?

    ·        Which the operation is installed on your computer?

    ·        What is the number and model of the mouse?

    ·        Is it a mouse USB or PS2 Mouse?

    Method 1: Put the computer to boot and check if any third-party application is causing the problem:

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: after a repair, be sure to configure the computer to start as usual as mentioned in step 7 in the above article.

    Method 2: I suggest you to update the mouse driver and check if it helps:

    http://Windows.Microsoft.com/en-us/Windows7/update-a-driver-for-hardware-that-isn ' t-work correctly

    Method 3: Troubleshoot issues with the mouse button or scroll the parameters

    http://support.Microsoft.com/kb/303091

    Note: skip the section applies to .

    Method 4: Change your mouse settings

    For Windows XP: http://Windows.Microsoft.com/en-us/Windows-XP/help/change-mouse-settings

    For Vista: http://windows.microsoft.com/en-US/windows-vista/Change-mouse-settings

    Windows 7: http://Windows.Microsoft.com/en-us/Windows7/change-mouse-settings

  • Contact information for return pixel Imaq image with the mouse click event

    Hello

    I'm trying to get the coordinates in pixels of an image Imaq based on a mouse click event, similar to this post and this post. The problem is that with the first post, I get the coordinates in the image control and hesitate to trust them, they seem to have the Center origin, may return negative coordinates and do not represent the actual size of the detector that I use (512 x 512). It also returns the coordinates outside the actual data when it is clicked on the image control framework. The second method returns simply null coordinates. What I want are the coordinates of the pixel displayed when hovering the mouse imaq image control framework.

    What baffles me, is that I tried the second method with a png stock file and it works fine, it is only when I create an image from the data of my camera than the coordinates are returned null. Note data views of camera under control of image very well.

    Any ideas would be useful. Enclosed is a picture of the offending code and the Panel before displaying the camera data is coming (I know it needs some cleaning).

    Thank you

    Tyler

    for help, please send your vi

    but I think that this example vi is your solution

    check this vi

  • How can I configure Google Analytics event tracking in Muse?

    How can I configure Google Analytics event tracking in Muse?

    Hello

    Please check this after the thread, it might be useful

    Ability to add Google Analytics to track the link/button click?

  • When you open a Photoshop file with Bridge, how can I control what version of Photoshop, the file wil

    At the opening of a bridge of fthrough Photoshop file, how can I check which version of Photoshop, the file will open in?

    I store my PSD files that is adjacent to the original RAW file which it originates.

    If I open the folder and double-click this PSD file, it opens to the CS6. But, if I use the bridge (CS6) for access to and open the same file, it starts by is Photoshop CS5 and then opens this file PSD in CS5.

    How can I control which Photoshop will open a file then choose to open it through Bridge?

    Interesting, but it does not give any idea what I'm supposed to do. No Photoshop ducuments listed.

    Look at the PSD file on the location of Curt and Photoshop Document research. Beside him ideally should show Adobe Photoshop CS6 if you have Bridge open CS6. Click to provide the fly on the menu and choose the correct Photoshop from the list.

    But probably something went wrong with your installation. By default, Bridge chooses the latest version of PS to open its plug in.

    Maybe reset preferences may also help you. Can you provide more details about the version of the OS etc.

    And you have a good reason to keep your Raw and finalized in the same place files. Personally I put them aside and use a convention of appropriate filename (YYYYMMDD and details) so I can easily search the DNG files in my archives if I needed, but I don't make mistake by opening a bad

  • How can I close Firefox (closed) if properly run two windows with multiple tabs in each and I want to save them all?

    How can I close Firefox (closed) if properly run two windows with multiple tabs in each and I want to save them all? I tried to close each window by clicking the X in the top right, and then restart Firefox only loads the last closed window. Is it possible to close Firefox so it restarts with both windows?

    Hi osenochen, some additions to the first response:

    • You can display the classic menu temporarily bar by pressing Alt or F10 to access the file menu
    • There is also an icon of 'power' at the bottom of the graphic application menu (the one which is displayed by the button "3-bar" menu) If you prefer
    • If you closed a window and you want to re - open, go to the history menu and see a list of recently closed windows (by default, up to 3 windows closed are stored and can be re-opened - not applicable to windows private)
  • How can I disable right-click?

    I right click disabled globally on Windows 10, but FireFox still right click. How can I disable right click in the browser?

    Windows update has finally solved, I can't believe that I didn't try first. Thanks anyway!

Maybe you are looking for