5 Replies Latest reply on Oct 30, 2007 3:03 AM by Greg Dove

    detect url

      is that any way to detect a url for a flash swf start in a diferent frame....

      i mean i´ve got a flash inside a html, if the url is http://www.something.com/index.htm to start in frame called home. (just with actionscript)

      thank´s very much

        • 1. Re: detect url
          Greg Dove Level 4
          I'm not 100% clear on what you're asking... so I'll assume that you mean that you want flash to initialize into different state depending on the url of the page that contains it... then yes... there are different ways to do this.

          a) flash vars :You can include a flashvar on each different page that flash checks. If you don't know what this means you should read about flashvars in the help documentation.
          This would not be a frame label but you could do a conditional check inside flash to send it to a different frame based on the value passed in.

          b) check via javascript: you could use the ExternalInteface class to request the external pages location.href from javascript and return it to flash. You would need a javascript function in the page to return it. Once you have that value in flash, you could test the value and do different things similar to the option (a) above. For this you should read up on the ExternalInteface class and how to use it.

          There are other options but it would depend on whether the flash content was in a separate iframe etc.
          • 2. Re: detect url
            Alex_br Level 1
            i,ve got everything in separate layers an different frames and the problem that i really have is that in firefox i can´t see well everything, if i do it with flashvars.
            is that any way that i could just put everything in actionscript, i mean not using flashvars or javascript? (i havent tried yet the javascript and i will) i do prefer to use just actionscript if there is a way....

            thanks very much for now... and i will try java now and let you know!

            • 3. Re: detect url
              Greg Dove Level 4

              in firefox i can´t see well everything, if i do it with flashvars.

              I'm sorry but perhaps I don't understand your issue.
              I understand you have separate layers and different frames.

              What I thought you wanted was something like:
              a) include the same swf in many pages.
              b) depending on whatever page it is (url) the first thing it does is goto a different frame and display that part of the swf.

              Whether its in firefox or internet explorer or safari etc, it should do the same thing. You can do it with a single flashvar which would be used in actionscript code in the first frame for a conditional check e.g. if/else or switch/case or some other approach (e.g. frame number) to determine which frame to start at.

              • 4. Re: detect url
                Alex_br Level 1
                all right have a look at www.alexdelrei.com and you will have a visual contact at my issue... it is just a menu try in firefox and any other browser... and you will see, and basic the problem is when i put the sub menu in "servicios" so it does not work the "contact" and the "acercade" . i´ve tried to put inside movie clips and it does not show as well....
                • 5. Re: detect url
                  Greg Dove Level 4
                  Well for me it seems to work fine in firefox - if everything else is the same with the pages where its not working, then I believe the problem must be actionscript related.

                  But it doesn't work for me at all in IE7. And that is strange. I would expect it to behave in the same way.
                  I can't see anything wrong with your swfobject code.

                  Q: (may not be relevant) do you have anything setting stage scalemode and stage alignment inside your swf in actionscript? Just curious at this point, I don't think its related, but I did encounter a problem in IE6 with cached copies of swfs.
                  You might try appending a random number to your swf url in the swfobject code to see if it makes a difference if all else fails.

                  Javascript options
                  Your swfobject settings are for player version 6 as a minimum. If you're publishing for version 6 you won't be able to use ExternalInterface to communicate with javascript. That's only available from player versions 8+. If you want to be compatible with player version 6 players you should consider this approach if you want to use javascript:

                  (you can call a javascript function with getURL, but it doesn't return a value, so, unless you code for all the browser differences and correctly target your swf for the setVariable call all in the getURL javascript, then you probably should use the approach above).