Question of optimization: 1 handler for multiple events or 1 Manager by the event?

Something I can't decide, simply because I'm not sure what would be most effective.

Example: I have a few menus, each with a handful of icons click on (say a total of 10 objects that can be clicked on).

Would it not be better to have 1 stage.addEventListener (MouseEvent.MOUSE_DOWN, clickHandler); with 10 if (e.target.name == "nameX") who is called on each click.

Or would it be better to have 10 separate objectX.addEventListener (MouseEvent.MOUSE_DOWN, clickHandlerX); for each menu item that can be clicked?

I suppose my confusion comes from not knowing what a listener does exactly, it uses all the resources I look for an event?

(added)

After typing all this, a good comparison would be closer to an event listener is nothing else than a way to call a function and is not otherwise using resources?

My question is still, but I'm leaning towards several Auditors and managers.

(add 2)

Sorry my brain blurs, I'm not good at explaining things.  I think it's a little clearer.

For 1 menu I 1 this.addEventListener, and in the Manager, he has several if (menu_itemX.name == "nameX").
It is better to have 1 eventListener in this situation, or would it be better to have several menu_itemX.addEventListener and managers separated for each action?

(follow-up question)

I did addEventListener when the menu opens and removeEventListener when the menu closes.  If the event listeners do not use 'no' resources unless their event fires is a bad practice for simple click and mouseover events mouseout/mouseouthandler()?  Should I just leave the event listeners here all the time?

(sample code)

If this makes it more clear which of these would work better?

Version 1:

this.menu1.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler1);
this.menu2.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler2);
this.menu3.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler3);
this.menu4.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler4);
this.menu5.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler5);

function clickHandler1(e:Event):void{}
function clickHandler2(e:Event):void{}
function clickHandler3(e:Event):void{}
function clickHandler4(e:Event):void{}
function clickHandler5(e:Event):void{}

version 2:

this.addEventListener(MouseEvent.MOUSE_DOWN, clickHandler);

function clickhandler(e:Event):void{
if(e.target.name == "menu1"){}
else if(e.target.name == "menu2"){}
else if(e.target.name == "menu3"){}
else if(e.target.name == "menu4"){}
else if(e.target.name == "menu5"){}
}

the leave it alone as long as your menu works as expected while adding them.

leaving the listener takes memory.  removing it frees this memory.

but free up memory and adding memory uses system resources, especially when free memory flash gc.  It is unnecessary to repeatedly the gc objects that will be added to memory later.

Tags: Adobe Animate

Similar Questions

  • is it possible to save the Office XP for multiple monitors and restore after using the laptop in mobile mode?

    Is it possible to save the Office XP for multiple monitors and restore after using the laptop in mobile mode?

    Hi Kenelms,

    You can follow this link & check if it helps.

    HOW to: Set up hardware profiles for laptop computers in Windows XP

    Hope the helps of information.

    Please post back and we do know.

  • Is it possible to get the adobe software CC on a disk for multiple installations instead of download from the internet?

    Is it possible to get the adobe software CC on a disk for multiple installations instead of download from the internet?

    You can download the installation direct offline files:

    http://prodesigntools.com/Adobe-CC-2014-direct-download-links.html

  • Question of culture and guide for multiple images.

    I'm trying to create recurring landmarks for about 100 images all need to be cropped and balanced for web use.

    At present, all the images are the same size, but need to be cropped to a specific size for the web. The output dimensions are 465px x 349px, but all the images are of another product. I am trying crop for a "balanced" feeling because the images are clicked well and for that I am trying to create a guide that is displayed on the screen that I reduce the image so I can have a point centered but also equal the top and the bottom of the space.

    I tried to create an action to be executed before the harvest, but it is not all the help that I reduce the image and it is not "resize" himself once the image is cropped.

    Any suggestions on what I am doing wrong? I use Photoshop 6 on MacOS.

    Thank you in advance.

    In this case, it should be fairly easy to create an action that you can batch.

    You start with a picture of trim.  The white space around the products should be prepared as to the limits of products,

    Then, you use a picture Fit to resize the products to fit a space smaller than 465x349px something like 460x344px.

    Use size canvas 465x349px then leave the anchor at the center of all the products must be centered in the Web of white 465x349px and sane size approx.

  • Adobe handler will not update. The Manager displays the updates but won't go further. What could be wrong?

    my adobe handler will not update. Adobe manager displays the updates but won't go further. What could be wrong? There is nothing wrong with my computer, although there may be a setting that needs to change, but I'm guessing.

    Try direct updates

    https://www.Adobe.com/downloads/updates/

    updates CC:
    http://prodesigntools.com/Adobe-CC-updates-direct-links-Windows.html
    http://prodesigntools.com/Adobe-CC-updates-direct-links-Mac.html

    CC updates of 2014:
    http://prodesigntools.com/Adobe-CC-2014-updates-links-Windows.html
    http://prodesigntools.com/Adobe-CC-2014-updates-links-Mac.html

    CC updates to 2015:
    http://prodesigntools.com/Adobe-CC-2015-updates-links-Windows.html
    http://prodesigntools.com/Adobe-CC-2015-updates-links-Mac.html

  • The event handlers for multiple displays involving data SUBMIT and GET

    Hello

    We have a requirement as below:

    Note: cannot share the details accurate screen customer etc. because of the limitations of data security

    For example

    (1) 1 screen.

    Please enter the employee ID you want to recover data for

    (2) 2nd screen-

    Now, based on input that the user gives on the first screen that EMP_ID, we want to retrieve the details of a DB(not to worry as the DB connection part is taken care of) Native and display on-screen in the respective attributes.

    After that the user sees the correct details on the 2nd screen, they can go ahead and edit the details and which must be submitted to the DB.

    Queries:

    (1) we tried to use different managers and - OnSessionCreatedEventHandler, OnSubmitDataEventHandler - but what happens is the OnSessionCreatedEventHandler not get entry into the 1st screen, because it (i.e. OnSessionCreatedEventHandler) is triggered immediately after the loading of the 1st screen.

    The handleEvent() for the OnSessionCreatedEventHandler method has a piece of hibernate code base that requires the EMP_ID as input to run the query. So when the 1st screen itself is loaded, the event handler fails to get the emp_id entered by the user, because it is not yet approved in the session, finally throw an exception to put into hibernation.

    (2) is it possible, we could use an EventHandler or combination of these, to capture the data entered on the 1st screen and commit in the session, so that the 2nd screen can take this value from the session and then extract the DB.

    Any help would be much appreciated.

    The real scenario involves a lot of complex business rules and hibernate activity as well, but now those who have been supported.

    Hello

    You can implement an OnBeforeSubmitData handler that does something like the following:

    Look in the data presented for the user name attribute and if necessary

    Call your Hibernate utility to search for additional data

    Add additional data to the data sent

    During your 1st screen send the related data will be submitted with it.

    An alternative would be to have the user enter their Id in a Java screen, maybe a kind of servlet filter to make a pseudo login and then add user for query parameters identification and redirect to the URL standard OWD. You can write a plugin Manager OnRequest to retrieve the id of the user, looking for seeds and additional data before the session thanks to this data.

    Maybe there are also other possibilities, and it would be a shame not to use the OPA to manage maintenance and business rules.

    Concerning

    Ian

  • Trouble finding a place for my event handler

    I'm a newbie on my first work programme. I'm trying to teach myself JavaFX by creating a program simple Tic-Tac-Toe. I created an AnchorPane to hold the TIC-TAC-TOE grid which consists of 4 Cree-crossing lines that have been created in the JavaFX scene generator. There are 2 horizontal and 2 vertical lines. In the Java program, I loaded my FXML file and my TIC-TAC-TOE grid looks great. I created 9 ImageView that match 9 of TIC-TAC-TOE squares. I load those with x.jpg or o.jpg images. Those that work very well and I can see them on my network manually.

    I can't find out how to make them appear if I click in one of the squares. I created a rectangle and is the same color as the grid and without border and place in the center square. I put a fx:id = "MMR" (medium-medium rectangle) and an onMouseClicked = "#handleRMM" in the FXML file.

    I created an event handler, and I know it's because I put System.out.println ("Clicked!"); and I can see it on the NetBeans console. But the rest of the event to display the X does not appear.

    I can't get to work in the main part public class handler extends Application of the program. But the AnchorPane, my ImageViews and everything is defined in part public void start (primaryStage stage) of the program. For this purpose, I can not access the ImageViews to the event handler. I will list my code, and I hope someone can tell me what I'm doing wrong. Thanks in advance.

    David
    package tictactoe;
     
     
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javafx.application.Application;
    import javafx.fxml.FXML;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.*;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.AnchorPane;
    import javafx.stage.Stage;
     
    /**
     *
     * @author David
     */
    public class Main extends Application {
     
        
        /**
         * @param args the command line arguments
         */
        public void main(String[] args) {
            Application.launch(Main.class, (java.lang.String[])null);
        }
     
        @Override
        public void start(Stage primaryStage) {
            
            
            try {
                            
               
                AnchorPane page = (AnchorPane) FXMLLoader.load(Main.class.getResource("TicTacToe.fxml"));
                Scene scene = new Scene(page);
                
                primaryStage.setScene(scene);
                scene.getStylesheets().add("tictactoe/tictactoe.css");
                primaryStage.setTitle("TicTacToe");
                ImageView mm =new ImageView();//Middle Middle
                final ImageView lt =new ImageView();//Left Top
                final ImageView lm =new ImageView();//Left Middle
                final ImageView lb =new ImageView();//Left Bottom
                final ImageView tm =new ImageView();//Top Middle
                final ImageView bm =new ImageView();//Bottom Middle
                final ImageView rt =new ImageView();//Right Top
                final ImageView rm =new ImageView();//Right Middle
                ImageView rb =new ImageView();//Right Bottom
                //mm.setImage(new Image("tictactoe/images/x.jpg"));
               
                //page.getChildren().add(mm);
                
                mm.relocate(246,145); mm.setFitWidth(100); mm.setFitHeight(100);
                lt.relocate(107,35);
                lm.relocate(107,145);
                lb.relocate(107,260);
                tm.relocate(246,35);
                bm.relocate(246,260);
                rt.relocate(375,35);
                rm.relocate(375,145);
                rb.relocate(375,260);
                
                page.getChildren().add(mm);
                //page.getChildren().remove(mm);
                page.getChildren().add(lt);
                page.getChildren().add(lm);
                page.getChildren().add(lb);
                page.getChildren().add(tm);
                page.getChildren().add(bm);
                page.getChildren().add(rt);
                page.getChildren().add(rm);
                page.getChildren().add(rb);
            
                primaryStage.show();  
                
            
            }
               
                                 
         
            
            catch (Exception ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                        }
                
        
        }
    
         
        public void handleRMM() {
            
           ImageView mm =new ImageView();
            mm.relocate(246,145); mm.setFitWidth(100); mm.setFitHeight(100);
            mm.setImage(new Image("tictactoe/images/x.jpg"));
            
            System.out.println("Clicked!");
        }
        
    }
    and my FXML file:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.image.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.shape.*?>
    <?scenebuilder-stylesheet tictactoe.css?>
    
    <AnchorPane id="AnchorPane" fx:id="anchor" prefHeight="400.0" prefWidth="600.0" style="" xmlns:fx="http://javafx.com/fxml" fx:controller="tictactoe.Main">
      <children>
        <Line endX="100.0" endY="1.0" layoutX="15.0" layoutY="125.0" startX="450.0" startY="1.0" />
        <Line endX="100.0" endY="0.0" layoutX="15.0" layoutY="250.0" startX="450.0" startY="0.0" />
        <Line endX="-100.0" endY="-125.0" layoutX="301.0" layoutY="158.0" startX="-102.0" startY="180.0" />
        <Line endX="-100.0" endY="-125.0" layoutX="465.0" layoutY="163.0" startX="-100.0" startY="180.0" />
        <Rectangle id="rlt" fx:id="rmm" arcHeight="5.0" arcWidth="5.0" fill="WHITE" height="122.50001525878906" layoutX="202.0" layoutY="127.0" onMouseClicked="#handleRMM" stroke="WHITE" strokeType="INSIDE" width="163.4998779296875" />
      </children>
    </AnchorPane>

    Just my $0.02 worth.

    Any interactive game is a starting point quite complex. The logic of a game is quite complex (even if it's a really simple game). TIC-TAC-TOE, you'll not only to deal with the mouse click but you need a way to tell if it's a valid move (i.e. If the place is not already busy). Is not difficult in itself, but you need to know where to keep the underlying data to this logic, and really data (State of play) must be independent of the display of the game: in short, at a certain level, you will need to understand the model-view-controller architecture.

    Now you are at the stage where you're still trying to understand the syntax of the language, and you have little chance to learn than just trying codes and post on the forums. Of course, you can look at other resources too and there are more resources for learning Java I can possibly list, but perhaps Oracle's Java tutorial [url http://docs.oracle.com/javase/tutorial/java/index.html] would be a good starting point. Understand the first three chapters or so meets immediate syntax issues you encounter.

    If you have other references, Kathy Sierra "head first Java" and "Thinking in Java" Bruce Eckel are the ones who always get good customers.

  • Question asked by today on adobe connect event

    Hello

    I have been struck off the coast of the event today by my own mistake and did not get to hear the answers to my questions. If anyone can answer here, it would be great!

    The speaker should use the chat vs. Q & A if you have a large audience. Please define in numbers a wide audience. My Webinars for e-Learning will be a host and an instructor. I'm new to webinars.

    The speaker talked about resolution of the screen of the person in a double room on the screen. He also spoke of the resolution of the graphics inside your PPT. Please help me with the guidance on these 2 points.

    Thank you!

    Susan

    I would use the Q & A pod any time you're dealing with a group that is larger than you can handle dealing with issues in real time in the chat module. For some this may be 3, others may be 20, but there is no defined number where you use one against the other. Simply determine which is best for you in a given situation and use. For smaller interactive sessions, I use the Chat pod. For sessions where I will give lectures and then answer the questions, I use the Q & A pod. It is not necessarily on the number of people present for me.

    As for the size of the graphic in your PPT deck. Just use the graphs that correspond to the slide. Inserting an image which is 2 to 4 times the size of slide, then it towards the bottom do not change the file size of the image, so you end up with a huge addition to your slides, all for a small image. So, you can use the image in PPT optimization feature (I don't remember what it's called), or use another photo editing tool to resize your images before inserting it into the TPP.

    My 2 c.

  • multiple messages from several loops in the structure of the event

    Hey guys,.

    I have two questions, first of all, what is the best way to receive messages in case of structure? I've been watching the user events, and which seems to be a good option if I want to never send a single message. Ive never found an example where the regester for events has a second event its looking. I currently use queues to the structure of the event to my other loops.

    My second question is I want to even send messages to the structure of the event, my current thinking is that it would make things easier to follow if the structure of the event sent all messages to the individual lines. Is it more appropriate to have just a loop of talk directly to one another through the queues already in place?

    IM thinking ill put in place a user for handlng errors event but I'm not sure on other messages.

    Thank you guys

    You can get events for individual events. Better yet, you can use clusters to group the different events and access them individually (see below).

  • Active Directory - join the domain for multiple devices

    Hi all

    I need your expertise to advice me how join domain for multiple devices.

    Currently my organization have more than 10,000 computers are made up of Windows XP, 7, 8 and 10.

    We will deploy new Active Directory server in the data center.

    Currently, we plan to go every computer/devices to perform a field joints. This method will take much time to complete the 10,000 devices.

    is there another method to do this?

    is there a method that all devices will join automatically field when it is connected to the corporate network.

    Thank you.

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • Is it possible to set up for multiple users on the same computer to avoid entering the e-mail and the password

    Original title: Multi users

    Is it possible to set up for multiple users on the same computer to avoid entering the email and password every time that a new user want to check emails?

    Hello

    Welcome to the community forums of Microsoft and thanks for posting the question. According to the description, you need help in the creation of multiple user accounts. I've surely you will help find a solution on the issue.

    What is the operating system installed on the computer?

    User accounts, several people can easily share a single computer. Each person can have a separate user account with unique settings and preferences, such as a screen saver or desktop background. User accounts control files and programs users can access and what types of changes users can make to the computer. As a general rule, you'll want to create standard accounts for most computer users.

    If you use Windows Vista or Windows 7, see the article below:

    Create a user account

    http://Windows.Microsoft.com/en-in/Windows7/create-a-user-account

    http://Windows.Microsoft.com/en-in/Windows-Vista/create-a-user-account

    For Windows XP users:

    How to create and configure user accounts in Windows XP

    http://support.Microsoft.com/kb/279783?WA=wsignin1.0

    Hope this information helps. Answer please if you have more queries about Windows.

  • The plug-in for multiple clients

    Y at - he gave a plugin for multiple access to the client in an environment?

    For example:

    I have 50 clients to access the data on the server.

    I'm doing a layer of connection manual socket to manage the database reads and inserts?

    Or y at - it a way to connect directly to the environment of the clients to the server?

    It is unclear in your question what database you're talking about.   Berkeley DB is an embedded database and not a client server database.  It doesn't have a client plugin.

    Thank you

    Mike

  • Message from host Infrastructure for NSX event Messages

    Recently, I noticed several messages of "Criticism" in the event handler for the NSX. Here's the event:

    Severity: critical

    Event source: Messaging host Infrastructure

    Code: 391002

    Event message: messaging infrastructure down on the host.

    Module: Messaging Infrastructure.

    Object name: host-16

    Now, here's the thing... There is no host-16 in my vCenter. There is a host-16, which was removed a few months ago. I was only able to find after checking an older RVTools report. What can I do to remove this prevents to continue to log on?

    Hey Ray, I wanted to just inform you on the issue. I opened a ticket with VMware support, and immediately he thought it was because of an obsolete host object in the database due to a host of vCenter before uninstalling NSX. We checked on the vCenter database, as well as the browser from the CROWD and confirmed that the host did not exist. Also, interesting to note that the NSX Manager also has its own separate database of vCenter. You must file in root on Manager mode via the CLI with a special password that the support engineer. He was pretty sure that we would find the subject here... but we do not have.

    After reviewing the log files, it turns out that his original hypothesis was true that errors have been removed because of a host before uninstalling NSX. He said that it is a bug in 6.2.0, which has been dealt with in 6.2.1. Shows the date of issue:

    NSX logging of failures of heartbeat for guests who are not part of the installation of NSX
    When a host prepared for the NSX is taken directly from vCenter inventory (without first cancelling its preparation in NSX), NSX receives a DCN 'Connected host' unexpected that causes a partial removal of the components of the infrastructure of the mail host. So, the e-mail between NSX and the host link can remain active when it should have been removed, and NSX can raise SystemEvents fake "Alert" for the host. This has been fixed in 6.2.1 NSX.

    He said: mistakes are purely cosmetic, so no need to spend immediately. I like things to be nice and neat so, so I will seek in get the upgrade completed soon.

  • What is the best way to create a form on my page layout of Muse for an event where the person is able to register and pay for the event using Business Catalyst?

    I need to create a Web site for a conference and I need to be able to have participants at the same time register you for the event on the website, but also paid for the event.  What is the best way to do it?  I am brand new to Business Catalyst and of course the customer must site upward and yesterday running.  So, if I could find quick assistance to implement it quickly, I would be very happy!

    Thank you!

    Hello

    Please take a look at these tutorials,

    Customizations made for the events module

    Let the site visitors sign up for an event

    Once configured, you can add modules in Muse and publish business catalyst. As shown in this article

    Add features of Business Catalyst to your Muse sites

    Easily add Business Catalyst modules to your Adobe Muse Web sites.

    Let me know if you have any question.

  • Support for multiple video cards under ESX

    Hi all

    I was wondering how ESX would handle several video cards I try to virtualize our test network and need to have different virtual machines for separate monitors. I couldn't see any info on ESX and video drivers and I was wondering if, as the core ESX is a put to update the Linux kernel, it would just a matter of installing relevant video drivers to Linux according to a normal Linux installation.

    Thank you

    Martin.

    The vmkernel making virtualization and is, in essence, the operating system of your ESX is code written by vmware - where the origin of a component of the version of ESX - the ocnfusion service which is used to manage and control your ESX - the server console console service is essentially a virtual machine running a modified version of Linux RHEL 3 - now go back to your original question ESX does not supports several video cards , or you can access the Virtual Machines directly from the ESX Server. You must use a workstation running the VI Client - the VI Client is how you access your virtual machine providing access to the running virtual machine. You can access several simultaneousky of virtual machines running from a single workstation.

    If you find this or any other answer useful please consider awarding points marking the answer correct or useful

Maybe you are looking for