Reassign button listeners problem...

I have a multilanguage site. I have a combo box that allows the user to change the language if the default system language isn't what they want to browse by. The site's button are added to the stage and then listeners are applies. When the language is changed, I'm removing the buttons and listeners and reassigning a new button to the old object and readding the listeners. However the listeners don't work, everything else is fine. I cannot figure out how to readd the listeners.
Here's my code:I'll only use one button to keep it simple
var products_btn;
// after the language is determine it adds the appropriate button from the library to the stage as the button object
products_btn = new EnProductsBTN();
  layer_3.addChild(products_btn);
  products_btn.name = "products_btn";
  products_btn.x = 255;
  products_btn.y = 544;
  products_btn.alpha = 0;
// then i add the listeners by calling the setUpButtons function
var mainButtons:Array = new Array();
mainButtons = [
      {label:products_btn, link:'/products/', cover:"quarter"}
function setUpButtons():void{
for(var i:Number = 0; i < mainButtons.length; i++){
  var thisMC:MovieClip = mainButtons[i].label as MovieClip;
  var thisLink:String = mainButtons[i].link;
  var thisCover:String = mainButtons[i].cover;
  thisMC.addEventListener(MouseEvent.MOUSE_OVER,btnOver);
  thisMC.addEventListener(MouseEvent.MOUSE_OUT,btnOut);
  thisMC.addEventListener(MouseEvent.CLICK,buttonPressed);
  thisMC.buttonMode = true;
  thisMC.deepLink = thisLink;
  thisMC.cover = thisCover;
// when the combo box is chaged to say spanish the buttons and listeners are removed in a function and then
// it adds the new button to the button object
products_btn = new EsProductsBTN();
  layer_3.addChild(products_btn);
  products_btn.name = "products_btn";
  products_btn.x = 255;
  products_btn.y = 544;
  products_btn.alpha = 0;
// that places the new button on stage just fine and then i call the setUpButtons function again and it doesn't work.
Why?

unless you're calling setUpButtons every time you create a new button, you should use:
var mainButtons:Array = new Array();
var products_btn;
// after the language is determine it adds the appropriate button from the library to the stage as the button object
products_btn = new EnProductsBTN();
  layer_3.addChild(products_btn);
  products_btn.name = "products_btn";
  products_btn.x = 255;
  products_btn.y = 544;
  products_btn.alpha = 0;
mainButtons.push({label:products_btn, link:'/products/', cover:"quarter"});
function setUpButtons():void{
for(var i:Number = 0; i < mainButtons.length; i++){
  var thisMC:MovieClip = mainButtons[i].label as MovieClip;
  var thisLink:String = mainButtons[i].link;
  var thisCover:String = mainButtons[i].cover;
  thisMC.addEventListener(MouseEvent.MOUSE_OVER,btnOver);
  thisMC.addEventListener(MouseEvent.MOUSE_OUT,btnOut);
  thisMC.addEventListener(MouseEvent.CLICK,buttonPressed);
  thisMC.buttonMode = true;
  thisMC.deepLink = thisLink;
  thisMC.cover = thisCover;
// when the combo box is chaged to say spanish the buttons and listeners are removed in a function and then
// it adds the new button to the button object
products_btn = new EsProductsBTN();
  layer_3.addChild(products_btn);
  products_btn.name = "products_btn";
  products_btn.x = 255;
  products_btn.y = 544;
  products_btn.alpha = 0;
// that places the new button on stage just fine and then i call the setUpButtons function again and it doesn't work.
Why?

Similar Messages

  • REASSIGN button

    hello
    I am in need of creating a custom reassign button with ROLES for only Full Time Employees
    please advice
    kp

    unless you're calling setUpButtons every time you create a new button, you should use:
    var mainButtons:Array = new Array();
    var products_btn;
    // after the language is determine it adds the appropriate button from the library to the stage as the button object
    products_btn = new EnProductsBTN();
      layer_3.addChild(products_btn);
      products_btn.name = "products_btn";
      products_btn.x = 255;
      products_btn.y = 544;
      products_btn.alpha = 0;
    mainButtons.push({label:products_btn, link:'/products/', cover:"quarter"});
    function setUpButtons():void{
    for(var i:Number = 0; i < mainButtons.length; i++){
      var thisMC:MovieClip = mainButtons[i].label as MovieClip;
      var thisLink:String = mainButtons[i].link;
      var thisCover:String = mainButtons[i].cover;
      thisMC.addEventListener(MouseEvent.MOUSE_OVER,btnOver);
      thisMC.addEventListener(MouseEvent.MOUSE_OUT,btnOut);
      thisMC.addEventListener(MouseEvent.CLICK,buttonPressed);
      thisMC.buttonMode = true;
      thisMC.deepLink = thisLink;
      thisMC.cover = thisCover;
    // when the combo box is chaged to say spanish the buttons and listeners are removed in a function and then
    // it adds the new button to the button object
    products_btn = new EsProductsBTN();
      layer_3.addChild(products_btn);
      products_btn.name = "products_btn";
      products_btn.x = 255;
      products_btn.y = 544;
      products_btn.alpha = 0;
    // that places the new button on stage just fine and then i call the setUpButtons function again and it doesn't work.
    Why?

  • IOS 6.1.3 WIFI button disable problem on iPhone4S - It is definitely a BUG

    Hi Apple Fans
    I have a full house of Apple products from iPhone -> iPAD -> iPod -> Mac -> AirPort, and I am suffering from WIFI button disable problem after upgrade to iOS 6.1.3, without any clue after calling Apple Support, factory reset and reload iPhone for more than 10 times.  I also try all tips on Apple Support Communicties except put it into a freezer, still no any luck.  Apple Support suggests that my iPhone may be factly!
    Tonight, I can get my WIFI back in below sequence:
    1. Switch to English language from Chinese
    2. Turn Cellular Data Option to off
    3. Reset Network Setting
    After the phone reset, the WIFI row show 'Not Connected', and I can select my home WIFI (Airport Express) without trouble.  To prove my finding is workable to all case, can you try the same and update here if it works for you?
    Good Luck!
    PS: I always believe it is a BUG.

    Hi,
    I sympathise with you as my iPhone 4s is 7 months old and is also greyed out.  I tried everthing except the potentially stupid one of putting the iphone in a freezer!  I took the phone back to the vendor who sent it away and repaired it.  But alas after a month it is greyed out again.  I have again returned to the vendor and he will repair it again.  I asked him how and he told me it is a software conflict and he has to spend around 9 hours downloading a patch repair.  Apple are aware of this issue and I feel completely let down because they have not posted a fix on the net.  Presently I am living and working in Dubai, back in the UK I am sure my iPhone would have been exchanged for a new one.  I need my iPhone for my work and cannot afford to just buy a new one so I have been let down and despite for years being a supporter of Apple and their products I shall think twice before investing in any more Apple products.

  • Standard button image problem

    Hi,
    I've got a problem when I try to set Image to the button from standard components.. I can set it up, but than I didn't see the image in the browser.
    With the button from basic components there is everything working fine, unfortunately I need that component from standard.. any advice?
    thx.

    Hi,
    I've got a problem when I try to set Image to the button from standard
    components.. I can set it up, but than I didn't see the image in the browser.
    With the button from basic components there is everything working fine,
    unfortunately I need that component from standard.. any advice?
    thx.Standard button has problems with images due to a JSF issue. To work around the issue, remove leading / from the buttons image property and re-deploy. This should cause the standard button image to display correctly.
    Hope it helps,
    Lark

  • Can we change the name of reassign button in sharepoint 2010 approval workflow?

    can we change the name of reassign button in sharepoint 2010 approval workflow?
    Shazil Ali

    Yes, we can change it. Steps are as follows: 1. Create the workflow in SharePoint Designer 2010 2. Use Start Approval Process action 3. Write your logic and all setting as per you requirement and then publish the workflow once. 4. After this, click on
    the workflow name and there you will see the sections as Workflow Information, Customization, Settings, Start Options, Forms. Here you will see a form under Forms section with a name of Approval_x00....... with a type "Task". Click on this form. This form
    is an Infopath form that opens up when a task is to be edited (Task Form). This form will open up in Infopath (provided you have Infopath installed on your system) It may ask you the crendentials for security. 5. The task form will open up in Infopath for
    editing. Click on the Reasign button and in the top left corner in the ribbon section is the field (Label) having text as "Reassign Task". Change this and then save and publish the form.Publish the workflow once again.

  • How to Hide Reassign Button for the External Users

    Hi All,
    We have some notifications sent to the Oustide Suppliers, In those Notifications we are haveing 3 buttons displayes (Yes/No/Reasign).
    Based on the Previous posts regd the same subject, I checked the Notification Attribute '#HIDE_REASSIGN' , it was already set to 'Y'. Changed to B and tested but same result,
    These users do not ahve any responsbilities except for one Supplier Responsibility.
    Can you pls help me on this issue.
    Regards,
    Sridhar

    Hi Srini,
    Thanks for the Immediate Response, I reviwed the Maetalink Note which you suggested, it was stated as:
    Starting from ATG_PG.H.Rollup 4, an enhancement has been made to the Notification Details screen.
    When the user viewing the notification has been granted the Workflow Administrator privilege (through the WF_ADMIN_ROLE preference), then the Reassign button will always be visible, even when the message attribute #HIDE_REASSIGN is set to Y.
    This allows Administrators to reassign any notification when necessary in exception cases.
    But in my case, the user do not have the Workflow Administrator privilege. He was not assigned with any workflow Admin Resps. Is there anything I am missing to check the WF_ADMIN_ROLE preference for a particular user?
    Regards,
    Sridhar

  • Facing duplicate button press problem.

    Hi,
    I am a beginner to JSF technology. I am working on a project that uses JSF 1.1 specification. I am facing "*duplicate button press problem*". Most of the links and submit buttons do not respond. With a lot of search I found that this problem was fixed in JSF 1.2.
    I want to know whether upgrading to JSF 1.2 will work or not ? Also will it require code changes in existing code or simply upgrade will do?
    - Sax

    I'm not sure why you are focused on 1.1 vs 1.2 on this issue. For both versions you need the POST-REDIRECT-GET pattern, facilitated by the <redirect/> directive in the navigation rules.

  • How to hide REASSIGN Button for PO Requisition Approval Notification only

    Hello,
    I have a requirement in which I have to HIDE the REASSIGN button from the PO Requisition Approval Notification page. I realized that this page(NotifDetailsPG.xml) is being used by Sourcing Module too for sending the Approval Notifications. So I cannot directly set the Rendered Property to False for this as this would hide the REASSIGN button in Sourcing Approval Notification too.
    So, how do I hide the REASSIGN button from the Notification page only if the Page is being used as PO Requisition Approval Notification? Can I use SPEL command in this case? Can somebody help me with this issue?
    Thanks
    Sunny
    Edited by: user13369509 on May 16, 2011 7:39 AM

    Hi Srini,
    Thanks for the Immediate Response, I reviwed the Maetalink Note which you suggested, it was stated as:
    Starting from ATG_PG.H.Rollup 4, an enhancement has been made to the Notification Details screen.
    When the user viewing the notification has been granted the Workflow Administrator privilege (through the WF_ADMIN_ROLE preference), then the Reassign button will always be visible, even when the message attribute #HIDE_REASSIGN is set to Y.
    This allows Administrators to reassign any notification when necessary in exception cases.
    But in my case, the user do not have the Workflow Administrator privilege. He was not assigned with any workflow Admin Resps. Is there anything I am missing to check the WF_ADMIN_ROLE preference for a particular user?
    Regards,
    Sridhar

  • I want to Hide ok buttom and reassign button in notification page

    HI
    How to Hide ok button and reassign button in notification page using oracle workflow builder
    Thanks and regards
    ch sai vikram

    I do not believe you can achieve this using WF Builder - you will instead need to use OAF Personalization. See these MOS Docs for examples
    727315.1 - How To Do the Personalization on the Salary Page (Hide CORRECT Button)
    758795.1 - How To Hide The Add Transaction List, Print And Recalculate Buttons Through Personalization?
    HTH
    Srini

  • TS3274 If my iPad home button got problem?

    If my iPad home button have problem but my iPad still under warranty can i use the warranty to take service for my iPad?

    Yes the home button problem would be covered by the warranty as long as you didn't do something accidentally to cause the home button to fail. If it is a hardware failure - it will be covered under the warranty.
    Is the home button no longer working? Have you tried to calibrate the home button?
    Calibrate the home button
    1. Open a stock iOS app, such as Contacts
    2. Press & hold the sleep/wake button at the top of your device until the red slider control appears.
    3. Immediately release the sleep/wake button and press & hold the home button. Hold until the red slider disappears.

  • IPhone 5 on off button having problem

    my iPhone 5 on off button having problem which sometimes i have to press several times, and sometimes i have to press it hard. Did anyone having the same problem here? beacause i just use for 5 months

    Take a Visit to an Apple Store or AASP (Authorized Apple Service Provider) and have the Device evaluated...
    Be sure to make an appointment first...

  • Simple button background problem

    Good day,
    I'm new to flex and MXML. I've gone through the initial difficulties of getting familiar with the IDE and programming language. Now that this is done, I'm really starting to enjoy it.
    I'm currently facing what is probably a basic problem. I've created an MXML Button component. When I instanciate it somewhere in another component, it comes up with a weird square background under my button, like this :
    My button is a single line component, like this :
    <s:Button label="Measure" skinClass="skins.MeasureDistanceSkin" width="70" height="25" click="OnClick(event);" creationComplete="Init(event);" />
    My button instanciation line looks like this :
    <MeasureButton map="{map}" left="110" top="42" width="80" height="33" id="MyButton" />
    Can anyone give me a hand with this?
    Thanks,
    Bruno

    You couldn't have made trillions of buttons that work using that code in AS3.  It would have to be something more like the following to work in AS3...
    stop();
    btn_page2.addEventListener(MouseEvent.CLICK, gotoPage2);
    function gotoPage2(e:MouseEvent):void {
         gotoAndPlay(99);
    Switched places in the btn_page2 line and changed Void (AS2) to void (AS3)

  • Not the end of the world, multi button mouse problem.

    Hi there, I have a Microsoft multi button mouse which works fine in Leopard. I have configured 2 of the buttons for Command+H (Hide), and Command+W (Close). The buttons work fine everywhere except one place, and that's System Preferences.
    I have added a custom configuration for System Prefs, but that doesn't seem to solve the problem either. It isn't the end of the world, but it would be nice if it did work.
    Thanks,
    Anil.

    Hi Topher,
    I am using the latest driver from Microsoft, and the mouse works fine everywhere else except System Prefs. I haven't tried USB Overdrive because the Microsoft driver has a very nice front end which makes configuring the mouse very easy.
    Thanks,
    Anil.

  • "duplicate button press" problem in jsf 1.1

    I think the problem come from "duplicate button press", when the users press the button several time, many request is generated, the sad is I don't have the source code of this page, I just have the source code which receive these request, what I want to do is just handle the first request from the button and ignore the other, is it possible?
    also, because I can't modify the problematic button page (I have not the source), so even I upgrade to jsf 1.2 is not useful, is it?
    thanks!!

    First, let me say that it is strange to try to solve this problem without being able to modify the source page. If this is a political or administrative restriction rather than a real technical limitation I suggest you push back on whomever has created this situation.
    The most effective method I can thing of would be to remove the state of the view from the session (assuming server side state saving) upon receiving the first request. This will cause the subsequent requests to fail. Although, this might not be the best due to timing issues. Also, keep in mind that the user will just see the error message, they will not get the results of the first request.
    So maybe a filter which intercepts the requests. It could perform duplicate detection by hashing all of the request parameters. You could even keep the responses around to resend. Oops, I've just re-invented HTTP caching; perhaps interjecting a product which already performs that role would be appropriate instead.

  • Cancel button weird problem

    im trying to program a game that works with JOptionPane, and ive come to this weird problem:
    this works fine but throws a null pointer exeption when i press the cancel button:
    if (e.getSource() == easy)     {
    do {
         word = JOptionPane.showInputDialog (x.create(1));
    result = "" + ((x.right(word)) ? "YOU GUESSED!" : "YOU MISSED!");
    JOptionPane.showMessageDialog (null, result);
    while (palabra != null);
    but when i try to catch the exeption:
    if (e.getSource() == easy)     {
    try {
    do
         word = JOptionPane.showInputDialog (x.create(1));
    result = "" + ((x.right(word)) ? "YOU GUESSED!" : "YOU MISSED!");
    JOptionPane.showMessageDialog (null, result);
    while (word != null);
    catch (NullPointerException no){}
    The weird thing happens:
    the first time i press cancel it works fine but if i press easy again and then cancel it just reloads the input dialog and if i press cancel again it works, but if i do easy again, this time i have to press cancel 4 times for it to work, and if i press easy again i need 8 cancel, then 16 and so on....
    i have no idea why this happens....
    can anybody give me some help?
    thank you.

    /* the error takes place when presing the cancel button
         to make this work press "press me first" and then activate me will show the
         window, presing cancel and then again activate me makes everithing worse */
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class sample     {
    static JButton neu = new JButton("Press Me!");
    JButton act = new JButton("Activate Me!");
    String word,result;
    public Component createComponents() {
    neu.setMnemonic('i');
    neu.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         act.addActionListener(this);
    if (e.getSource() == act)     {
            do
             word = JOptionPane.showInputDialog ("press cancel");
             result = "" + ((word.equals("cancel")) ? "yes!" : "cancel!!!");
             JOptionPane.showMessageDialog (null, result);
            while (word != null);
         JPanel pane = new JPanel();
            pane.setLayout(new GridLayout(0, 10));
         pane.add(act);
         return pane;
    public static void addComponentsToPane(Container newbie) {
    newbie.setLayout(new GridLayout(5,5,5,5));
    newbie.add(neu);
    private static void createAndShowGUI() {
            JFrame frame = new JFrame("Demo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            addComponentsToPane(frame.getContentPane());
            frame.pack();
            frame.setVisible(true);
    public static void main(String[] args) {
    try {                              
                UIManager.setLookAndFeel(
                    UIManager.getCrossPlatformLookAndFeelClassName());
            } catch (Exception e) { }
    JFrame frame = new JFrame("LETTERAMA");
            sample app = new sample();
            Component contents = app.createComponents();
            frame.getContentPane().add(contents, BorderLayout.CENTER);
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
          frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
           frame.pack();
            frame.setVisible(true);
    //ps. sorry for the horrible grids, i was kind of in a hurry

Maybe you are looking for