How to restrict the movement of movieclip on the stage?

Hi, I want to spend my movieclip to the left and right, but he moves out of the scene. I want to restrict the movement of X the width of my step.

This is my code for the movement of movieclip:

import flash.events.KeyboardEvent;

stage.addEventListener (KeyboardEvent.KEY_DOWN, moveavatar);

function moveavatar (event: KeyboardEvent): void

{

If (event.keyCode is 39)

{

avatarmove.x += 10;

}

Else if (event.keyCode == 37)

{

avatarmove.x = 10;

}

}

How do I limit the movement of X the width of my step so it won't leave the stage? Thank you.

You have the registration point in the upper left corner. In my case, I had to focus. If you want to keep as you have, replace with this:

import flash.events.KeyboardEvent;

stage.addEventListener (KeyboardEvent.KEY_DOWN, moveavatar);

function moveavatar(event: KeyboardEvent): void {}

avatarmove.x = Math.max (0, Math.min (stage.stageWidth - avatarmove.width, avatarmove.x - int(event.keyCode==37) * 10 + int(event.keyCode==39) * 10))

}

Tags: Adobe Animate

Similar Questions

  • How to restrict the running command prompt?

    How to restrict the running command prompt?

    I already know the method: HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System DisableCMD: 2

    but, but, it is possible to change reactivate cmd used much the system tool software

    So I want to deny the change of registry value by the software used, I changed all permissions to the registry [System] refusal keys with my account.

    but after a modified registry key permissions denied, disableCmd was inactivated more.

    It is impossible that the two parameter [disablecmd: dword = 2] and [{System} lock keys: administrator of the deny all permissions in my account]?

    This issue is beyond the scope of this site which is for the consumer to related issues.
    To ensure that you get a proper answer, ask either on the Technet site, if it is a type of Pro problem, or MSDN if it's related to the developer
  • How to set the stage (or the background in the stadium?) to be transparent?

    How to set the stage (or the background in the stadium?) to be transparent?

    Thank you

    Gary

    Select the scene.

    Color sample

    Then set the Alpha slider to 0.

    .

    Darrell

  • How to restrict the use of the connection profile Anyconnect to traffic from an interface?

    Hello

    A few questions about the profiles connection Anyconnect and dynamic access policies:

    • I set up multiple profiles connecting Anyconnect with different characteristics. I want one of the profiles to be visible and usable only when the Anyconnect client connect through a specific interface (and not the outside interface). How can this be configured? As it is now all profiles are visible via all interfaces compatible VPN.
    • DAP: When dynamic access policies are configured, these will be global or is it possible to link a policy to a specific connection profile? I would like to configure the DAP Protocol to be effective only when you use a specific connection profile. What is a good way of thinking? What I want is: when a user Anyconnect choose a specific connection profile, it needs to connect using a DAP which requires membership in an ad group and existence of a local file.

    Best regards

    Thor-Egil

    • Unfortunately, you cannot restrict the interfaces of the AnyConnect fitting profile is assigned to AnyConnect connection profiles are global settings, no interface specific setttings, therefore, it will be available no matter what interface the AnyConnect is connected to.
    • DAP political work as an access list. It in the lowest priority to highest priority and he stops at the first match. For example, you can create a number of policies on what you want to match on. You cannot however force the user to authenticate to AD when they choose a specific group of tunnel. DAP is used to apply that only users that meets policy is allowed access. For example: If the user belongs to a specific ad group and also have a file exist, the user will be allowed access to use the AnyConnect. So it's the application that the user connects from a company laptop where you specified the policy, that is to say: exist in AD and have a specific file in his laptop. This is to ensure that those who try to connect to the site of the company non-portable, or internet kiosk have accessed to the VPN, because they may not be protected and can infect your corporate network, if they are allowed to access.

    Hope that makes sense.

  • How to restrict the new line in input field or delete the last tank in as3?

    Sorry, Noobie here!

    I have a text entry box. If you press ENTER, a new line starts; What makes the line previous invisible unless you press the BACKSPACE key.

    So, if I type '1' in the input box, then hit eneter the number '1' becomes invisible, except if I retaliate.

    Now, I still need the Enter key because I have an event listener that calls a function once it's in a hurry, but I still need that '1' is visible.

    So, I need to be:

    To be able to restrict the field of the creation of a new line (line authorized max = 1)

    or

    To delete the last character entered in the text of entry if you press the Enter key.

    These two should be the same result, but I don't know how to do both.

    If anyone can help, I would be very grateful!

    Turn off your textfield object multiline:

    your_tf. Multiline = false;

  • How to restrict the Subscriber to display its own feed?

    How to pass the opponent UserID to Subscriber?

    private function displayExistingStreams (): void
    {var publishers: Object = _streamManager.getStreamsOfType (StreamManager.CAMERA_STREAM);}
    status_txt. Text = "displayExistingStreams";
    for (var publisherID:String in editors) {}
    If (publisherID! = _userManager.myUserID) {}
    setUpSubscriber (publisherID);
    }
    }

    }
    protected function setUpSubscriber(p_publisherID:String):void {}

    currentSubscriber = new WebcamSubscriber();
    currentSubscriber.displayUserBars = true;
    currentSubscriber.connectSession = cSession;
    currentSubscriber.subscribe ();

    publisherIDs used to restrict the list of editors that this Subscriber needs to show videos for.
    currentSubscriber.publisherIDs = [p_publisherID];

    }

    Hello

    You will need to loop on userManager.userCollection user ID and get all user ID and all codes except yourself the webcamSubscriber.publisherIDs value. And you need to update this whenever the user enters or leaves the room (listening to UserEvent.USER_CREATE and UserEvent.USER_REMOVE in UserManager, if you want to dynamically maintain this list publisherIDs)

    I answered this in other forum posts earlier.

    Hope this helps

    Thank you

    Hironmay Basu

  • How to restrict the use of an expired agreement?

    On the generation of an invoice how do ensure that the expired agreement is not used? Other than its use hard limits, some code changes are possible to ensure this?

    Hello

    Limit is useful to restrict the receipts or invoices billing above base funding.
    If you need to limit the billing for the agreement of the expiration date, you will need to use a custom solution.
    Oracle to only display a warning message, but does not prevent the generation of billing.

    You can develop an extension of billing, and he attributed to pre-processing place call of GDR and GDI.
    The extension of billing will compare Bill through date with the contract end date and later there will be the process without Bill of project production / income.

    Dina

  • How to restrict the tunnel VPN Site to site traffic thrue

    Hello

    I have a tunnel from site to site, where Site 1 is the local site and main site.  and 2 the site is the remote site.

    How to limit the traffic of site 2, so that they can only reach a few IPS on the lokal site.

    But since the lokal site all IP addresses must be able to reach all of the IP addresses to site 2 (remotely).

    an access list to the 'inside' interface does not work, since all the acl is bypassed for the interfaces for IPSEC traffic.

    Then, I tried to make a political group where I only allow traffic to servers specifik, but site 2 can still reach everything on the lokal site.

    Am I missing here?

    Best regards

    Erik

    Hi Erik,

    Unfortunately, the only options that we have are VPN filters that are two-way and disabling the sysopt feature.

    If you have a core switch/router we can block traffic on this device by using the access list or null routes.

    See you soon,.

    Nash.

  • How to restrict the use of the CPU not exceeding 10% in particular schema...

    Hi all

    Use the Oracle 11 g R2 database.

    My question is that I have a user of scheme called 'msndp '. I want to restrict the user from this diagram of the CPU usage not use more than 10% in my database. Since this is a production database.

    any information post regarding this issue's

    Thanks in advance...

    You must assign the user profile

    ALTER USER user_name PROFILE PROFILE_NAME

    You cannot accomplish % 10 use of the processor by PROFILE

    CPU_PER_SESSION specify the time limit processor for a session, expressed in hundredths of seconds.

    you use the resource for this Manager

    Concerning

  • How to restrict the user to enter not same value in a table

    Greetings!

    I m asking a second time the upfront because I did not answer preivously, so please don't mind if it's a double.

    It was: I have created a table, as shown in the example.

    I want to validate the user name that you see in my example to restrict the user to enter the same value in the user name field before submitting page.

    for example when the user enters data as u see test in user name in the first row, when it goes to the second row and type same username as test "message will appear or restrict the user who has already typed or in use"...

    http://Apex.Oracle.com/pls/Apex/f?p=45296:1:22797340776918:

    It's all done on typing submit prior to registration.

    Please drivers

    Hello

    I m asking a second time the upfront because I did not answer preivously, so please don't mind if it's a double.

    It was: I have created a table, as shown in the example.

    I want to validate the user name that you see in my example to restrict the user to enter the same value in the user name field before submitting page.

    for example when the user enters data as u see test in user name in the first row, when it goes to the second row and type same username as test "message will appear or restrict the user who has already typed or in use"...

    http://Apex.Oracle.com/pls/Apex/f?p=45296:1:22797340776918:

    It's all done on typing submit prior to registration. >

    Stick the code below into the Page header > Javascript > run when loading the Page field.

    $('[input[name="f03"]').blur(function(){
      if ($('input[name="f03"][id!="'+$(this).attr('id')+'"]').val() == $(this).val()) {
         alert('Duplicate Entry.');
         var x = $(this).attr('id');
         setTimeout("(function(p){$('#'+p).focus();})('"+x+"')",100);
      }
    })
    

    Note:
    a.F03 is the 'name' of your column of username in the form of tables.
    b. This only valid values. If your tabular presentation has multiple pages then all of the rows are not currently displayed will be ignored.

    See you soon,.

  • How to restrict the other user of patterns of connection instead of apps in EBS R12?

    Hello

    We use the EBS r12 (12.0.6) with database (10.2.0.5) in RHEL 4.6 (64-bit).

    In fact, I checked that users like INV, GL, PO etc, are bydefault can connect to the basis of EBS by using any tool like TOAD development.

    So, how can we protect them instead of the APPS user?





    Thank you
    fazijee

    Hello
    You must change the default password for these schemas. Follow it please: -.

    1. how to change the default passwords in the Oracle Applications? [813653.1 ID]

    2. how change Applications going using the apps schema password change Utility (FNDCPASS or AFPASSWD) [ID 437260.1]

  • How to restrict the wildcard character in the search form?

    Hello
    I am new to ADF and learning from Steve's blog. I was going to for example 158th in which he restricted the wildcard search. I could not
    understand where he defined the restriction of wildcard. I have checked the VO.xml Emp but found no clue. Can someone help me please?

    It is in test.model.CustomViewObjectImpl.java in the model project

  • How to restrict the user to enter data into the PLUGS DO

    Hello

    I textinput in my page, I have to restrict the user to enter the data covers only.

    can someone help me on this.

    Knockaert

    Please go through this site.

    http://oracleanil.blogspot.com/2010/10/restrict-user-to-enter-data-in-caps.html

    Concerning
    Meher Irk

  • Reg: How to restrict the values LOV

    Hi all

    I use JDev11.1.2.3.0

    My requirement is I < af:inputComboboxListOfValues id = "iclov1" > in which I have 100 values.here I have to show only 10 values on LOV users.if user longer wish to certain values it can use search that.so how can I restrict only values and how to show than 10 numeric values on that.can someone help me please.

    Thank you

    G.Shilpa

    Shilpa, you can change the indications of the UI lov to drop-down list here you can get query limit 10 set so you can get the 10 records in the lov... u can follow this link, you can get an idea

    .. https://blogs.Oracle.com/ADFProgrammers/entry/restrict_the_number_of_items

  • How to restrict the instance in the hallway to initiate the user only?

    Hello

    In my process, using BPM 11.1.1.6, there are two corridors. The first corridor (SUBMITTER) allows you to instantiate an instance, and after that some tasks in the service, the user moves to the next human task, in the same way. On request, the instance moves to the second hallway (APPROVER). However, if the applicant has not yet presented the second human task (say it just saves) then all other authors of the COMMUNICATION in the same way SUBMIITER, can see his data! Apparently, it's because the instance is given the role of the ISSUER and not attributed to the person of instantiation.

    How can we limit the instance be assigned or limited ONLY to the user instancing (during his life in the way of the TRANSMITTER), while other authors of communication may not see his body?

    Any help is appreciated.
    Thank you!

    PS: are we instantiate the task via API, so we have the flexibility to make an API call if we know what API call will solve this problem. THX.

    One thing you'd want to double check before continuing is to see how the 'creator' predefined variable has the value entered into the human task is defined (not sure what it is about when the API is used).

    Assuming that the 'creator' (or other string variables) is set to userid of the initiator, here are the steps to assign that person to the task in a later human task.

    1. open the human task.
    2. click on the tab "assignment."
    3. click on the icon with the person in it-> click the 'change '.
    4. in the drop-down list, select 'Names and Expressions'-> make sure the 'Value-based' option button is selected-> click on the + icon on the right-> sub select 'Type of Identification', 'User'-> slot 'Type of data' select 'by the term'-> slot 'Value' click on the button «...» ».
    5 expand the 'task'-> scroll down and select "task: creator" (or any string variable that you set for the user ID of the person who created it in the API)-> click "Insert into the Expression"-> click on 'OK'-> 'OK '.

    Hope this helps,
    Dan

Maybe you are looking for