How do I detect a User interaction?

This question arises more out of curiosity than necessity.
Let's say I wanted to create a Java version of the board game Risk. Let's also say I have an image of the board (a map of the world). How would I be able to tell in which terrritory (country) the user clicked?
Would I have to declare each territory as a seperate object?
-- if so then how would you get the objects lined up nice and neat against each other
Can I somehow include all possible XY coordinates of a territory?
I scanned through the 2dGraphics tutorial but didn't see anything that satisfied this situation exactly.
john

OK,
Solution 1)
So then every territory would need to be a different
color (different least as far as RGB:AAAAAB and
RGB:AAAAAC so that the human eye could not
distinguish), right? But is this good design?Well nations on maps are nomrally very different colors, so it doesn't matter if the human eye can distinguish the difference. I wouldn't say its bad design. In fact I think its pretty good.
Solution #2)
I still don't see how you can specify all possible
coordinates inside a territory. Especially since
almost all territories are not standard geometric
shapes.Solution2 could be considered better design, but much, much harder to maintain and find mistakes. What Solution 2 does is specify each pixel in a boundary. You could make that boundary the whole map or make a seperate one for each nation (which is what I would do). It is just a map of the pixels, therefore you get pixel perfect collision detection. Store the numbers in a text file (rename the extension to .map though; it looks better and you know exactly what the file is for) for best design. The file might look something like:
5, 10
23, 2;
56, 4;
If the file looked like this, then a collision would only be detected or returned if the mouse was clicked at the position:
x=5 y=10
x=23 y=2
x=56 y=4

Similar Messages

  • How to print a pdf without user interaction (With C#)

    My boss assigned me a task that to get the ImagePreview of 1st page of PDF.
    My thought is to print the 1st page of PDF to file(virtual print to file), and get the image source, but there comes the problem:
    How can print a pdf without user interaction(With C#),question are these:
    1. I can use the ShellExcute but cannot assign the destination of output file.
    2. User interface is unwanted, I don't want show anyone the Acrobat Reader interface who click the file just want to get a preview.
    3. No place to put those parameters in.
    This problem confused me a lot of days, I wish someone can give some hints.
    Thank you very much!
    (Maybe you will tell me to use Acrobat SDK, please don't, I'm afraid we cannot afford that)

    >I have not read the document yet
    This is the first step. There are many documents, but start with the
    introductory/getting started material.
    > with a index.pdx
    A PDX is a search database to allow you to do fast searching in
    Acrobat.
    >
    >About the relationship between Adobe Reader and Acrobat, as far as I know is that, the previous one is just the reading tool for PDF document, instead, Acrobat can modify and resave the PDF doc. Is it right?
    Effectively, yes. But the Acrobat SDK is mainly for working with
    Acrobat. It's very important to keep this clear, since you have said
    you only have the free Reader, so 95% of what is in the SDK cannot
    work for you.
    >
    >Simply my questions,
    >1. I don't know which dll to refer in the .Net project to print with. Is the ActiveX folder in product folder?
    Simply, there is no point asking these questions, yet, because you
    have not started on the documentation.
    But let's continue in the SDK forum, where I have posed what seems to
    be a very important question about why print to file at all.
    Aandi Inston

  • How to get the User Id from the user interactive task?

    If I need to get the user id or whoever process the user interactive task and save this information to the database, how can I get the user identity who process the interactive task? I tried the owner, creator on the execdata, but it doesn't work.
    Thank you

    try using
    Participant.id or Participant.name
    in the interactivity and update this value in the database.
    HTH
    Narasimha
    Edited by: Narasimha on Mar 6, 2011 9:42 PM

  • How to run eCATT in dialog mode(foreground) without user interaction(Enter)

    Hi,
        As part of performance testing using eCATT we want to execute a test script in dialog mode(foreground) without user interaction like pressing enter at end of each screen. The reason behind this is we want to run a test script 1000 times in dialog mode to analyze the performance of that particular transaction code. Hence its not practical to keep pressing enter at end of each screen. We do not want to execute this in background as that does not simulate the real time transaction processing and give the exact performance analysis.
    We have a test script with VA01 recording and are able to execute it perfectly in background as well as foreground (by pressing enter at end of each screen).
    I would like to know if there are any settings to be made to execute the test script in dialog mode without pressing enter. I have referred the below link which has not solved my purpose.
    ECATT - Running in Foreground (Enter Key)
    Thank You.

    Gopi,
    I never used this transaction before, but my approach would be as below. You may want to try and let me know how it works.
    Before running this script from ST30, first try to run from SECATT for one iteration to make sure the script and target system RFCs are working. Then try again in ST30. Still if you have the issue, ask your basis to take a look when you kick off from ST30 in the target system whether ST30 were able to successfully make the RFC call to that system.
    thanks
    Venkat

  • How to install skype without it detecting my user ...

    Hi All
    I am giving my laptop to family member and have cleaned it up and re-installed skype so he can set it up for his own use, however I notice upon downloading again Skype automatically detects MY user profile.
    How can I uninstall and re-install skype so that it installs as a fresh version without my own user details being loaded up?  Is there some hidden file I need to delete?
    Thanks for any help.

    Uninstalling Skype does not normally remove user data
    While Skype is NOT running (i.e. it has been Quit), hold down the 'Windows' key (to the left of 'spacebar') and press r on your keyboard to open the Windows 'Run' dialog
    Enter %appdata%\Skype and then click OK
    In the right panel of Windows Explorer, select and delete the folders whose names correspond to Skype Names whose data you no longer wish to retain on this PC
    Regards,
    Neil

  • How to automate testing of features that require user interaction?

    I am currently evaluating a test automation tool (RIATest) for my Flex app. In my app, the user uploads/downloads several files from the server. When I try to create an automation script for the process, I get error #2176 (also copied in the end of the post).
    Now, my question is that is there anyway to prevent this from happening? Is there some config file that could be modified to set up an isolated test environment without these security restrictions?
    My app uses some features that are only available with Flash 10, so using Flash 9 is not an option (I have understood that these security settings came with Flash 10).
    Thanks.
    Error: Error #2176: Certain actions,
           such as those that display a pop-up window,
           may only be invoked upon user interaction,
           for example by a mouse click or button press.

    jake_flex wrote:
    M*A*S*H 4077 wrote:
    Well, if player version is the problem, you can restrict the minimum version required and if the user's version is lower, he will get asked to update.
    Thanks for the reply.
    I need some features that are only present in FP10, so I need to compile against that version.
    Actually, I installed FP9 to my browser and compiled the app against version 9. Everything went well so far, maybe I'm getting confused with my own software already
    Anyway, that got me one step forward. When uploading a file, the user is presented the file browse dialog, which in my knowledge is the operating system specified component. At least RIATest doesn't seem to be able to control this. If someone knows how to handle such case with any test automation tool, please let me know.
    Edit: Just found this discussion on the same matter on RIATest forum http://www.riatest.com/forums.html?func=view&id=246&catid=9#246

  • How dose the user interaction flow break ?

    Main objective is to upload the screen capture to the Amazon S3 fully on client side. Here is the workflow I need
    User click a button to process all the workflow described below .
    1. Do the AMF request to backend and retrieve the S3 policy file information.
    2. Once the result comeback need to upload the screen capture of the image+ parent movieclip.
    3. After the image successfully loaded need to popup the html page .
    Second step not initiate and throws a security Error. The security restriction describe here:
    http://kb2.adobe.com/cps/405/kb405546.html
    What I want understand is, how dose the above workflow break user interaction event flow?
    Can I do the following way.?  dose this break the user interaction for upload data
    myButton.addEventListener(MouseEvent.CLICK,onClick)
    function onClick(event:MouseEvent):void
             var myTimer:Timer = new Timer(1000, 1);
        myTimer.addEventListener("timer", timerHandler);
        myTimer.start();
    public function timerHandler(event:TimerEvent):void
       //stuff to upload the image data with URLLoader 
    Thanks in advance

    You are trying to wait for an async event.  You are no longer doing the work
    in the event handler.

  • How do I detect user's Operating System?

    Hello,
    I was wondering if there is an amazing bit of actionscript
    out there that allows flash to detect the user's operating system,
    and from there then open the correct install version of adobe
    reader (basically just several different .exe files which I already
    have downloaded).
    I am using actionscript 2.0.
    Appreciate any help!
    Thanks

    trace(System.capabilities.version);
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Auto-install updates, with no user interaction?

    Due to problems with malware, we can't really trust everyone to be logged on with administrator privileges all the time as it used to be with Windows 2000 and XP. Consequently the installed software can not be modified by staff anymore.
    This doesn't affect Windows Updates since those can be configured to install automatically on a schedule without any user interaction or privilege elevation.
    Java for Windows however does not detect when a logged in user does not have administrative rights, so it offers updates to everyone who logs on, including people who can not and will not ever be able to install the updates.
    One "solution" is to turn off the update checking so that people aren't hassled by useless update notifications, but then this means Windows desktops will gradually fall further and further out of date, opening them up to attack by malware that exploits unpatched bugs in older Java versions.
    The proper solution that I really want, is for Java to be capable of auto-update and self-install without any user interaction or privilege elevation at all. However so far I have not found a solution for this.
    A hack may be possible using Windows group policy, the Windows Server task scheduler, and a java website screenscraper.
    Nightly:
    * Screenscrape Java.com for a newer client version
    * If new one is found, download, put in global read-access share
    * Using a database of machines known to be running Java, flag each candidate that's using an older version
    * Wake-on-LAN the machines needing the update
    * Schedule a remote install of the update with Administrative privileges
    * If update successful, clear flag for that machine in central database
    * shut down again for the night.
    OR
    Java programmers could implement an auto-install mechanism of their own, that can run by itself without user interaction at system startup, shutdown, or on a timed schedule set by the administrator through registry entries (and therefore configurable via group policy applied to desktops).
    ==========
    How are other network administrators handling managed business desktops that need periodic, automatic, and non-interactive Java updates?

    We use Altiris Software Delivery solution to deploy our Java updates but you could also use similar solutions such as Microsoft System Center Configuration Manager.
    The problem is that these are both options that cost money and require investment and training.
    Altiris allows you to create a collection based on the text string held in the Add/Remove Programs list (as well as other fields) - so you can easily create a collection of computers that do not have the required version of Java.
    You can then create a software delivery task to silently install Java with admin rights and target it towards the collection that needs updating.
    The collection updates dynamically. As the computers get Java they drop out of the collection and are no longer targetted for upgrade. This used to work well for me - as I could update about 500 machines in about 2-3 days.
    The problem is that the Java installer doesn't work consistently as you mentioned since JRE 6u25 - the installer doesn't always behave as expected and the switches to do silent installs keep changing. You also have a problem if you try to update Java and the person has their web browser open... Yes, I do my updates during working hours as well.
    In a constantly changing environment in terms of security - you'd think Oracle would have sorted the deployment options out by now?

  • How to check whether a user session is null or not

    Hi
    I am using Jdeveloper 11.1.2.2
    I have a use case of running some Junit test case, this is the problem I have :
    There are some Junit tests which are written for some VO's. While testing insert and update operation in Junit there is two mandatory columns Created by and Updated by to be entered for committing into the database.
    These values are taken from the UserName of the current UserSession .
    So for getting the these values for each user I thought of displaying a JPanel before the test is run, where the user enters the Username and password which is validated and the user is verified.
    First, I need to check whether there is a session present or not. For checking this, I wrote a createUserSession() and did like this inside it :
    if(fixture.getApplicationModule().getSession().getUserData().isEmpty())If so to show the Jpanel and get the user details and verify the user.
    But while running the test itself I found that the session is already present, now I just have to input the values based on who is the user.
    But Junit doesn't run the tests in the order in which the test are written. So I have to call this in all the test cases.
    The Question is :
    How can I check whether the session is already present or not, so that I don't have to ask the user every time while every test is running to enter the Username and Password ?
    Thanks,
    Nigel.
    Edited by: Nigel Thomas on Jul 30, 2012 10:26 AM

    Hi,
    wondering why don't you create test users and then automatically log them in as Jan Vervecken did on the threads I pointed you to. This way your test cases run without user interaction. To test if a session exists for a user, I would put a custom property into user data. If this property exists, the user session is an existing one. However, make sure the information you save into the user data survives passivation as otherwise the information you get out of this is not accurate. See: http://tompeez.wordpress.com/2011/07/08/jdev-always-test-your-app-with-applicationmodule-pooling-turned-off/
    Frank

  • How can i detect if my PC is not on Network..... Urgent Pls Help Soon !!!!!

    Hello Everyone,
    We all know whenever we try to connect to a PC which is not on network, we get UnKnownHostException etc..... by which we can detect that the corresponding PC is not an network(intranet/internet)
    But when i send a msg from my PC to my PC, it works fine even if the network is down. I hv provided my PC's IP address instead of using localhost or 127.0.0.1 which reduces the possibility that the msg will not be traversed thru the network.
    Any IDEA how this works.
    Is There any possible way by which i can detect that my PC is not on network or the PC to which i'm trying to connect is not on network .......
    Pls help me out, its really urgent as to be implemented in my Project
    Thanks In Advance
    Sahil Shaikh

    Hello Surtee
    I have developed a Messeging Service for the eCRM Apllication my company is developing and we r in the final stage of debugging.
    Now whenever a user sends a msg to a PC which is not on network, the messaging service automatically sends an Offline mssg to that PC. But know i want ot distinguish wheather the PC to which i'm sending the msg is not on network or am I not on network based on this i need to perform diff. actions, hence i wanted to know that how can i detect .......
    Pls see if u canhelp me out ......
    Thanks
    Sahil Shaikh

  • On the web how can I check the user role to display the form suitable for this role i

    Hello
    How can I check on the web the use role to display the a form for each role
    Example
    If the admin login I display admin_form.fmb and if user login I display
    user_form.fmb
    Thankx
    Tamer

    In my forms I hide tab pages according the role using something like the following script in the WHEN_NEW_FORM_INSTANCE trigger.
    So the user can not navigate to tabs which are vorbiden by his role.
    CURSOR users_roles_cur IS SELECT granted_role FROM user_role_privs
    WHERE username=(SELECT user FROM dual);
    user_roles_rec users_roles_cur%ROWTYPE;
    IF users_roles_cur%ISOPEN
    THEN
    CLOSE users_roles_cur;
    END IF;
    OPEN users_roles_cur;
    LOOP
    FETCH users_roles_cur INTO user_roles_rec;
    EXIT WHEN users_roles_cur%NOTFOUND;
    MESSAGE (user_roles_rec.granted_role);
    PAUSE;
    IF RTRIM(user_roles_rec.granted_role,' ') = 'BLA-BLA'
    THEN
    tb_pg_id := FIND_TAB_PAGE('activity');
    IF GET_TAB_PAGE_PROPERTY(tb_pg_id, visible) = 'FALSE' THEN
    SET_TAB_PAGE_PROPERTY(tb_pg_id, visible, property_true);
    END IF;
    END IF;
    END LOOP;
    CLOSE users_roles_cur;
    Other solution may be is to use an initial form which only will detect the user role and run the appropriate form.
    Other solutions are also possible.
    Joseph

  • How do I make a user to update to the current flash player

    I was able to gather info on how to test and display users OS and FP version. However this info is "dormant" it is just being displayed on the screen.
    Does anyone know how to make an alert message to upgrade to the current Flash Player if a user runs the lower version?
    If the version is as intended then no message should come up.

    Check out SWFObject - it can detect the version and, if need be, prompt the user with an express installer that lets them upgrade the player without even leaving your page.
    http://code.google.com/p/swfobject/

  • Is user interaction possible??

    Hi...
    just like passing parameters to the report... can we have user interaction possible with xml publisher??
    I mean can I specify something like this on the report...
    if(user clicked at some point)
    {   show table if table not shown
    hide table if table already shown }
    Want to know if this kind of interaction is possible....if yes, how?

    Brett
    Thanks for your reply.
    Actually my requirement is that I need to have a drill down of data like when I click on something, its details must be shown...
    So from your reply, I understood that it could'nt be done.
    And as you said , i tried embedding java script . but I am getting an exception saying-element script is not supported yet.
    So my doubt is ,is the syntax same as <script>my js code</script> or do we have any different syntax to follow?
    Thanks again!!

  • File Download Without User Interaction

    Hello,
    basically i want to transfer a file from one server to the
    other. I have a fixed source URL and a ready file handler .jsp at
    the destination server.
    In the past I did a lot with FileReference and their Browse()
    and Download() methods. Now i want to replace those points of user
    interaction and more or less stream the download file into the
    upload handler. Any ideas how i could achieve that?
    Thanks and GzG
    Nerun

    http://forum.java.sun.com/thread.jspa?messageID=3578246&#3578246
    Common sence would have told you that a <input type=file ... cannot be set with script.
    Since this input can be set to hidden you might unwantingly submit files on every page
    you visit.

Maybe you are looking for