10 Replies Latest reply on Apr 8, 2009 9:44 PM by wongasta

    Weird geturl problem...

      Hello guys this is a rather a weird problem.

      I designed the menu and header for this website

      [url]http://www.numericorp.com/[/url]

      And for some reason when you click on anything under [url]http://www.numericorp.com/[/url], it will open a new page to [url]http://numericorp.squarespace.com/[/url], even though it's under _self. However when you click anything in [url]http://numericorp.squarespace.com/[/url] it will simply go to the page without opening a new window. Here's my code:

      [CODE]
      b1.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/index.html", _self);
      }
      b2.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/blog", _self);
      }
      b3.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/about-john-groom", _self);
      }
      b4.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/about-my-clients", _self);
      }
      b5.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/structures", _self);
      }
      b6.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/systems", _self);
      }
      b7.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/tax-planning", _self);
      }
      b8.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/real-estate", _self);
      }
      b9.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/the-process-never-stops", _self);
      }
      b10.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/irs-audits", _self);
      }
      b11.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/your-privacy", _self);
      }
      b12.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/new-business", _self);
      }
      b13.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/contact-info", _self);
      }
      b14.onRelease = function ():Void{
      getURL("http://numericorp.squarespace.com/en-espanol", _self);
      }
      [/CODE]

      If I try to change the link to just numericorp.com/whatever, it will still open up a new window. If I try to change it to "_self" the buttons on numericorp.com will NOT work at all, while at [url]http://numericorp.squarespace.com/[/url] will work perfectly. Also doing this in relative link results the same problem...

      Any help is appreciated. I'm quite new to AS so this is rather frustrating. Thanks!

        • 1. Re: Weird geturl problem...
          David Stiller Level 2

          wongasta,

           

               That "_self" parameter needs to be in quotes, otherwise Flash will treat it as a variable -- and you haven't declared a variable named _self.

           

               Try it like this ...

           

          b1.onRelease = function ():Void {

            getURL("http://numericorp.squarespace.com/index.html", "_self");
          };

          b2.onRelease = function ():Void {

            getURL("http://numericorp.squarespace.com/blog", "_self");
          };

          // etc.

           

          ... and let me know if that works for ya.  As a side note, that second parameter is optional, and "_self" happens to be the default value, so you should alternately be able to simply omit the second param.

           

           

          David Stiller
          Co-author, ActionScript 3.0 Quick Reference Guide
          http://tinyurl.com/dpsAS3QuickReferenceGuide
          "Luck is the residue of good design."

          • 2. Re: Weird geturl problem...
            Level 1

            Hello David,

             

            Thanks for taking your time. When I put the _self in quotes (which I did originally), it did NOT open a new link at all for some reason. In fact, nothing happens when I click the button on the website.

            • 3. Re: Weird geturl problem...
              David Stiller Level 2

              wongasta,

               

                   Sounds like it's time for some troubleshooting, then. 

               

                   For me, it's often helpful to stop, save my work, then open a new FLA file and isolate the issue I'm dealing with.  In this case, you might want to start a new FLA, draw a quick shape, convert it to a movie clip symbol or button, then try this with a single URL.  When you can get your test case working, you will have learned what's up, and then you can carry that knowledge -- possibly even the exact code -- back to your other work-in-progress.

               

                   In your new, simplified FLA, give your symbol an instance name, such as b1 (like you're using), and add one additional line to your function:

               

              b1.onRelease = function():Void {

                trace("I've been clicked");

                getURL("http://numericorp.squarespace.com/index.html") ;
              };

               

                   The trace() function puts values into the Output panel of the authoring tool.  This way, even if the getURL() function fails for some reason, you'll know that at least the button works -- that at least the onRelease association is correctly triggering the function.  If it doesn't, then something must be wrong.  Like for example, maybe you forgot to give your button the instance name b1.

               

                   Let's start with this simplified example, then let me know if a) the trace() function puts output to your Output panel and b) if the URL opens in a browser.  Important note:  If you're testing this from inside the authoring tool, you're always going to get a new browser window, because of course Flash isn't a browser, so make sure to test from within an HTML document too, even if you haven't uploaded to your server.

               

                   We'll figure this out.

               

               

              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."

              • 4. Re: Weird geturl problem...
                Level 1

                Thank you so much for helping me David.

                 

                However, I did what you asked and the button works perfectly in authoring tools. Again I'm only having issue after uploading it onto the server, everything works perfectly in Flash CS4. I tried this already but here's the results on the squarespace page:

                 

                getURL("http://numericorp.squarespace.com/index.html") ; - the buttons does not work at all

                 

                getURL("http://numericorp.squarespace.com/index.html", "_self") ;  - does not work on at http://www.numericorp.com but works at http://www.numericorp.squarespace.com

                 

                getURL("http://numericorp.squarespace.com/index.html", _self) ; - open a new window at http://www.numericorp.com but it functions properly at http://www.numericorp.squarespace.com

                 

                Squarespace is a special CMS tool my client uses to edit his website, and I'm only designing the Flash program for him. This is very weird...

                 

                Again, I appreciate you helping me on this.

                • 5. Re: Weird geturl problem...
                  David Stiller Level 2

                  wongasta,

                   

                       Whenever I try the SWF at the URLs you've posted, they always seem to work for me -- though, granted, they always open the content in a new window.  Have you tried my suggestion to try to reproduce this issue in a new, simplified FLA file?  Without a baseline, working proof of concept, it may be impossible to drill down to whatever is causing this.

                   

                       In the very least, you should try embedding this SWF in a simple, non-CMS HTML file and uploaded it to your own server to ensure that the SWF works on its own.  It's not out of the question, for example, that something in the CMS (some global JavaScript function?) causes links to always open in a new browser.  At the moment, there are too many variables/unknowns, so it'll help if you can gather a bit more information.

                   

                       Yuo said the buttons work in the authoring too, so that's an encouragement.    I assume this means the trace() statement put your message in the Output panel?  If so, then it's clear that the button works.  At this point, I suggest you take that file and embed it in a "normal" HTML page, and let's see what becomes of that.

                   

                   

                  David Stiller
                  Adobe Community Expert
                  Dev blog, http://www.quip.net/blog/
                  "Luck is the residue of good design."

                  • 6. Re: Weird geturl problem...
                    Level 1

                    Hello David,

                     

                    Indeed it shows the output in Flash CS4. I tried your extraction drill and it ended up to be the same. I can only assume it's the CMS's fault. What do you think?

                     

                    I can provide you the fla file for you to take a look at if you would like...

                    • 7. Re: Weird geturl problem...
                      David Stiller Level 2

                      wongasta,

                       

                           And does it work as expected when you test in a standard, non-CMS HTML document?

                       

                       

                      David Stiller
                      Adobe Community Expert
                      Dev blog, http://www.quip.net/blog/
                      "Luck is the residue of good design."

                      • 8. Re: Weird geturl problem...
                        Level 1

                        Yes, it works perfectly!

                         

                        Here's the link with "_self"

                         

                        http://www.website-design-austin.com/testsites/numericorp/

                         

                        But if I use that on numericorp it does not work. Thank you for your help I believe it's CMS' fault. I have to contact them =(.

                        • 9. Re: Weird geturl problem...
                          David Stiller Level 2

                          wongasta,

                           

                               Glad to hear the Flash part works!  Sounds like you still have some effort to work through with the CMS, but at least you know the Flash aspect is working as expected.  This sort of approach, were you pare things down and try to narrow the possibilities -- in other words, troubleshooting -- is a good practice to learn.  If you keep at it, you'll find that it helps you all over the place. 

                           

                           

                          David Stiller
                          Adobe Community Expert
                          Dev blog, http://www.quip.net/blog/
                          "Luck is the residue of good design."

                          • 10. Re: Weird geturl problem...
                            Level 1

                            Yes David, indeed! I'm a PHP and JQuery programmer so I have went through lots of troubleshooting. However, Flash troubleshooting is quite new to me... But I guess CMS is to blame...

                             

                            Thank you for all your help, now time to give Squarespace a friendly call with irony.

                             

                            Thanks!