4 Replies Latest reply on Jun 14, 2009 1:35 PM by kglad

    cs3 button problem

    dr reporter

      Have an issue with several buttons in cs3. I want the buttons to open the page in the same window, and they will once, but I need this to be a reoccuring effect.  here is the code. I love some help on this one.

       

       

      btn1.addEventListener(MouseEvent.CLICK,clickHandler1);
      btn2.addEventListener(MouseEvent.CLICK,clickHandler2);
      btn3.addEventListener(MouseEvent.CLICK,clickHandler3);
      btn4.addEventListener(MouseEvent.CLICK,clickHandler4);
      btn5.addEventListener(MouseEvent.CLICK,clickHandler5);
      btn6.addEventListener(MouseEvent.CLICK,clickHandler6);

       

      function clickHandler1(event:MouseEvent):void{
      navigateToURL(new URLRequest("http://www.heathfriar.com/websites"), "_self");
      }

       

      function clickHandler2(event:MouseEvent):void{
      navigateToURL(new URLRequest("http://www.heathfriar.com/videos"), "_self");
      }
      function clickHandler3(event:MouseEvent):void{
      navigateToURL(new URLRequest("http://www.heathfriar.com/advertising"), "_self");
      }
      function clickHandler4(event:MouseEvent):void{
      navigateToURL(new URLRequest("http://www.heathfriar.com/flash"), "_self");
      }

       

      function clickHandler5(event:MouseEvent):void{
      navigateToURL(new URLRequest("http://www.heathfriar.com/contacts"), "_self");
      }

       

      function clickHandler6(event:MouseEvent):void{
      navigateToURL(new URLRequest("http://www.heathfriar.com"), "_self");
      }

        • 1. Re: cs3 button problem
          kglad Adobe Community Professional & MVP

          because you're opening into the same browser instance, how can you even see any buttons after one's been clicked?

          • 2. Re: cs3 button problem
            dr reporter Level 1

            I don't think I'm following. I put the code on each button instance instead of an actions layer, But I'm still having the same effect. I'm pretty sure this is not what you mean by browser instance.

            • 3. Re: cs3 button problem
              Ned Murphy Adobe Community Professional & MVP

              You are opening a new web page in the current browser window, so you can't be looking at the same buttons.  You might have the same buttons on the new pages, but they haven't been clicked at all yet since they are in a newly loaded page.

              • 4. Re: cs3 button problem
                kglad Adobe Community Professional & MVP

                and that probably explains his problem.

                 

                he thinks he's opening a page with the same buttons but they are not the same buttons.  even though they may have the same names as the buttons referenced in your code, they are different buttons.  they didn't even exist when you code executed.  so, the mouse-listener code you previously executed will not have any effect on the newly loaded page and its buttons.

                 

                you need to execute code that applies to the newly instantiated buttons.  ie, the buttons that appear in the loaded page.

                1 person found this helpful