Get the value of the variable inside the function from the event (EventListener)

How to get the value of the variable inside the function from the event. Variable has been declared as a function of external events.

var StringVar="sample";




myButton.addEventListener(MouseEvent.CLICK, myClickReaction);

function myClickReaction (e:MouseEvent):void{
StringVar="other sample";
}

trace(StringVar); /* it gives me "sample" value and i would get "other sample" value */ 

This strange because if it would be the trace of a normal function would give me good result.

var StringVar="sample";


function myClickReaction():void{
StringVar="other sample";
}

myClickReaction();
trace(StringVar); /* it gives me result as i wanted to have - "other sample" value */ 

I also know method of passing of arguments depending on the event, but it doesn't for me as I would like to

var StringVar="sample";




myButton.addEventListener(MouseEvent.CLICK, function(e:MouseEvent){ myClickReaction(e, StringVar) },false, 0, true);

function myClickReaction (e:MouseEvent, StrVar:String):void{

StrVar="other sample";
}

trace(StringVar); /* it also gives me "sample" value and i would get "other sample" value */ 

How to do it correctly?

I do not know the structure of your screen lists so I can't tell you how to access the variable, but you're on the right track. If it's a parent, then you can always use the .parent property to cross to the top the list display to try to access.

for example 1 level:

MovieClip (this.parent). StringVar = "another sample";

Add more properties .parent to continue to move to the top of the list.

for example:

MovieClip (this.parent.parent). StringVar = "another sample";

Just like always, use traces (MovieClip (this.parent). StringVar); until you get the value that you want to know that you're accessing them correctly.

Tags: Adobe Animate

Similar Questions

  • How to get the event when we change our simcard in BB device

    Hi all

    Please, someone tell how to get the event or any listener method that can automatically called when we change our SIM card device.

    Thanks in advance,

    TEJ

    Hi Tej,

    I came across some post, which may be useful for you

    http://supportforums.BlackBerry.com/T5/Java-development/is-there-a-way-to-get-the-mobile-or-phone-nu...

    http://supportforums.BlackBerry.com/T5/Java-development/is-SIM-ID-really-exist/m-p/54407#M5954

  • I transferred my pictures from the camera and they appear only in the last download and not events.  I tried everything, how can I get the events?

    I transferred my pictures from my camera to my mac, and they downloaded with the only place wherever they appear in "the last download" but not in "events".  I also downloaded on my macbook and had the same response.  I've never had this problem before and have tried everything.  How can I get them to appear in the "events"?  Since my last camera download, I have create a second library, but they are not more in the events.

    CTRL-click a picture on the last import, then select "Show event.  It shows the event?

  • SQL Server, get the event ID 10016 hourly

    Hi guys,.

    We get the error message below on our SQL with OS WS2012 server every hour.

    "The application-specific permission settings do not grant permission to local Activation for the application server COM with the CLSID.

    {FDC3723D-1588-4BA3-92D4-42C430735D7D}

    and APPID

    {83B33982-693D-4824-B42E-7196AE61BB05}

    the user NT SERVICE\SQLAgent$ IBSQL2012 SID (S-1-5-80-485265429-2350460967-4062759752-2586802043-2488535659) from address LocalHost (using LRPC) running in the container of the application unavailable SID (not available). This security permission can be modified using the Component Services administrative tool. »

    I have been through a few threats and read it from another post on the internet, but under Component Services, tab of the particular service related to this message (based on its APPID) I see that SYSTEM is already added and it has the Launch Local and local Activation permissions granted to the security.

    Why are we always get that number, because instead of local authorities, we should give remote "..." from LocalHost (using LRPC) address... » ?

    All thoughts

    MCG

    Ask the question in the SQL Server forums:
    http://social.msdn.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer

  • How to get the event target?

    I recorded the event mask depending on:

    App.notifiers.Add ("Hd",.. mpfprojectdir\dev10\src\csharp\projectbase.file path);

    Now, how can he obtain the object that triggered the event?  [app.active document.activeLayer] give me only the layer ".  Of course, this does not work in a scenario where the user hides a layer that is not selected.

    I'd appreciate any help!

    Action handler has no direct access to objects in the object model. It has its own class and object. Sometimes, there may be a more direct access by name. If the event descriptor was the index of the layer or the ID you can use instead of the name.

    Sorry, when I threw together for you I only tested hidding layers that do not have the activeLayer. I don't think that the alert is empty is because the top layer was hidden. I think it's because the activeLayer was hidden so the actionReference is different.

    Try this (which seems to work for me with both)

    try {
        if (arguments.length >= 2) {
        var desc = arguments[0];
        var event = arguments[1];
        // make sure it's the hide event
        if (event == charIDToTypeID('Hd  ')) {
            // get the list of what was hidden
            var list = desc.getList(charIDToTypeID('null'));
            // get the actionReferences from the list
            var ref = list.getReference(0);
            var psClass = ref.getDesiredClass();
            // make sure it was a layer that was hidded
            if(psClass == charIDToTypeID('Lyr ')){
                // check to see what is in the reference
                var dataEnum = ref.getForm();
                // should either be an enum if activeLayer
                if(dataEnum == ReferenceFormType.ENUMERATED) {
                        alert(app.activeDocument.activeLayer.name);
                }else{// or the layer name
                    alert(ref.getName());
                }
            }
        }
      }
    } catch (e) {
      alert( "Error: " + e + ":" + e.line );
    }
    
  • How to get the events of the ItemRenderer

    Hello, I have a little problem. In my application, I use a list and build its elements with an itemRenderer. In this itemRenderer I have on each line, 1 label and 1 button. When I press the button I want to send this event in my main application... How can I create a communication between myApplication and itemRenderer?

    Thx for all

    Max

    
    
        
            
        
        
            
                
                    
    
                        
                            
                        
    
                    
                
            
        
    
    

    You can use the code above. Let me know if you have any questions.

  • How to get the event when you click Add another button in a table.

    Hello
    How to recognize the event in processFormRequest click on the button Add another line of the footer of a table?

    Suppose if the ID is anotherRow (I mean ID of the button to add another line of the footer)

    If I give if (pageContext.getParameter ("anotherRow")! = null)... its not recognizing the event that is returning null only...

    I want to perform certain actions when the user clicks Add another line of footer. Please let me know the details of how identify when add another line is clicked...

    Thank you
    Srikanth

    Hello

    If you have only one table with add_row_button, and then copy the following code works perfectly

    If (tableBean.getName () .equals (pageContext.getParameter (SOURCE_PARAM)))
    (& ADD_ROWS_EVENT.equals (pageContext.getParameter (EVENT_PARAM)))
    {
    ...
    }

    tableBean is the Handle for your advanced table, hope, it will help you.

    Kind regards
    Out Sharma

  • Get the event 680 Viewer when the guest account is disabled in Windows 2003

    Hello

    We have "guest" account disabled on Windows 2003, but again we see events like this

    <13>2 Jul 01:58:33 192.168.80.11 security MSWinEventLog 0 5768968 Sun Jul 01 15:58:32 2012 has 680 xxxxhostnamexxx Audit of the failures of the security user SYSTEM connection logon attempt by: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0 login account: comments Source Workstation: xxxhostnamexxx error Code: 0xC000006A 58482770

    What could be the reason?

    Thank you

    Hello

    Thank you for visiting the Microsoft answers community site. The question you have posted is related to Windows Server and would be better suited to the TechNet community.

    Please visit the link below to find a community that will provide the support you want.
    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer

    I hope this helps.

  • How to get the event when the window is iconified?

    I want to set animation after I click the icon.
    Please help me.
    Thank you.

    stage.iconifiedProperty () .addListener (new InvalidationListener() {}
    @Override
    public void invalid (observable observable) {}

    }
    });

  • Get the value of the column of the report to a variable

    Hello
    I have a static report that fills the data in a non editable view. I added an extra field in the page, but without a column in the view. Initially, the new column will display all the data, but user has an option to enter any number on each line. This user has entered a value I need to assign to a variable.
    How can I get that value to a variable?

    Kind regards
    Prasanth

    Open page source/inspect with firebug, the editable column and find the name of the editable field (entry =... name = "fxx" id). It should be of the form fxx * where x can be from 01 to 50.

    This is a table that will have as many number of items that there are lines in this report page (one for each column of each row)
    I don't know how you plan to use this value as is not a variable, but rather a single value for each line?
    If you want such EI (i.e. ith line value) would be available in

    APEX_APPLICATION. G_Fxx (i)

    replace xx by the real number

  • Get the value of the user in plsql environment

    Hi all

    I am writing a program like below:

    DECLARE

    v_user VARCHAR2 (10);

    v_pswd VARCHAR2 (4);

    v_cardN VARCHAR2 (5);

    v_authState BOOLEAN;

    v_choice NUMBER;

    BEGIN

    DBMS_OUTPUT. Put_line ("Welcome to the Bank! Enter your 5-digit card number ");"

    v_cardN: = '& Card_Number';

    v_user: = "& username ';"

    v_pswd: = "& PIN";

    v_authState: = Authenticate_user (v_cardN, v_user, v_pswd);

    IF this is v_authState THEN

    DBMS_OUTPUT. Put_line ("failed authentication! Please re - enter your details).

    GOTO end_line;

    ON THE OTHER

    DBMS_OUTPUT. Put_line (' authentication successful!) Welcome ' | v_user);

    -ATM_Operation();

    END IF;

    DBMS_OUTPUT. Put_line (' what do you want to run');

    DBMS_OUTPUT. PUT_LINE(' 1.) Balance inquiry '. CHR (10) | "2 remove ' | CHR (10) | "3 deposit '. CHR (10) | ("4 check last three Transactions ');

    v_choice: = & choice;

    < < end_line > >

    NULL;

    END;

    /

    Enter the value of card_number: 12347

    Enter the user name: Himanshu

    Enter the value for the PIN: 1234

    Enter the value of the choice: 3

    Welcome to the Bank! Enter your 5-digit card number

    Authentication failed! Please enter your details

    PL/SQL procedure successfully completed.

    It's getting all values quoted with & < variable > got guest quickly even if requested subsequently.

    What is my requirement is: I want the value that arises only when it is requested in order. As choice is requested only after successful authentication.

    Have we not all features in plsql done for user input in this way.

    Please let me know is there within language plsql or not? Or it is possible by taking help of coding code plsql with unix environment or java to achieve?

    It's getting all values quoted with & got invites quickly even if requested subsequently.

    Of course they are! SQL * more is a client tool. It will be:

    1 parse the input

    2. ask all THE required values

    3 replace the values by the user entry in the code

    4. present the code for execution

    5. display the results.

    The code runs on the server and the server has NO contact with the user.

    What is my requirement is: I want the value that arises only when it is requested in order. As choice is requested only after successful authentication.

    Then, you will need to write a client application that will ask at your leisure. Write a Java application to do and then use JDBC to send code or queries to the database.

    Have we not all features in plsql done for user input in this way.

    No - PL/SQL runs on the server. The server has NO contact or interaction with the user.

  • Get-VIEvent - how to export the event type?  error, warning, or info

    Hello

    I know that the Get-VIEvent command allows you to specify the type of events to get back... that is to say [-Types < EventCategory [>]

    but, I want to extract all the events and export them to a CSV file. I want one of the columns to be "EventCategory", which will be ERROR, WARNING, or INFO, but I can't seem to find it.  $_. GetType(). Name gets me the type of event, but not the category.  I know that I can have my script executed 3 times (each time specifying the - parameter Types) but I want to run only once.  Any ideas?

    Thank you!

    Jeff

    Hello, horningj-

    I worked on a few elements that should attract the event category.  The first selects a few properties, including a calculated property that gets the event category:

    ## works well if no events of type 'EventEx'## get the .Net View object of the EventManager (used for getting the event Category) $viewEventMgr = Get-View EventManager ## get some VIEvents, select a few properties, including a calculated property for EventCategory Get-VIEvent | Select FullFormattedMessage, CreatedTime, @{n="EventCategory"; e={$strThisEventType = $_.GetType().Name; ($viewEventMgr.Description.EventInfo | ?{$_.Key -eq $strThisEventType}).Category}}
    

    It becomes VIEvents (the last 100, because I did not specify the parameter - MaxSamples) and returns the properties of data.  The calculated "EventCategory" property uses the type of the VIEvent object to search for in the collection of items EventDescriptionEventDetail in ownership eventInfo found in .net object View for the EventManager.  He then grabs the 'Category' of the corresponding element of EventDescriptionEventDetail property.

    Works fine unless you have any VIEvents type "EventEx" - then, this 'research' in EventDescriptionEventDetail collection method fails, because there is more than one element of this type (there are 91 of them at the moment).

    This led me to the next bit.  It is similar to the previous method, but it handles EventEx events too:

    ## get the .Net View object of the EventManager (used for getting the event Category)$viewEventMgr = Get-View EventManager
    
    ## get some VIEvents (the last 100, as "-MaxSamples" is not specified) Get-VIEvent | %{    ## put the pipeline varible into another variable; get its type    $oThisEvent = $_; $strThisEventType = $_.GetType().Name    ## if this event is of type "EventEx"    if ($strThisEventType -eq "EventEx") {        $strEventTypeId = $oThisEvent.EventTypeId;        ## get the EventInfo item (of type EventDescriptionEventDetail) whose "FullFormat" property begins with the EventTypeId of the VIEvent at hand, and get its "Category" property        $strCategory = ($viewEventMgr.Description.EventInfo | ?{$strRegexPattern = "^$strEventTypeId\|.*"; $_.FullFormat -match $strRegexPattern}).Category    } ## end if     ## else, can just grab the EventInfo item whose "Key" is the same as this event's type    else {$strCategory = ($viewEventMgr.Description.EventInfo | ?{$_.Key -eq $strThisEventType}).Category}    ## add a NoteProperty "EventCategory" to this event    $oThisEvent | Add-Member -MemberType NoteProperty -Name EventCategory -Value $strCategory -PassThru} | Select FullFormattedMessage, CreatedTime, EventCategory
    

    It seems that the EventTypeId of the event returned by Get-VIEvent is included in the first part of the property FullFormat of elements EventDescriptionEventDetail with EventEx key, separate from the rest of the value by a vertical pipe.  Thus, the EventTypeId of the VIEvents can be used to make a match on EventEx of events .net EventManager View object types to get the event 'category' (info, warning, error, user).

    You can, of course, change the Select statements to choice/choose the pieces of information you want to export and then export to a file of data as you please.

    How does do for you?

    * The message has been edited by mattboren on April 5, 2011 - added line at the beginning of the second piece of code '$viewEventMgr = Get-view event Manager.  It was already in the first room and assumes that the user has run the two parts in the same session, but added for completeness.

  • How to get the page change event?

    Hello.

    I know that get changed event document as ISignalMgr-> GetServiceID of CResponder::Respond.

    But how to get the event page?  average of the event's page add, delete, etc...

    Thank you.

    Hi K159,.

    You can spy on the InDesign debug Test/Spy/SpyPreferences menu for the observer notifications. Can add or remove a page and to analyze the output of the spy.

    On the kDocBoss, there is an interface IPageList form you can get the number of pages.

    Markus

  • How to get the global coordinates of the mouse of a scene?

    Hi guys,.

    I want to connect a node to the global coordinates of the mouse position. I tried several things, but not more than work as expected:

    1. APPROACH 1: setting a property onMouseMoved to the scene:

    ----
    scene.onMouseMovedProperty () .set (new EventHandler < MouseEvent > () {}
    @Override
    public void handle(MouseEvent me) {}
    stepDropper.setTranslateX (me.getSceneX () + 20);
    stepDropper.setTranslateY (me.getSceneY () + 20);
    }
    });
    ---

    This seems to work very well, but when the mouse is on a control node things are stripped: the node stops moving (I guess it's because control node that consumes the event)



    2. APPROACH 2: Adding a glass on top of the stage to listen because there onMouseMovedProperty() - this should prevent controls consume the event
    The problem is that when I add a knot of Rectangle glassPane on top of the stage, each node below becomes inactive (do not respond to events). As I know the blockMouse property that used to be in JavaFX 1.3 went because each default node spread events. Why the senior (rectangle) node glassPane blocks for the underlying nodes mouse events?

    Hello
    controls using mouse events, as they spread the scene. You must register an event-filter event filters are called during the capture/tunneling, which precedes the propagation phase, so filters get the events before that any manager of may consume.

    Just replace
    scene.onMouseMovedProperty () .set (new EventHandler() {}

    by
    scene.addEventFilter (MouseEvent.MOUSE_MOVED, new EventHandler() {}

    Pavel

  • How to get the select button event Radio in my co

    Hello

    I want to get the the radio button selection event in my co, how do I get the event?

    Hello

    841475 wrote:
    I want to get the the radio button selection event in my co, how do I get the event?

    -There is no case of option button.
    -you need to explicitily set the event for the option button.

    Action: FirePaatialAction
    Event: RadioEvent

    -Discover the event in co by code below:

    If ("RadioEvent". Equals (PageContext.GetParameter (EVENT_PARAM)))
    {
    -In the case of a radio button. :))
    }

    Concerning
    Meher Irk

Maybe you are looking for

  • How to backup my iphone

    I have an iPhone 6 and I wanted to update my IOS 9.3.2 software. iTunes told me that I have to support my phone to continue. I clicked 'save', after a few minutes, the sign has come: "iTunes could not saved the iPhone... because iPhone disconnected",

  • Satellite M70: RAM upgrade

    My laptop only has 512 MB and a Crucial Scan, said the following: Currently installed memory:512 MBDDR PC2-5200VACUUM Memory each slot can hold DDR2 PC2-4200, DDR2 PC2-5300 with a maximum of 1 GB per slot.* Yes, after looking on the ebuyer page: http

  • Lenovo Ideapad y480 CPU overheating with Windows 8

    I just decided to switch to windows 8! I love the new OS, but there seems to be some driver problem with my installation. I reinstalled the operating system three times, and I get the same result. The system seems to work at highert CPU temperatures.

  • Virtualized temporary Internet Files eat up disk space. How can I stop this?

    Have encountered a problem of memory on my C drive and the holding of all recommendations usual cleaning only manages to free a few hundred MB. My hard drive is partitioned into a C and an E drive (each with 116 GB). I use Vista and Internet Explorer

  • Laptop using Windows Vista Buisness cannot change domain password

    My laptop using Windows Vista business can't change password is field - the error message is "username or password is incorrect." I can connect to the network very well. Other users have tried to change their passwords on my laptop and have the same