3 Replies Latest reply on Apr 7, 2009 11:15 AM by eCaddy

    Var not being picked up in URL


      I'm not sure under which catagory my question falls but hope it can be answered, here goes.


      I'm trying to load an external SWF into an MC. The SWF is determined by a variable in the main MC. The first frame of my main MC contains a preloader, in the second I have added the following line of actionscript code decalaring the variable;


      var dealershipName = "bellville";


      From the main menu a seporate MC is loaded onto level 1, from within this MC depending on the var declared in my main MC the external SWF is loaded into an MC called staff. The actionscript code used for this is as follows;


      loadMovie("http://www.baronsbellville.starterweb.co.za/staff/"+_root.dealershipName+"/nvss.swf", this.staff);


      To the best of my limited knowledge at runtime the "+_root.dealershipName+" should be replaced with bellville and the file should load. This is not the case though. If I replace the "+_root.dealershipName+" with bellville in the above url it works fine.


      For some reason the var is not being picked up!


      Can anyone shed some light on my situation.


      Thanks in advance.



        • 1. Re: Var not being picked up in URL
          Ned Murphy Adobe Community Professional & MVP

          Put a trace in for _root.dealershipName and see what is coming out.  My guess is it is coming out as being undefined due to some disconnect in the actionscript locations.  Physically (so to speak) where is the loadMovie command relative to frame 2 of the main mc?

          • 2. Re: Var not being picked up in URL
            eCaddy Level 1

            Thanks Ned for your response.


            I'm not sure how to add the trace command, my actionscript skills are very basic to say the least. Using my link do you mind adding it for me?


            To answer your question regarding the loadMovie command;


            I have a main MC called index.swf, this loads two external SWF, one onto level 1 and the other onto level 5. The SWF with the loadMovie command resides in the 8th frame of an actionscript layer on level 1. This is supposed to reference the variable I created in the 2nd frame of my main MC which to the best of my knowledge is the root. Hope this makes sense.

            • 3. Re: Var not being picked up in URL
              eCaddy Level 1

              I was able to figure out the trace command. If I add the trace command to the main SWF it return the value bellville, which is correct. If I add it to the external SWF it returns the value undefined. Not sure where the problem lies!!!