Dynamically adding listeners

Hi,
I have a problem with defining some dynamic buttons in my Swing application. I could have posted it on the Swing forum, but it's actually an 'inner class' scoping problem, so I figured I'd best post it here:
I want to do something like this:
String[] buttons = getButtonNames(); // array of buttons
for (int i=0; i<buttons.length; i++)
JButton jButton = new JButton();
// give each dynamically added button its own actionlistener
jButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
performAction(buttons);
jButton.setText(buttons[i]);
buttonPanel.add(jButton, null);
This won't work. ('must be declared final blabla'..)
But I can't declare both buttons and i final, since i will be modified in the loop. So I guess using buttons[i] like this is not possible.
How can I accomplish this?
(If you think this should've been posted in the Swing forum, regardless of my reason for posting it here, please say so, and I'll repost it there.)
Greetings,
Ivo

Well,
it's actually a multitier application, and the client does not know anything about the buttons other than the name. It needs to call some function on the middle tier and pass what button was clicked. I'd rather not to it statically by predefining the listeners, since that would require a change and a rebuild of my client when I add a new buttontype to the middle tier.
Anyone know how to do it dynamically?
Greetings,
Ivo

Similar Messages

  • Dynamic adding of components (doesn't work when programmatically)

    Hi, I don't understand, why this doesn't work. I'll explain it on this example:
    import java.util.concurrent.ScheduledThreadPoolExecutor;
    import java.util.concurrent.TimeUnit;
    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    public class NewFXMain extends Application {
        Group root;
        public static void main(String[] args) {
            Application.launch(NewFXMain.class, args);
        @Override
        public void start(Stage primaryStage) {
            primaryStage.setTitle("Hello World");
            root = new Group();
            Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
            Button btn = new Button();
            btn.setLayoutX(100);
            btn.setLayoutY(80);
            btn.setText("Add button now");
            btn.setOnAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                    addButton();
            root.getChildren().add(btn);  
            primaryStage.setScene(scene);
            primaryStage.setVisible(true);
            System.err.println("Number of buttons before: "+root.getChildren().size());
            ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
            executor.schedule(new MyTask(), 5, TimeUnit.SECONDS);
        private void addButton() {
            System.err.println("Button adding");
            root.getChildren().add(new Button("YEAH"));
            System.err.println("Number of buttons after: "+root.getChildren().size());
        class MyTask implements Runnable {
            public void run() {
                addButton();
    }There are two ways how a new button can be added. Either by clicking on existing button or programmatically by the program itself after 5 seconds.
    If you add it by button, there is no problem. The error print is:
    Number of buttons before: 1
    Button adding
    Number of buttons after: 2
    But if you just wait, then the error print is:
    Number of buttons before: 1
    Button adding
    and no button is added. In fact, the error printing after the adding isn't performed either.
    I'd like to ask if there is some solution for this because I'd love to do some changes by schedulers. Thx
    Edited by: 876949 on 14.8.2011 9:09
    Edited by: 876949 on 14.8.2011 9:11

    No, these are not error messages, they are just for purpose of example. Here it doesn't matter whether err or out... (yes, 'out' would be better ;)
    But thanx, it's working. By the way, I am creating scheduler for task lists. They are supposed to be printed dynamically in specific time (or periodically). For example: at 5 o'clock I need to print 5 items of some list and every 3 hours I need to print 3 items of another list etc. - so it's quite dynamic with regard to component adding (No, I don't want to use some sort of ListView, I want interactive printing: one item on screen at a moment). I'll try to work your solution into my code.
    Edit: So either it's not possible to use this for the purpose of my app or it will be really cumbersome. Maybe it would be easier to draw some rectangles with mouse listeners...
    Edit: So I finally got around it. In the end, I won't use dynamic adding as intended. It's working and that's important.
    Edited by: 876949 on 14.8.2011 12:48
    Edited by: 876949 on 15.8.2011 5:21

  • Why data are not getting poulated in dynamically added tab in a tab navigator???

    Hi All,
    I am facing a very strange problem and need you expert opinion on this. Ok so the problem goes like this:
    In my application i have a tab navigator where i have 2 fixed tabs say tab A and tab B. In tab B I have a data grid where All the user name are getting populated. Once the user clicks on any datagrid row i am dynamically adding a new tab based on username , so if in my datagrid u1,u2 and u3 are getting displayed then once you clik on u1 a new tab called u1 is getting displayed. Code for this goes like this:
    var vbox1: VBox= new VBox();
    box1.label=mydatagrid.selectedItem.uName;
    var sde:* = new searchDetails();
    vbox1.addChild(sde);
    myTabnavigator.addChild(vBox1);
    Application.application.searchdetails.displayall();
    I have created a component called searchDetails where i have designed the page wit various fields for this tab.This also has a method called displayall() which is populating the data in all fields using php an my sql where i have designed the page wit various fields for this tab.
    New tab is getting displayed perfectly. My problem is once the tab is getting displayed fields are not getting populated with data.
    Please let me know what wrong i am doing. I am really struggling

    Hmm.. you have to assign text to the labelfields on creation complete not before that, the fllow will be like this
    var vbox1: VBox= new VBox();
    var sde:* = new searchDetails();
    vbox1.addEventListener(creationcompleteevent,function);
    vbox1.addChild(sde);
    myTabnavigator.addChild(vBox1);
    function(e:event):void{
    box1.label = "text";

  • Reading the Data from dynamically added rows of a table...

    Hi,
                  I am using adobe interactive form (WD ABAP) in which i am adding the table rows dynamically (using Jscript code).  I have to fech these data into an internal table. But I can read only the first row data..
                  Also While adding rows dynamically the same data is repeating for the consecutive rows..
                  I have found many similar posts in sdn, but i cannot get the solution. They have mentioned about adding in WDDOINIT method. Can anyone explain me what should be done,..?
    1) How to solve repeatative data while adding rows..?
    2) How to read dynamically added row data during runtime into internal table..?
    Thanks,
    Surya.

    Discussed @ SDN lot of time before. Have a look at any of below threads:-
    Dynamic table in interactive form...
    Make dynamic tables in Adobe Interactive forms
    Adding Rows dynamically upon clicking the button
    How to get values to WebDynpro ABAP from dynamic table?
    Chintan

  • Dynamically adding to PDF after applying Extended Reader Rights

    All,
         I've created a PDF with a digital signature in Acrobat X Pro and applied the extended Reader rights. What I am trying (and failing) to do now is add new pages to the PDF via a Java library (BFO) on a server. When a user eventually brings up the PDF in Reader, they receive a warning about how the extended rights have been revoked since the PDF has been modified. Is there any way to maintain the rights while building the PDFs? Or is the only way to dynamically build a PDF with a digital signature that can be user-signed in Reader through the LiveCycle/ADEP services?

    You have to prepare the PDF BEFORE you add the extended Rights.  Once it's been rights enabled, you can't modify it w/o breaking the rights.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Mon, 14 Nov 2011 14:32:38 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Dynamically adding to PDF after applying Extended Reader Rights
    Dynamically adding to PDF after applying Extended Reader Rights
    created by j.ross.e<http://forums.adobe.com/people/j.ross.e> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4025497#4025497

  • Passing values to form bean string array from dynamic added textboxes

    Hi,
    I am unable to pass values to form bean string array from a jsp in which I have incorporated dynamically adding of textboxes in javascript.
    I have given add/delete row option in the jsp. If there is single row, this is working fine. But after adding a row, I am not able to either do any validations on added textboxes or pass the values to the String array form bean variable.
    code snippet:
    var cell6 = row.insertCell(4);
    var element5 = document.createElement("input");
    element5.type = "text";
    element5.className = "formtext1";
    element5.size = "5";
    element5.value = "00.00";
    element5.name= "qty"; // this is a string array of the form bean.
    element5.onchange=function() {checkNumeric(this);};
    cell6.appendChild(element5);
    <html:text styleClass="formtext1" property="qty" value="" size="5" styleId="qty" onchange="checkNumeric(this)"/></td>
    form bean declaration
    private String[] qty; Please help.
    Edited by: j2eefresher on Jan 12, 2010 11:23 PM

    Shivanand,
    There's no need to post that much code when you could create a very short test case that demonstrates only the problem you are having.
    You're using &NAME. notation on something that isn't a page or application item. You can't reference PL/SQL variables that way (or any other way) outside the PL/SQL scope. For your situation, you could create a page item named P55_DOCID and assign it a value in the PL/SQL process (:P55_DOCID := DOCID;), then reference &P55_DOCID. in HTML areas like the success message.
    Scott

  • Inconsistent prob when adding listeners to serial ports for sending AT cmds

    I have an app that sends and receives SMSs from two different cell phone carriers (lets say verizon and sprint by example).
    For that matter i have two cell phones, exactly the same model, one from each carrier, connected to the PC serial ports, COM, COM6 and COM7 being aware that they are available.
    -The application communicats with the phones through the a serial communication API and sending AT commands.
    -The application can send messages correctly from both phones within the same transaction, this is, i click in send message and the message is sent from both phones.
    The problem is when receiving, getting the SMS received by the phones:
    -When i have ONE phone connected to the PC it work properly for both phones.
    -When i have BOTH phones connected, only Carrier1 phone receives properly.
    When checking, i just find out that the problem rises when i try to add the listeners (see code comments below).
    When both phones connected there seems to be a problem that i cant figure out, and may be its a conceptual misunderstanding from me.
    I attach the code if you can help me,
    thank you,
    fernando
    // class fields
    private static String PORT_CARRIER1;
    private static String PORT_CARRIER2;
    private static CommPortIdentifier portId;
    private static Enumeration portsList;
    private static SerialPort carrier1SP;
    private static SerialPort carrier2SP;
    private static InputStream carrier1_input;
    private static InputStream carrier2_input;
    private static OutputStream carrier1_output;
    private static OutputStream carrier2_output;
    // ... all the code below is from the app method where everything is initializated     
    portsList = CommPortIdentifier.getPortIdentifiers();
    while(portsList.hasMoreElements()){
         portId = (CommPortIdentifier) portsList.nextElement();
         if(portId.getPortType() == CommPortIdentifier.PORT_SERIAL){          
              // try to open ports
              try{
                   if(portId.getName().equals(PORT_CARRIER1))
                        carrier1SP = (SerialPort) portId.open("SMS", 5000);
                   else if(portId.getName().equals(PORT_CARRIER2))
                        carrier2SP = (SerialPort) portId.open("SMS", 5000);
                   else System.out.println("Error " + portId.getName());
              }catch(PortInUseException piue){
                   System.out.println("Exception while opening serial ports: "+piue.getMessage());
                   continue;
              // try to open input streams
              try{
                   if(portId.getName().equals(PORT_CARRIER1))
                        carrier1_input = carrier1SP.getInputStream();
                   else if(portId.getName().equals(PORT_CARRIER2))
                        carrier2_input = carrier2SP.getInputStream();
              }catch(IOException ioe){
                   System.out.println("Exception while opening input streams: "+ioe.getMessage());
                   continue;
              // try to open output streams
              try{
                   if(portId.getName().equals(PORT_CARRIER1))
                        carrier1_output = carrier1SP.getOutputStream();
                   else if(portId.getName().equals(PORT_CARRIER2))
                        carrier2_output = carrier2SP.getOutputStream();
              }catch(IOException ioe){
                   System.out.println("Exception while opening output streams: "+ioe.getMessage());
                   continue;
              // adding listeners
              try{
                   if(portId.getName().equals(PORT_CARRIER1))
                        carrier1SP.addEventListener(new ListenerPuerto(this, carrier1_input, "CARRIER1"));
                   else if(portId.getName().equals(PORT_CARRIER2))
                        carrier2SP.addEventListener(new ListenerPuerto(this, carrier2_input, "CARRIER2"));
              }catch(TooManyListenersException tmle){
                   System.out.println("Error while adding listeners: " + tmle.getMessage());
                   continue;
              // Adding specific event to listeners
              if(portId.getName().equals(PORT_CARRIER1))
                   carrier1SP.notifyOnDataAvailable(true);
              else if(portId.getName().equals(PORT_CARRIER2))
                   carrier2SP.notifyOnDataAvailable(true);
              // Setting params to serial communication
              try{
                   if(portId.getName().equals(PORT_CARRIER1)){
                        carrier1SP.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                        carrier1 = true;
                   }else if(portId.getName().equals(PORT_CARRIER2)){
                        carrier2SP.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
                        carrier2 = true;
              }catch(UnsupportedCommOperationException uscoe){
                   System.out.println("Error while setting params for serial communication: " + uscoe.getMessage());
                   continue;
              // ... nothing else important ...thanks in advance

    Thinking of a java application as its what I am most
    comfortable with, but also thinking of having an
    apache server, and using jsp pages or servlets...
    because I hate formatting things in a java frame..
    have never quite mastered that! Any thoughts on what
    I should use?I'd prefer a Swing GUI for a maximum of controls. If you have any problems regarding layout, you can post concrete questions here (or even better: the Swing forum).
    And my main stumbling block would be how do I send
    signals to the green light from the computer? How do
    I get signals from the light beams to the computer?
    How do I use a serial port (for eg) from a java app.There's an additional library for serial I/O, it's named javax.comm ... should be downloadable somewhere on the java.sun.com site.

  • Add null rows in WDDOINIT  for fetching data from dynamically added rows..

    Hi,,
    I have to fetch data from a dynamically added rows of a table.
    I have followed / gone through many forums but they ddnot mention how to add null rows in the initialization method..
    I am using WD Abap..
    Can anyone help how to bind null rows in WDDOINIT method..?
    Thanks,
    Surya

    Discussed @ SDN lot of time before. Have a look at any of below threads:-
    Dynamic table in interactive form...
    Make dynamic tables in Adobe Interactive forms
    Adding Rows dynamically upon clicking the button
    How to get values to WebDynpro ABAP from dynamic table?
    Chintan

  • Dynamically adding more attributes to cube dimension in SSAS 2008 R2

    I need to dynamically add more attributes to cube dimension in SSAS 2008 R2 because the dimension table the cube is based on is updated using dynamic pivoting and there is need to update the cube dimension attributes as more columns are added to the dimension
    table without making the changes through BIDS. Is there a way to dynamically adding more attributes to cube dimension in SSAS 2008 R2?
    Thanks
    BI Developer

    Definitely. You can use AMO to add dimension attributes on the server. I have definitely done this a few times for different clients of mine. Here is a generic AMO sample:
    http://msftasprodsamples.codeplex.com/wikipage?title=SS2008%21Readme_AMOAdventureWorks&referringTitle=Home
    Notice the parts which add attributes to a dimension.
    http://artisconsulting.com/Blogs/GregGalloway

  • Dynamically adding a column to a jtable - simple & urgent

    I am new to using JTables.
    I have read the tutorial and looked at several examples, but I am still confused as to how to add/remove columns and how to add rows to the table.
    I want to have a totally dynamic table which will allow me to add/remove columns and to add rows.
    The table gets the data to be displayed (and the column header values) from an outside object. I thought about writing my own table model.
    Here is the code for my simple table model:
    import javax.swing.table.*;
    import java.util.Vector;
    public class MyTableModel extends AbstractTableModel{
       private Vector columnHeaders;
       private Vector data;
       // simple constructor
       public MyTableModel() {
          columnHeaders = new Vector();
          data = new Vector();  // data is a vector of vectors
       public int getColumnCount() {
          return columnHeaders.size();
       public int getRowCount() {
          if (data.size() == 0) {
              return 0;
          Vector columnData = (Vector)data.elementAt(0);
          return columnData.size();
       public Object getValueAt(int row, int column) {
          Vector columnData = (Vector)data.elementAt(column);
          return columnData.elementAt(row);
       // the method I call for dynamically adding a new empty column
       public void addNewEmptyColumn(String value) {
           columnHeaders.add(value);
           fireTableStructureChanged();
    }Here is how I use the table model with my table
    import javax.swing.*;
    public class Demo extends JFrame{
        private JTable table;
        public Demo() {
            super("test");
            table = new JTable(new MyTableModel());
            getContentPane().add(table);
            pack();
            show();
        public void addColumn(String value) {
            MyTableModel model = (MyTableModel)table.getModel();
            model.addNewEmptyColumn(value);
        public static void main(String[] args) {
            Demo demo = new Demo();
            // here I am trying to add columns...
            demo.addColumn("one");
            demo.addColumn("two");
    }I try to add columns, but nothing happens!!!
    What am I doing wrong?
    I would appreciate if someone who take himself/herslef to be a JTable expert could give me his/her e-mail and this way I won't bother the rest of the world with my stupid JTable questions...
    Sincerely
    Nir

    I have another question.
    What if I want to render the table headers in a certain way.
    I would like to use:
    TableColumn's setHeaderRenderer(TableCellRenderer headerRenderer).
    But in order to do it, I need to get a TableColumn.
    How do I get it from the model?
    I thought about subclassing JTable and overriding:
    public void tableChanged(TableModelEvent e)that function is called everytime I invoke fireTableStructureChanged().
    In that function, I am assuming that a column has been added, however, when I query for JTable's getColumnCount(), I keep getting 0!

  • Achieve the tab order for dynamically added section

    Hi friends,
    I'm facing the issue with tab order.
    How to achieve the tab order for dynamically added sections?
    Could you Plaese suggest me in this.
    Thanks,
    Susila S

    Hi,
    Thanks for your reply.
    Ya. I'm adding rows in a table dynamically which is grouped in a subform which is flowable and the buttons are placed in the same subform. At the end of the row I'm having the hidden fields.
    So what I want is without focusing the tab on hidden field I want to traverse the first field of the next dynamic row. For that I have used the access property as protected on hidden field, but its not working properly.
    Please help me on this ASAP.

  • How to reference a dynamically added field

    I'm trying to set the value of a field that was dynamically added as part of a table section and I can't figure out how.
    The table section is added by clicking on a button and that works just fine. I can access any field value in the table section that has the instance '0'. But I can't seem to figure out how to access field values from any other instances of this table section.
    Here's the hierarchy of one of the fields:
    TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection.Row8.dteFormedD ateDevMem
    Where 'MemberSection' is the section of rows the button will add an instance of. Now, I can access the value of the date field for the first instance of 'MemberSection' with the following:
    DeveloperIdentityTbl.MemberSection.Row8.dteFormedDateDevMem.rawValue
    If I want to do the same thing say for the 3rd instance of the 'MemberSection', how would I do that?
    Thanks for the help!!
    Marc

    Hi,
    WhyIsThisMe is correct. You must reference the instance of the repeating 'MemberSection' by its index. Otherwise (as you have found) it defaults to the 1st instance.  Sounds easy, right? Well...
    Truth be told, this will depend on the scripting language you have chosen. The actual refernce syntax used for formCalc and javaScript is considerably different.
    WhyIsThisMe's reference:
         TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[2].Row8.dteFor medDateDevMem
    should work for formCalc, but it won't for javaScript. For that you would need to use resolveNode()
    var indx = 2;  // you probably will be selecting a differnt row under different circumstances, right? So, assign the index value to a variable
    or instead
    var indx = 0;
    if(condition){indx= 2;}
    else if(condition){indx= 3;}  //you get the idea
    //then you would do the assigning the value using resolveNode() by building the string that goes inside the ():
    xfa.resolveNode("TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSectio n[" + indx + "].Row8.dteFormedDateDevMem").rawValue  
    //you're building a string in javaScript, so the + is used. There are 3 parts to the final string for the resolveNode().   finalString = "part1" + indx + "part3"
    ////////////////////////////////////////////  Still with me?  I usually opt for formCalc when referencing instances, since it is generally more forgiving
    // In formCalc, 1st assign an index value to variable.
    var indx = 0;
    if(condition)then
         indx= 2
    elseif(condition)then
         indx= 3   //you get the idea
    endif
    // then, use that variable to reference the instance of 'MemberSection'  //resolveNode() not needed in formCalc
    TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[indx].Row8.dteF ormedDateDevMem
    Good luck!
    Stephen

  • Design problem with dynamically added row in datatable

    Hello all,
    I have a dataTable and have developped a method that dynamically adds rows to the dataTable. Each row is made up of two form controls. The problem I have now is that I don't know how to retrieve the values from the mutiple rows. Ideally I would need the values to be stored into a list.
    Can anyone help?
    Thanks in advance,
    Julien.
    Here is my code:
    <h:dataTable var="line" binding="#{TradeClientsAndQuantitiesBean.clientsAndQuantities}"  value="#{TradeClientsAndQuantitiesBean.listOfMiddleFormHelpers}">
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="S�lectionnez un client"/>
                    </f:facet>
                    <h:selectOneMenu value="#{TradeClientsAndQuantitiesHelperBean.selectedClientTemp}">
                        <f:selectItems value="#{TradeClientsAndQuantitiesHelperBean.concatenatedLabelMap}"/>
                    </h:selectOneMenu>
                </h:column>   
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Renseignez une quantit�"/>
                    </f:facet>
                    <h:inputText value=""/>
                </h:column>   
            </h:dataTable>

    The values will just be put in the same row object you added to TradeClientsAndQuantitiesBean.listOfMiddleFormHelpers.
    It might be worth to read this article: http://balusc.xs4all.nl/srv/dev-jep-dat.html

  • Adding listeners for instances on other frames

    I'm trying to create a very standard menu, the type where there are links on each page that links to each other. So far I've put each menu page on a separate frame (total around 35 frames), and each link as its own instance/class. Originally I planned to create an array containing all the links like this:
    var menuLinks:Array =
                                //Main menu - frame 1
                                menuRightSide.newStoryLink,
                                menuRightSide.continueStoryLink,
                                menuRightSide.selectChapterLink,
                                menuRightSide.optionsLink,
                                menuRightSide.charactersLink,
                                menuRightSide.aboutLink,
                                //chapters menu - frame 2
                                menuRightSide.chapter1,
                                menuRightSide.chapter2,
                                menuRightSide.chapter3,
                                menuRightSide.chapter4,
                                menuRightSide.chapter5,
                                //characters - frame 3
                                menuRightSide.char1,
                                menuRightSide.char2,
                                menuRightSide.char3,
                                menuRightSide.char4,
                                menuRightSide.char5,
                                menuRightSide.char6,
                                //options - frame 4
                                menuRightSide.languageLink,
                                menuRightSide.costumeLink,
                                //function links - these exist on MULTIPLE frames/pages, eg options, characters, chapters all have backToMainLink
                                menuRightSide.backToMainLink,
                                menuRightSide.backToCharLink,
                                menuRightSide.backToOptionsLink,
                                menuRightSide.backToCostumeLink,
                                ]; //create array of links for menus
                currentPage = "main_menu";
                for each (var links:MovieClip in menuLinks)
                    links.buttonMode = true; //set links to behave like button
                    links.mouseChildren = false; //mouse over does not affect this instance's children
                    links.addEventListener(MouseEvent.ROLL_OVER, onOver);
                    links.addEventListener(MouseEvent.ROLL_OUT, onOut);
                    links.addEventListener(MouseEvent.CLICK, onClick);
                function onOver(e:MouseEvent):void //apply glow to every link
                    TweenMax.to(e.target, 1, {glowFilter:{color:0xFFFFFF, alpha:1, blurX:10, blurY:10}}); //glow effect
                function onOut(e:MouseEvent):void //remove glow on link on mouse out
                    TweenMax.to(e.target, 1, {glowFilter:{color:0xFFFFFF, alpha:0, blurX:0, blurY:0, remove:true}}); //remove glow
                function onClick(e:MouseEvent):void
                    currentPage = e.target.name;
                    if (e.target.name == "newStoryLink") { //if click newStoryLink
                        delegate.beginStory();
                    } else if (e.target.name == "optionsLink") { //if click optionsLink
                        TweenLite.to(menuRightSide, 0.2, {alpha:0, onComplete:menuRightSide.gotoAndStop, onCompleteParams:[45]}); //go to frame 45, options screen
                        TweenLite.to(menuRightSide, 0.2, {alpha:1, delay:0.2});
                    } else if (e.target.name == "charactersLink") { //if click charactersLink
                        TweenLite.to(menuRightSide, 0.2, {alpha:0, onComplete:menuRightSide.gotoAndStop, onCompleteParams:[10]}); //go to frame 10, char screen
                        TweenLite.to(menuRightSide, 0.2, {alpha:1, delay:0.2});
                    } else if (e.target.name == "aboutLink") { //if click aboutLink
                        TweenLite.to(menuRightSide, 0.2, {alpha:0, onComplete:menuRightSide.gotoAndStop, onCompleteParams:[180]}); //go to frame 180, about screen
                        TweenLite.to(menuRightSide, 0.2, {alpha:1, delay:0.2});
    Basically adding listener for every link, then simply telling AS what to do when I click the link regardless of what page I'm currently on.
    However the problem is I realized listeners can't be added for links that exist on other frames other than frame 1, because they're null I think until AS flips to that frame.
    So does anyone have an idea on how I should code this? Another challenge is some links (the ones at the bottom of the array) exist on MULTIPLE frames, but perform the exact same thing regardless of which page it was clicked on.
    Thanks.

    I arranged them on separate frames because that way I know exactly what's on each page. If I simply list out all the links on one frame, then it gets extremely messy visually.
    So if I want to add listeners on other frames, how would I do that? I know the pseudo-code:
    on frame 1:
    for (each link on frame 1) {
    link.addEventListener()
    on frame 2:
    for (each link on frame 2) {
    link.addEventListener()
    ... etc
    function onClick(e:MouseEvent):void
                    currentPage = e.target.name;
                    if (e.target.name == "newStoryLink") {
                        delegate.beginStory();
                    } else if (e.target.name == "continueStoryLink") {
                        //do something else

  • Dynamically adding JRE for IE, Java Security Warnings, & Next Gen Plugin.

    I wrote an portal application to control the environment for a third party application, the portal uses a JRE version that I supply with it, this was to ensure that users are using the same JRE so any issues can be limited to one version of Java. The only piece of the application that I could not specify the JRE version and path was for Internet Explorer. Please keep in mind that I do not control when the system JRE is updated or not, this is pushed to our systems and the latest JRE would be enabled automatically. I wanted to be able to dynamically add and enable the version of the JRE that Microsoft Internet Explorer uses for applets. So I was digging around recently and if I have the next-generation plugin enabled I could programmatically update the deployment.properties file prior to launching Internet Explorer(assuming I have closed all prior instances of IE that were running) to add and enable a version of the JRE which I choose to use. When I launch IE and run an applet I see that it is using the JRE I had dynamically supplied. However everytime I run the applet a Java security warning comes up saying "The application requires an earlier version of Java", I wanted to suppress this message but after research I tried adding 'deployment.security.mixcode=HIDE_RUN' to the deployment.properties, that did not work. I tried disabling the Next Generation Plugin, that worked to suppress the message however internet explorer was no longer using my dynamically supplied JRE for applets in IE, so that was not going to work for my purposes. My questions are:
    1. Is there a reliable way(not using ssvagent) to programmatically enable and disable Java's Next Generation Plugin option? (I want to make sure it is enabled when launching third party application from the portal)
    2. Is there a programmatic way to suppress the Java Security Warning "The application requires an earlier version of Java", without disabling Java's Next Generation Plugin option?
    deployment.properties entries after addition of my jre entry:
    #deployment.properties
    #Fri Sep 28 14:09:24 PDT 2012
    deployment.javapi.lifecycle.exception=true
    deployment.trace=true
    deployment.javaws.viewer.bounds=323,144,720,360
    deployment.javaws.autodownload=NEVER
    deployment.version=6.0
    deployment.browser.path=C\:\\Program Files (x86)\\Internet Explorer\\iexplore.exe
    deployment.security.mixcode=HIDE_RUN
    deployment.log=true
    deployment.console.startup.mode=SHOW
    deployment.capture.mime.types=true
    #Java Deployment jre's
    #Fri Sep 28 14:09:24 PDT 2012
    deployment.javaws.jre.0.registered=true
    deployment.javaws.jre.0.platform=1.6
    deployment.javaws.jre.0.osname=Windows
    deployment.javaws.jre.0.path=C\:\\Program Files (x86)\\Java\\jre6\\bin\\javaw.exe
    deployment.javaws.jre.0.product=1.6.0_33
    deployment.javaws.jre.0.osarch=x86
    deployment.javaws.jre.0.location=http\://java.sun.com/products/autodl/j2se
    deployment.javaws.jre.0.enabled=false
    deployment.javaws.jre.0.args=
    deployment.javaws.jre.1.enabled=true
    deployment.javaws.jre.1.registered=true
    deployment.javaws.jre.1.osname=Windows
    deployment.javaws.jre.1.location=http\\\://java.sun.com/products/autodl/j2se
    deployment.javaws.jre.1.osarch=x86
    deployment.javaws.jre.1.path=C\:\\Portal\\dist\\java\\jre6\\bin\\javaw.exe
    deployment.javaws.jre.1.platform=1.6
    deployment.javaws.jre.1.product=1.6.0_29
    Note: The reason not to use most recent version of Java is the necessity to test the third party application prior to deployment of a new Java version and since I do not control when a new version of Java is deployed and enabled to our machines, I am required to find an transparent solution. I understand the security issues by doing so, but the time between testing and acceptance of a new Java version for our application is within an acceptable timeframe. On exiting the application, I would restore the JRE settings and restore previous settings, to minimize the exposure of a potential security risk. Also any manual configurations are trying to be avoided as to maintain transparency to the user.

    I'm having a similar problem and I think it is related with this.
    If, after a Java--->Javascript call, a Javascript--->Java call isn't made soon after the first, it works. But, if the Java--->Javascript call triggers a Javascript--->Java call, any Java--->Javascript call that is made after that doesn't reach Javascript :/
    I have a method that handles the Java--->Javascript calls and goes something like this:
    System.out.println("Calling Javascript...");
    JSObject win = JSObject.getWindow(this);
    win.call(jsEventHandler, new Object[] { json.toString() });
    System.out.println("Done.");I further found out that, after looking at the Java debug console in the scenario where a Java--->Javascript call triggers a Javascript--->Java call, only after this last method returns is the "Done" message printed, even though the respective Javascript call was already invoked.
    Could you explain in more detail the queue based solution you found? Any other ideas?
    Regards,
    Andr&eacute; Tavares.

Maybe you are looking for

  • Change Button text during component use of WDR_SELECT_OPTIONS

    Hello, I have implemented a WD component (WD for ABAP) by making use of component WDR_SELECT_OPTIONS. The selection screen is getting displayed. But the selection screen contains the button Copy, Check, Cancel and Reset. I want to rename the button t

  • IPhone video button not working

    It snowed in Houston two days ago and I tried to take a video of it on my IPhone 4. I kept pushing on the video button but nothing worked. I found an IPad discussion that said if you had upgraded to OS7 then you needed to slide up and down. Well that

  • Reconciliation of a BW and R3 data

    Hi All, Please help me for this. Please provide me R/3 standard Table detail which are link with the BW standard cube. So i can do reconciliation of the data. Regards, Zubs

  • Sales order with a minus-signs

    Hi Experts, I am trying to creat a sales order in SCM 5.0 with the '/SAPAPO/SJKTST04' program, but this is generated (and shown in the Planning Book (/SAPAPO/SNP94)) with a minus-sign, that should not be so. Someone pleas help me with this! Thanks a

  • Linking to a folder in InDesign - is that possible?

    I need to link to a folder in InDesign - is that possible? I can only find options to link to files. It would be cool if it was also possible to have the folder open up. (the case in question is a link to a folder containing photos - I do not want to