7 Replies Latest reply on Jul 17, 2009 11:19 AM by JustIn Time

    variable checking isn't working

    JustIn Time

      Hello everybody.

      Allthough I consider my situation as a problem, I should be happy because I am having this problem:

      Google is ranking my site preety high  BUT (bigBut) in MOST searches it lists my swf-s not html pages. So when clicked they are shown in a browser window as single swf-s, not as part of html page. I am trying to workaround this by means of some variable to inspect if swf is opened as standalone or within a html.

      Here is the problem. I've set up a swf (swf_01 for example) in html page that loads another swf (swf_02) which is in swf_s directory. Swf_01 establishes a variable _global.isActive = 1; when html loads swf_01. So if swf_02 is loaded into the swf_01 variable is TRUE and that is OK and if the swf_02 is loaded directly from search results as a standalone swf it's not OK. That works so far. In swf_02 there is a code that checkes if variable is undefined (meaning that swf is loaded directly from search results) and, if it is, loads the right html into "_self".

      Somehow it's not working. Maybe my code isn't right.


      Code in swf_02 (loaded one):


      loadMovie("http://www.mydomain.com/index_services.htm", "_self");
      }    // meaning: if variable is not true > this swf is loaded into browser directly from search engine without html so it should be reloaded with html


      To mention this as well: swf_02 is loaded into swf_01 using "GET" method for variables.

      This swf is made with Flash MX.

      What is wrong? Any other tricks for my problem?

      Thanks to anyone reading or answering my question.


      Justin Time


      P.S. sorry for my English.

        • 1. Re: variable checking isn't working
          Ned Murphy Adobe Community Professional & MVP

          This is just an option to consider instead of the scheme you currently use.  What if you were to use FlashVars in the normal web page that you can check in the file.  If the normal page loads the FlashVar value, you should be able to check that.  The only part I'm wondering about is what you plan to do with that?  We're you going to redirect the search result page linked if the file is determined to not be in its normal page?

          1 person found this helpful
          • 2. Re: variable checking isn't working
            JustIn Time Level 1

            Helo Ned, thanks for your interest for helping me.

            The main problem is that search engine is linking user to my swf_s folder to a specific swf, and when clicked (link) browser is loading swf alone. In it's original idea it is supposed to load entire html + that swf. I want (from that swf standalone) to reload entire html page containing that swf. In this case it's impossible to check FlashVars from html because html is not present at all. So I am looking for a internal swf checker (code) which checks someVar being true or false and to act according to state of that Var.The Var is established as true in html (more precisely: a container swf which loads content swf.). When loaded, swf is running checking Var and stays that way because Var is true.

            Here is important part: if the swf is loaded as standAlone from swf_s directory the Var is not initialized (that means it's undefined), and in that case swf should load entire html page instead of swf alone.

            Also, if it's loaded as part of html, code shouldn't corrupt loading and displaying the page.

            Hope you are better at AS with undefined Vars, and you understood my question.

            Thank you anyway.


            Justin Time

            • 3. Re: variable checking isn't working
              JustIn Time Level 1

              Hello again Ned (and everybody else, of course),

              I was walking today and suddenly it came to me as a divine impact!

              It came to me that I was so stupid and (don't know the right word) "faster fingers than the brain" or maybe "hotheaded" while typing code.

              Here is a solution:

              instead loadMovie I used getURL and that resolves my problem.

              Don't know why I've typed "load", it's a mistery to me.

              Anyway, Big Thanks for your time and effort.


              Best regards


              Justin Time

              • 4. Re: variable checking isn't working
                Ned Murphy Adobe Community Professional & MVP

                I am aware of the scenario you're dealing with on the search engines because I've seen it for my own stuff.  What I was suggesting is that the normal html page will provide a FlashVar value to the file, and the file will test that variable inside to see if it is what it is supposed to be (if it gets the value from the page).  If it isn't the value the FlashVar would assign, then it is not being displayed in the page and you can take whatever action.  My wondering what you were going to do with knowing that was if you might redirect the page (aka getURL).

                1 person found this helpful
                • 5. Re: variable checking isn't working
                  JustIn Time Level 1

                  Hello Ned I am glad you are back because I was too soon celebrating my "success" in resolving a problem. Now I got one.

                  Now redirecting is working fine but the refreshing of the html is endless because embedded swf isn't been loaded with proper variable meaning that variable is still undefined or assigned a wrong value.. I am not sending a proper variable from Dreamweaver to embedded Flash movie.

                  Basicaly I am not too familiar with sending (declaring) variables from Dreamweaver to embedded swf.

                  This is what I did in DW code:


                  <param name=flashvars value="MyVariable=1">


                  This is what I did in FLA code:



                       _global.MyVariable = 1;

                      getURL("http://www.mydomain.com/index_tralala.htm", "_self");



                  and I've found this in help (under seting movie properties):


                  Opens a dialog box for entering additional parameters to pass to the movie. The movie must be designed to receive these additional parameters.

                  Should global keyword be in html declaration or what? I don't know.

                  First version was that the MyVariable was declared from swf which is in html file and loader of targeted swf // _global.MyVariable = 1;.

                  Now MyVariable is declared from html directly to targeted swf embedded into html file.

                  So, if you can say what am I doing wrong here I'll be very thankfull. I am aware that reading a chapter or two, threee in certain books I have will resolve this problem but maybe you can save me some time with your knowledge or experience . I am wondering how swf movies must be designed to receive additional variables. Or maybe I am doing something wrong according to software versions since this site is built with Dreamweaver CS3 and swf files with Flash MX. Previous version was built on Dreamweaver MX2004 + Flash MX and when I upgraded to higher version DW automatically asked whether to convert code and I said yes so it was done. I copied Scripts folder as well and everything was going OK so far.

                  Now I am going to read on declaring vars from html and if you Ned or anybody else have some experience with issues like this please help.


                  Best Regards

                  Justin Time

                  • 6. Re: variable checking isn't working
                    Ned Murphy Adobe Community Professional & MVP

                    I am no FlashVars expert, but one thing you probably need to follow is the correct syntax...


                    <param name="FlashVars" value="myVariable=valid_access">


                    and in the Flash file itself you only need to decalre the variable...


                    var myVariable:String;


                    if(myVariable != "valid_access"){ // redirect to your site

                         getURL("http://www.... etc");


                    Here's a web site link that explains a little about FlashVars usage...



                    • 7. Re: variable checking isn't working
                      JustIn Time Level 1

                      Ned, thanks again, this was very helpfull.

                      Right direction.

                      Good link for everybody else having this problem or want to explore correcting mistakes.

                      Best regards everybody, Ned three times thanks


                      See you exploring