How the setFocus() method in AS3?

Hello world. I'll try to keep it as simple as possible.

I try to use the setFocus method to highlight the default text in a text input field.

So bascially when the user clicks on the text field - the text is highlighted, and they can hit. Currently have about 16 text fields with something similar to "insert text here" as a guest for our lower ICT demographic of users and it is a bit tedious to expect the user to highlight text in each field, then tap it.

Can be done awesomly if you tab through the fields of text, but I expect not many users use this method.

I looked around on the net solutions to it using as3, but I have not found something that worked for me. I would be very grateful for a suggestion or a point in the right direction...

Thank you

If you want to by clicking on a textfield end with the text inside it, try the following...

TF1.addEventListener (MouseEvent.MOUSE_UP, selectText);

TF2.addEventListener (MouseEvent.MOUSE_UP, selectText);

TF3.addEventListener (MouseEvent.MOUSE_UP, selectText);

etc...

function selectText(evt:MouseEvent):void {}
evt.currentTarget.setSelection(0,evt.currentTarget.length-1);
}

Tags: Adobe Animate

Similar Questions

  • Where and how the main method should be defined

    Hi all

    I am new to Java and learning of the http://docs.oracle.com.
    Can someone help me underneath program where and how define a main method.

    public enum {costume
    DIAMONDS,
    CLUBS,
    HEARTS,
    SPADES
    }

    public enum {rank
    TWO, THREE, FOUR, FIVE, SIX, SEVEN,
    EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE
    }

    public class {Card3
    private rank final rank.
    final civil suit;

    Public Card3 (highest rank, suit suit) {}
    This.Rank = grade;
    This.suit = suit;
    }

    public getSuit() {} costume
    return of costume;
    }

    {public getRank() rank
    return of rank;
    }

    public String toString() {}
    return rank + 'of' + costume;
    }
    }

    MPort Java.util;

    public class Deck3 {}
    private static Card3 [] cards = Card3 News [52];
    public Deck3() {}
    int i = 0;
    {for (costume costume: {Suit.values ())}
    {for (the highest ranking: {Rank.values ())}
    maps [i ++] = new Card3 (rank, suit);
    }
    }
    }
    }

    Thank you
    Rambeau

    Hello

    When you are developing a Java application, that you must only have a class with a Main method, other classes do not need that method, the purpose of this methos is that it defines the beginning of your program, look at this link, it is an example and this explains also the Main method:

     http://docs.oracle.com/javase/tutorial/getStarted/application/index.html 
    

    Concerning
    Carlos

  • How the Add method for the control of data already created WebService

    I have total 3 methods in WSDL, and I chose one method during the creation of control data to the web service and its job very well.

    But now I want to add an additional method of WSDL. is it possible to add without re-creating? How to do this?

    I do not think that we support a data control WS existing in a kind of approach to the Publishing Wizard - you are without doubt better re - create the data control.

  • How the static methods are mocked in any mocking framework JMockit?

    I've learned that we can mock static methods using Basic with PowerMock java library? Jmockit.Want to understand how it does in short in-house?

    I think I understand:-as we define the mock class in the test case itself (although there are different ways to create the mock class in each frame as using a syntax of waiting in Jmockit), these framework must define custom classes thru Chargers that they should be looking for this class definition in the unit test is. Its an assumption. Not sure if this is correct? But even if I'm right, preference of classloader hirerchy is boootstraploader then applicationclassloader than customerclassloader. So, how's that search for customerclassloader instead of applicationclassloader? is there a way that we can set the preference of the customer above on applicationclassloader class loader?

    You can tell your not custom class loaders to delegate to its parent.

    Or you can give the custom class loaders a different classpath from its parent and place classes to be loaded by the loader custom only on the way to his class, and on the parent.

  • How the loading image in as3 without XML?

    Hey Hi,

    Can someone help me please, I want to load image wihout using XML.

    How can I do this?

    Thank you


    JaxNa

    The only thing you need XML for is to load in a list of images... it isn't as you need. You load images and swf with a Loader object files - and there is a lot of info in the help. In short, if you can simply do:

    var myLoader:Loader = new Loader();

    myLoader.load (new URLRequest ("myimage.jpg"));

    addChild (myLoader);

  • How can I change the position of to the MoveAbsolute method to move an engine?

    I'm just starting LabView and am still stuck on the methods of motor control. How to set the angle or position to which the engine will move (or turn in the case of MoveAbsoluteRot), and can I set the speed how to get there? Any help is appreciated.

    It is not the syntax of LabVIEW. The methods and the actual properties are defined by Thorlabs. The correct values are defined by Thorlabs. Functions in LabVIEW are simply display the names of the properties/methods and the names of the inputs and outputs to the Thorlabs ActiveX dll. There is nothing in LabVIEW itself which allows to determine the order, you must call a special series of properties/methods or their values. Detection of errors and reports done by the ActiveX dll.

  • How to set the position and size of the façade using the FPRunTimePosRunCustom method in a c# application?

    How to set the position and size of the façade using the FPRunTimePosRunCustom method in a c# application?

    I found a solution! -Set the size and position of the façade with the help of the

    File > VI properties > window running Position (in category list) > custom (in position of menu drop-down).

    then just accept the current position and size (leave the boxes checked) or set values you want directly (uncheck the boxes and fill in the numbers), or physically position and size the façade and use, the "set to current location" button and press "set size" current All that is easier for you.

    OK so it does not make use of the method VI Methods (Active X) FPRunTimePosRunCustom ([Position], [Size]) but if labview want to make him difficult to use then other means must be found.

  • Windows XP: How to remove the underline of my icons? The standard method (Tools |) Records | etc) doesn't change anything

    Windows XP: How to remove the underline of my icons?  The standard method (Tools |) Records | etc) doesn't change anything

    In addition to the information provided by Imran, you can also watch the following option:
    Go to start > settings > Control Panel > Folder Options.
    On the general tab, uncheck the box 'Underline titles compatible icon. "
    with my browser.

    This was suggested in another forum by Carey Frisch.

    It will be useful.

    Marilyn
    .

  • Why the setFocus() and setText() methods does not work for BasicEditField

    Hello

    I tried to apply the methods of setFocus() and setText() on a BasicEditField, but he always up "illegal state exception.   However, the getText() method can work.

    Can someone explain this please? Thank you!

    Another thing would be - if you use filters on your EditField and allows you to define something that is not allowed by the filter, it will throw an exception setText()...

  • How to use the post method?

    Hello

    I need to send an image on the server using the post method.

    I connect using Http, like this:

    HttpConnection _http = (HttpConnection) Connector.open (address);

    can someone provide an example of how can I use a post method to send the data to the server?

    Kind regards

    I solved the problem. Here is my code, which works:

    Bitmap _bitmap = new Bitmap(Display.getWidth(), Display.getHeight());
                Display.screenshot(_bitmap);
    
    JPEGEncodedImage _jpg = JPEGEncodedImage.encode(_bitmap, 20);
    DataBuffer _db = new DataBuffer();
    _db.write(_jpg.getData());
    
    _http = (HttpConnection)                    Connector.open(_url, Connector.READ_WRITE);
    
    _http.setRequestMethod("POST");
    
    _http.openOutputStream().write(_db.toArray());
    _http.getResponseCode();
    

    Kind regards

  • How to modify and update a line later was inserted and updated in the doDML() method?

    Mr President

    Jdev worm is 12.2.1

    How to modify and update a line later was inserted and updated in the doDML() method?

    I added two rows in my table a method of action-listener in bean managed and secondly with operation doDML() as below.

    Method 1-first row in managed bean

        public void addNewPurchaseVoucher(ActionEvent actionEvent) {
            // Add event code here...
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();        
            DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator");        
            RowSetIterator rsi = dciter.getRowSetIterator();        
            Row lastRow = rsi.last();        
            int lastRowIndex = rsi.getRangeIndexOf(lastRow);        
            Row newRow = rsi.createRow();        
            newRow.setNewRowState(Row.STATUS_NEW);        
            rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);         
            rsi.setCurrentRow(newRow);
            
            BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry();        
            DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator");        
            RowSetIterator rsi1 = dciter1.getRowSetIterator();        
            Row lastRow1 = rsi1.last();        
            int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1);        
            Row newRow1 = rsi1.createRow();        
            newRow1.setNewRowState(Row.STATUS_NEW);        
            rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1);         
            rsi1.setCurrentRow(newRow1); 
            
            
        }
    


    Method of doDML() of line 2 seconds in the entityImpl class


        protected void doDML(int operation, TransactionEvent e) {        
            setAmount(getPurqty().multiply(getUnitpurprice()));
           
            if (operation == DML_INSERT)  
                       {          
                         insertSecondRowInDatabase(getVid(),getLineitem(),getDebitst(),
        (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));  
                           }
                           
                           if(operation == DML_UPDATE)
                           {
                               
                           updateSecondRowInDatabase(getVid(),getLineitem(),getDebitst(),
        (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100));                        
                           }                                       
            super.doDML(operation, e);
        }
    
        private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4)  
                  {  
                    PreparedStatement stat = null;  
                    try  
                    {  
                      String sql = "Insert into vdet (VID,LINEITEM,DEBITST,AMOUNT) values 
       ('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "')";  
                      System.out.println("sql= " + sql);    
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
                      stat.executeUpdate();  
                    }  
                    catch (Exception e)  
                    {  
                      e.printStackTrace();  
                    }  
                    finally  
                    {  
                      try  
                      {  
                        stat.close();  
                      }  
                      catch (Exception e)  
                      {  
                        e.printStackTrace();  
                      }  
                    }  
                  }  
                  
                  private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4)  
                  {  
                    PreparedStatement stat = null;  
                    try  
                    {  
                      String sql = "update vdet set vid='"+ value1+"',lineitem='"+ value2+"',DEBITST='" 
       + value3 + "', AMOUNT='" + value4 + "' where VID='" + VID + "'";  
                      System.out.println("sql= " + sql);      
                      stat = getDBTransaction().createPreparedStatement(sql, 1);  
                      stat.executeUpdate();  
                    }  
                    catch (Exception e)  
                    {  
                      e.printStackTrace();  
                    }  
                    finally  
                    {  
                      try  
                      {  
                        stat.close();  
                      }  
                      catch (Exception e)  
                      {  
                        e.printStackTrace();  
                      }  
                    }  
                  }
    

    Now the problem is that when later I change the quantity and price of the first line isn't updated but second row, because I used the command

     <af:button actionListener="#{bindings.Commit.execute}" text="Commit"
    

    This button update the first line added by bean managed, but the second row remains unchanged.

    Please help how to update the two lines with the same button or something else.

    Concerning

    DML_UPDATE will call only if there is some change data attributes.

    I guess that the update statement is false because vid looks like a primary key for the table, then, how update you the primary key of the update statement and how the update condition statement where the vid = '0'

    I assume the update statement should look like:

      private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4)
      {
        PreparedStatement stat = null;
        try
        {
          String sql =
            "update vdet set lineitem='" + value2 + "',DEBITST='" + value3 + "', AMOUNT='" + value4 +
            "' where VID='" + value1 + "'";
          System.out.println("sql= " + sql);
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
  • How to use the query xml in as3

    What follows is the result of the motion preset xml export.

    < motion duration = "1" xmlns="fl.motion. * ' xmlns:geom=" flash.geom. * ' xmlns:filters="flash.filters. * '>

    < source >

      < source frameRate = "24" x="449.5" y="138.55" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" instanceName="ball" symbolName="ball">

    < size >

      < geom: Rectangle left="-51.5" top="-51.5" width="103" height="103"/>

    < / size >

    < transformationPoint >

      < geom: Point x="0.5" y="0.9956310679611651"/>

    < / transformationPoint >

    < / source >

    < / source >

    <Keyframe index="0"/>

    < / movement >


    can someone show me how the as3 in flash script should be to put the motion to my mc "ball" in the fla?

    You cannot use a string.  Use the movieclip, evt.target not evt.target.name.

    (p.s when you use the adobe forums, check useful/correct, if there is.)

  • How to bind the AM method to EL

    I want to connect the AM method in EL expression to control the user interface component attribute made,.

    {in my AM I create a method and expose this data control method, rendering for the UI component attribute is defined as that "rendered =" #{bindings.isRayTesting.result ""} ", it seems that this method cannot be performed until the page is rendered,

    How do I make the excute method before the page is rendered.

    the AM method

    for example:

    public boolean isRayTesting() {}
    Returns false;
    }

    {in my AM I create a method and expose this data control method, rendering for the UI component attribute is defined as that "rendered =" #{bindings.isRayTesting.result ""} ", it seems that this method cannot be performed until the page is rendered,

    To call the method that is exposed in the pagedef using EL, you need something like: #{bindings.isRayTesting. {Run} so there is no way to implement your use case using only the EL.

    Check this post for alternatives: https://blogs.oracle.com/adf/entry/an_epic_question_how_to

    Also, many of the properties of the JSF component (as "lent") are evaluated several times in the life cycle JSF request so an expensive operation in them can significantly degrade performance.

    Dario

  • How do I keep track of all the classes/methods/properties created in a long script


    Hello

    I'm curious to know how people use to keep track of all the classes, methods and properties that you created when you write a script any longer.

    For quick scripts, this isn't a problem. But for long scripts, it can become quite difficult to keep track of all the objects, was created, and all their methods and properties and builders overloaded, etc..

    ESTK is large, and it is the IDE that I use for InDesign scripting, if only because of, it is powerful, debugging options.

    But it provides no way to keep track of such things. No good Intellisense in Visual Studio.

    I'd be curious to hear how people solve this problem.

    JsDoc can generate documentation for the JavaScript API commented and can be used for ExtendScript.

  • How to add several lines to the CreateWithParameters method

    Hello
    can someone tell me how to insert several rows in a table by using the CreateWithParameters method, which I use in a taskflow.

    That's why you get a null pointer...
    Add the iterator in this page or call the method in the second page... both should work... :)

Maybe you are looking for