How to define the event listener AFTER_ACTIVATE for each document

Well, I want to be able to connect an AFTER_ACTIVATE event listener to any document that is created or opened. Is anyway to do this?

"update of certain variables"? You mean, like global variables in a persistent script?

I suggest that you could much better be architecting your script differently.

Maybe to have a global object that your script consults the active document, instead of using a global variable.

Or put your data inside the document with. insertLabel().

Global variables are generally a bad idea. In this case, it seems that you are trying to mimic the local scope by using event handlers, and this sounds a bit scary for me.

Tags: InDesign

Similar Questions

  • How to remove the event listener when all the MoviClip are out of the scene

    I am newbie to as3,

    I created the animation using as3 in which duplicate the circle ten times, then push in a table and giving random motion. When the double object goes outside of the scene so I should remove the event listener. But now when a duplicate object is going off the stage the event listener is removed. Thanks in advance

    use:

    -code to create the bubble random movement.

    var bubbleNo:Number = 10;

    var vx:Number is. 3;

    var vy:Number is. 5;

    bubbles var: Array = new Array();

    var bubbleRadius:Number = 9;

    var myColor:ColorTransform = this.transform.colorTransform;

    init();

    function init (): void {}

    for (var i: Number = 0; i

    bubble of var = new newBall();

    Bubble.x = Math.Random () * stage.stageWidth;

    Bubble.y = Math.Random () * stage.stageHeight;

    Bubbles.push (Bubble);

    myColor.color = Math.Random () * 0xFFFFFF

    bubble.transform.colorTransform = myColor;

    addChild (bubble);

    }

    addEventListener (Event.ENTER_FRAME, createBubble);

    }

    function createBubble(event:Event):void {}

    //

    for (var k: Number = bubbles.length - 1; k > 0; k-) {}

    var bubble = bubble [k];

    Bubble.x += vx;

    Bubble.y += vy;

    If (bubble.x - 18 > stage.stageWidth | bubble.x + 18 < 0 ="" ||="" bubble.y="" -="" 18=""> stage.stageHeight | bubble.y + 18)<>

    removeChild (bubble);

    Bubbles.splice (k, 1);

    }

    }

    if(Bubbles.Length == 0) {}

    removeBubble();

    }

    }

    function removeBubble (): void {}

    removeEventListener (Event.ENTER_FRAME, createBubble);

    }

  • How to define the rules of holiday for the purchase of the Oracle?

    Hi all

    How to define the rules of holiday in the Workflow administrator to a particular position?


    Please help me with the screenshots.


    Thanks in advance

    Responsibility: System Administrator

    Navigation: Administrator Workflow-> Administration

    Click on the link "rule of holiday.

  • How to assign the ID of group for each group in the SQL query.

    Hi all

    I want to assign the ID of group for each group (group ID of series). I tried with the row_number function but did not work for my requiredment. Here is my sample data and my requirement.

    Col1
    A
    A
    A
    A
    A
    B
    C
    D
    D
    D
    D
    E
    E
    E
    F
    G
    G
    G

    I want to get number of each column with ID group assign to it value. Here is my example output

    Col1 County Group ID
    A 5 1
    A 5 1
    A 5 1
    A 5 1
    A 5 1
    B 1 2
    C 1 3
    D 4 4
    D 4 4
    D 4 4
    D 4 4
    E 3 5
    E 3 5
    E 3 5
    F 1 6
    G 3 7
    G 3 7
    G 3 7

    Select col1, count (1) NTC (col1 partition).

    ROW_NUMBER() over (partition by col1 by col1 order) tbl_test grp_id.

    Please help me solve this problem.

    SELECT

    COL1,

    COUNT (*) ON MYCOUNT (COL1 PARTITION).

    DENSE_RANK () OVER (ORDER BY COL1) GROUPID

    Of

    T1;

  • How to find the first max value for each item

    Hello

    I have the me_result of the table as below,

    SELECT * FROM me_result;

    ID     ||| ELITE     ||||||||||| FREQ_ITEM | COMBINED_STR | SUP
    1     ||; 1; 10; 2; 3; 4; 5; 7; 8. 1     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    2     ||; 1; 10; 2; 3; 4; 5; 7; 8. 2     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    3     ||; 1; 10; 2; 3; 4; 5; 7; 8. 3     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    4     ||; 1; 10; 2; 3; 4; 5; 7; 8. 4     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    5     ||; 1; 10; 2; 3; 4; 5; 7; 8. 5     ||||||||||||||; 1; 10; 2; 3; 4; 5; 7; 8 ||| 2
    6     ||; 10; 2; 3; 4; 5; 8; 9. 1     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9; 1 ||| 1
    7     ||; 10; 2; 3; 4; 5; 8; 9. 2     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2
    8     ||; 10; 2; 3; 4; 5; 8; 9. 3     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2
    9     ||; 10; 2; 3; 4; 5; 8; 9. 4     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2
    10     ||; 10; 2; 3; 4; 5; 8; 9. 5     ||||||||||||||; 10; 2; 3; 4; 5; 8; 9 ||| 2


    I need to find the first COMBINED_STR max for each element of the ELITE,
    I mean, max value is the max REGEXP_COUNT (combined_str,' ;')))

    really, I try to write down, but I had a lot of values for each ELITE and I need only the first, that
    SELECT * from me_result
    WHERE (ELITE, REGEXP_COUNT (combined_str,' ;')))) IN
    (SELECT ELITE, MAX (REGEXP_COUNT (combined_str,' ;'))))) ME_RESULT ELITE GROUP);

    I need the result to be as below.

    1; 1; 10; 2; 3; 4; 5; 7; 8-1; 1; 10; 2; 3; 4; 5; 7; : p
    6; 10; 2; 3; 4; 5; 8; 9 1; 10; 2; 3; 4; 5; 8; 9; 1 1

    any help please,.

    Published by: user11309581 on July 10, 2011 22:03

    Can be

    with t as
    (select 1     ID, ';1;10;2;3;4;5;7;8'     ELITE, 1     FREQ_ITEM, ';1;10;2;3;4;5;7;8' COMBINED_STR, 2 SUP from dual union all
    select 2     ,';1;10;2;3;4;5;7;8'     ,2     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 3     ,';1;10;2;3;4;5;7;8'     ,3     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 4     ,';1;10;2;3;4;5;7;8'     ,4     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 5     ,';1;10;2;3;4;5;7;8'     ,5     ,';1;10;2;3;4;5;7;8'     ,2 from dual union all
    select 6     ,';10;2;3;4;5;8;9'     ,1     ,';10;2;3;4;5;8;9;1'     ,1 from dual union all
    select 7     ,';10;2;3;4;5;8;9'     ,2     ,';10;2;3;4;5;8;9'     ,2 from dual union all
    select 8     ,';10;2;3;4;5;8;9'     ,3     ,';10;2;3;4;5;8;9'     ,2 from dual union all
    select 9     ,';10;2;3;4;5;8;9'      ,4     ,';10;2;3;4;5;8;9'     ,2 from dual union all
    select 10     ,';10;2;3;4;5;8;9'     ,5     ,';10;2;3;4;5;8;9'     ,2 from dual
    )
    select ID,ELITE,FREQ_ITEM,COMBINED_STR,SUP
    from (
      SELECT ID,ELITE,FREQ_ITEM,COMBINED_STR,SUP, ROW_NUMBER() over (PARTITION BY ELITE order by id) RN
      FROM t
      WHERE (ELITE,REGEXP_COUNT(combined_str,';')) IN
        (SELECT ELITE,MAX(REGEXP_COUNT(combined_str,';')) FROM t GROUP BY ELITE)
    ) where RN=1
    order by id
    
    ID                     ELITE             FREQ_ITEM              COMBINED_STR      SUP
    ---------------------- ----------------- ---------------------- ----------------- ----------------------
    1                      ;1;10;2;3;4;5;7;8 1                      ;1;10;2;3;4;5;7;8 2
    6                      ;10;2;3;4;5;8;9   1                      ;10;2;3;4;5;8;9;1 1     
    
  • How to find the Maxima and Minima for each column of a 2D array?

    Hello

    I have a 2D chart and I would find the maxima and minima of each column of the 2-D table. Even though I know how to get maxima and minima for the whole picture but don't know how columnwise? Any ideas please?

    Thank you

    Rohit

    Hello

    @Smercurio-What you said is true, I should have shown using automatic indexing enabled which is really excellent choice. I just tried to show in a very simple way.

    Anyway, here's the best way

  • How to assign the different VTEP subnet for each grid of a group pool?

    The design guide NSX to use L3 access design, it is recommended to use the same number VLAN per rack, but with the other subnet

    10.66. < id rack >.0

    10.77. < id rack >.0

    10.88 < id rack >.0

    10.99 < id rack >.0

    If the client compute cluster spread on grids, then we will have a different subnet for each rack VTEP, something like (assuming that vlan 77 is for VTEP0

    < rack 1 > 10.77.1.1, 10.77.1.2, 10.77.1.3...

    < rack 2 > 10.77.2.1, 10.77.2.2, 10.77.2.3...

    During the preparation of the host, GUI invites you to assign VTEP for Pool DHCP/IP, looks like most of the cases we use Pool of IP, then for the compute cluster, how can assign us VTEP IP in a different subnet in a single group?

    Thank you

    Clarisse

    You have two options:

    (1) DHCP using support on every TOR address suggest you. This is the recommended approach

    (2) DHCP then changing manually the VMkernel interface IP address on each ESXi host to match the required subnet - this is not recommended because it is not automatic, but is still supported

  • How to define the event handler dynamically generates?

    Hi all

    Usually we add event like this:

    myCanvas.addEventListener ("click", onClick)

    How can I configure the second parameter so that I can add the Manager click dynamically?

    For example, I clickHandler1, clickHandler2 functions.

    And another variable fname: string will be contains value1, value2,...

    Thank you and best regards,

    If you read my post above and apply it to your specific situation, you should be able to solve it. The example I provided shows how to pass and call a function by name. If you already have a reference to the function, you can simply modify the string parameter and pass directly to the function.

    If you are still having problems getting this, please provide an example of what you're trying to do, we can show the solution in context.

  • How can change the bookmarks system wide for each new user?

    I wish that every new user who creates a count in a Debian linux system to achieve a specific set of bookmarks. I can't find where to put my custom bookmarks.html file to do this.

    Create a folder/defaults/profile in the Firefox installation folder and place a bookmarks.html file in this folder.

    This is the same folder of models for the new profiles that used in previous versions of Firefox, but all files that were there, then are now in archive omni.jar and the profiles folder in are no longer present.

  • How to get the status of data for each virtual [identify overprovisioning] computer store?

    Hi people,

    Could help me is it you please in the generation of report of VM and its data store location (data stocker store free space, size set up and operation). ?

    Ideally, it should be like this:

    The virtual computer name. Name of the data store. Size of the data store. Total configured data store size

    Thank you

    The following script adds the ProvisionedSpaceGB property to the output of the script of Luke:

    Get-VM | ForEach-Object {
      if ($_)
      {
        $vm = $_
        $vm | Get-Datastore | ForEach-Object {
          if ($_)
          {
            $Datastore = $_
            "" | Select-Object -Property @{N="VM name";E={$vm.Name}},
            @{N="ProvisionedSpaceGB";E={$vm.ProvisionedSpaceGB}},
            @{N="Datastore Name";E={$Datastore.Name}},
            @{N="Datastore Size (GB)";E={[Math]::Round($Datastore.CapacityMB/1KB,0)}},
            @{N="Datastore Total Provisioned size (GB)";E={[Math]::Round(($Datastore.CapacityMB-$Datastore.FreeSpaceMB)/1KB+$Datastore.ExtensionData.Summary.Uncommitted/1GB,0)}},
            @{N="Datastore Used Space (GB)";E={[Math]::Round(($Datastore.CapacityMB-$Datastore.FreeSpaceMB)/1KB,0)}}
          }
        }
      }
    }
    
  • Remove the event listener using as2

    Hello

    How to remove the event listener for the function below

    btn_0.onRelease = function() {}

    trace ("is clicked");

    }

    Thanks in advance

    Try: remove btn_0.onRelease;

  • How in fact blackberry event listener

    Hi, m havin a little doubt

    Cvent JDE listener how actually works?

    They keep listening in the background for the event

    OR

    When the event occurs, then the OS itself call all the event listener for this event?

    I think that he shud of same way java event listeners work:

    Follow the link

    http://www.JavaWorld.com/JavaWorld/javaqa/2000-08/01-QA-0804-events.html

  • 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

  • [noob] Help understand why the event listener continues even after the withdrawal.

    Hey again,

    I'll try to do my best to explain. I can get this to work properly, but I'd like to understand why what I did before was not working.

    I have a little trouble understanding why an event listener continues listening to even after that I delete it. I have a facility where a Parent MovieClip ("CampScene") is established and an event listener is added to the look for a function ("walkUpToCampfire") to see if a condition is true ("comingFromAx is true", that won't be true until later).

    If it is true, an animation plays, an event listener is added to see if the animation is made and if it's an event listener is added to listen for a click ("campScene.goToAx") to a new animation to play and other events. (It won't be true until later.)

    If this isn't true (which is the situation that I work with at the start), the event listener said listening for a click on "campScene.goToAx" is implemented immediately. The function following removes the event listener, so it is supposed to stop listening to a click and let an animation play throughout.

    The problem is a continuous click to be listened to and if you keep clicking on the reboot of animation every time, which is what I don't want to happen.

    --------------------------------------

    I'm able to resolve the problem by adding the line "campScene.removeEventListener (Event.ENTER_FRAME, walkUpToCampfire)"; or in mouseEnabled affecting false for "campScene.goToAx", but I try to understand what is happening.

    It is, even if I'm deleting the listener ("campScene.goToAx") in a function ("goToAxScene"), "campScene.addEventListener (Event.ENTER_FRAME, walkUpToCampfire)"; continues to wait for a mouse click, unless it is removed also?

    Again, I am trying to understand how it works.

    --------------------------------------

    This should be all ACEs. Of course, I would like to know if you need more information. (I can post the FLA / AS files if need be.)

    public void practice_adventure8() {}

    ...

    initial event listeners

    addEventListener (Event.ENTER_FRAME, CampScene);

    }

    public void CampScene(event:Event) {}

    remove the event listener
    removeEventListener (Event.ENTER_FRAME, CampScene);

    Add the first camp scene
    campScene.x = - 120;
    campScene.y = - 10;
    addChild (campScene);
    setChildIndex (campScene, 0);

    Add the event listener to see if guys works with camp fire or not
    campScene.addEventListener (Event.ENTER_FRAME, walkUpToCampfire);

    }

    IF RETURNING TO CAMPSCENE
    public void walkUpToCampfire(event:Event) {}

    If the guy is walking back to axe
    If (comingFromAx == true) {}

    event listeners
    campScene.guyAtCampScene.gotoAndPlay ("guyComingFromAx");
    campScene.addEventListener (Event.ENTER_FRAME, ifGuyDoneWalking);

    otherwise if initial creation
    } else {}

    remove the old event listener
    campScene.removeEventListener (Event.ENTER_FRAME, walkUpToCampfire);

    trace ("comingFromAx = false");
    event listeners
    campScene.addEventListener (Event.ENTER_FRAME, sceneHoverInfo);
    campScene.goToAx.addEventListener (MouseEvent.MOUSE_UP, goToAxScene);
    campScene.goToBridge.addEventListener (MouseEvent.MOUSE_UP, goToBridgeScene);
    }
    }

    IF RETURNING TO CAMPSCENE FACT
    public void ifGuyDoneWalking(event:Event) {}

    If the guy ended up in foot
    If (campScene.guyAtCampScene.currentLabel == "guyAtCampSceneNormal") {}

    reset the Boolean values of scene
    comingFromAx = false;

    Add event listeners
    campScene.addEventListener (Event.ENTER_FRAME, sceneHoverInfo);
    campScene.goToAx.addEventListener (MouseEvent.MOUSE_UP, goToAxScene);

    }
    }

    GET READY FOR THE NEW SCENE

    public void goToAxScene(event:MouseEvent) {}

    delete movement event listeners
    campScene.goToAx.removeEventListener (MouseEvent.MOUSE_UP, goToAxScene);


    stop all sounds

    SoundMixer.stopAll ();

    play the clip of guy walking to AxScene
    campScene.guyAtCampScene.gotoAndPlay ("guyGoingToAx");

    check the label to see if axScene must appear
    campScene.guyAtCampScene.addEventListener (Event.ENTER_FRAME, addScene);
    }

    Your best bet to solve why things happen is to make use of the trace function.  In this case, you may have a trace run every time this listener can addedand any time it is deleted.  In this way, you should be able to see if it was added in after he deleted.  If there are several places where it is added, then adjust your tracks to indicate which line is involved as well.

  • How to check the event.target type in the "if" statement

    Hi, I have "roll-over" event listener and I wish that only works with music videos (without textfields etc.). I would write something like this:

    if(Event.Target == MovieClip) {do something}

    else {do something}

    This does not work properly.

    How to check the event.target type in the "if"?

    Thanks for any help.

    :

    If (getQualifiedClassName (Event.Target) == 'flash. display::MovieClip') {do something}

    else {do something}

    .

Maybe you are looking for