12 Replies Latest reply on Apr 24, 2007 6:24 AM by MotionMaker

    Targeting nested clip using flashvar?

    ][odine
      Hello All.

      I am in a bit of a situation. I am trying to get an HTML button to go to a specific frame in the flash SWF timeline. Now thats not hard - just pop in a flashvar, easy right? well...I ran into some problems...it seems that flash only exports anchors and labels on the main timeline. So say i wanted to go to frame 30, where the main timeline stops, but a nested movieclip plays to a certain point. lets say i wanted to go to frame 30, as well as make that nested clips timeline to be at frame 5 lets say.

      Basically, i tried converting the labels to anchors (for browser back button) which would have worked great, except flash refuses to export/has no way of telling the label names of nested clips. How can i target a frame on a nested clip using a flashvar from HTML? anyone have any ideas?!


      --][--
        • 1. Re: Targeting nested clip using flashvar?
          MotionMaker Level 1
          Assuming the FlashVars are
          rootFrame = 30
          movieClipXFrame = 4

          On Frame 1
          trace(rootFrame);
          trace(movieClipXFrame);
          gotoAndPlay(rootFrame);
          or
          gotoAndPlay(Number(rootFrame));
          On Frame 30
          trace(movieClipXFrame);
          movieClipX.gotoAndPlay(movieClipXFrame);
          or
          movieClipX.gotoAndPlay(Number(movieClipXFrame));
          • 2. Re: Targeting nested clip using flashvar?
            ][odine Level 1
            Thanks MotionMaker

            so, how would I impliment this though. I am assuming my HTML back button would have to somehow pass 2 set variables...hmm...perhaps i could explain more what i am trying to do.

            SEE EXAMPLE

            If you click on a room it will load an FLV and play a zoom animation - at which point another SWF is loaded. What i need to to is instead of loading a URL there, i need to load a URL there (in the current window) which will have the same basic principle as the SWF loaded, in that there will need to be a back button but in HTML. From that back button - i would like it to reload the flash movie but go dirrectly to the zoom out animation. (which is a nested movie clip on the main timeline)

            I am seriously having troubles getting my head around this concenpt - i can assure you its the clients decision not mine!

            Thank you!

            --][--
            • 3. Re: Targeting nested clip using flashvar?
              ][odine Level 1
              not having much luck with javascript..hmmm...
              • 4. Re: Targeting nested clip using flashvar?
                MotionMaker Level 1
                As for FlashVars go to the link in the Flash documentat I provided for FlashVars and study that. Here it is again: FlashVars.

                As for your application, get the data you need to the application using:
                LoadVars.sendAndLoad
                LoadVars.load
                XML.sendAndLoad
                XML.load

                If you must, just use FlashVars to load the SWF and pass one value. Then the SWF would use one of the above to get the needed data to play.

                In the data you have the information necessary to load the correct video and as well other external swfs base on user interaction rather than trying to put them all into one swf.

                FlashVars is only used on the first load of the SWF. If you need ongoing communication between a running SWF and the web Document you need to look at other options in Flash.

                Either use the FLVPlayback component in Flash 8 Pro or
                NetStream to play with your own code.

                If you are doing this for a hotel of any notability, you probably want to host the FLVs on a Flash Media Server for clean play.
                • 5. Re: Targeting nested clip using flashvar?
                  ][odine Level 1
                  Thanks again MotionMaker.

                  As that may work, i am running into a fair few problems.

                  In terms of actually getting the variable to the SWF, i thought i could simply put it in the URL (if the url was www.mysite.com/index.html?rootFrame=30) however as i have found out that is not the case at all...it seems i have to put the code where the SWF is embeded in the HTML...which wont work if i need a button to link the a URL similar to above. for that to work i would have to have the SWF load up into the browser (eg.www.mysite.com/index.swf?rootFrame=30) which works fine in firefox, but microsoft latest implimentation of Internet Explorer (7) does not allow any unauthorized site to load active X content - meaning an SWF will not run in IE7 without being embeded in an HTML document. So that option is out.

                  What can I possibly do to get those variables you mentioned to the movie in the URL (not coding it into the Embed/object tags...i mean in the address bar.

                  Thanks

                  --][--
                  • 7. Re: Targeting nested clip using flashvar?
                    ][odine Level 1
                    quote:

                    Originally posted by: ][odine
                    What can I possibly do to get those variables you mentioned to the movie in the URL (not coding it into the Embed/object tags...i mean in the address bar.


                    Hey,

                    I thought I made it fairly clear that i do NOT want to embed the variabled into the embed/object tags. Naturally I have went over all Adobe's documentation and yes i have reviewed that page, it soley focuses on adding the variables into the tags...not the actual Address bar...



                    • 8. Re: Targeting nested clip using flashvar?
                      MotionMaker Level 1
                      I might look at using Javascript to read the address bar variables and write the OBJECT/EMBED tag as we all do now because of the IE Eolas issue. Active Content Development Center Look for the manual solution link to see example Javascript to write the OBJECT/EMBED tag. Then you can research how to read the URL in Javascript.
                      • 9. Re: Targeting nested clip using flashvar?
                        ][odine Level 1
                        Thanks again.

                        I have done some reading and to completly honest - I am not that amazing at javascript, in fact - i am pretty much useless. I know it is similar to AS in alot of ways (or vice versa) but that doesnt seem to be helping. I am looking at these to pages for reference Reading from URL and this For writing but its doing me no good at all.

                        surely this must have been done already somewhere..i cant be the first one wanting to do this - its a simple task even...but yet so complicated to do.

                        --][--
                        • 10. Re: Targeting nested clip using flashvar?
                          MotionMaker Level 1
                          Ah, just start another thread to get more attention. Perhaps a new title such as "getting address bar vars into flash - need javascript example" or as you think.
                          • 11. Re: Targeting nested clip using flashvar?
                            ][odine Level 1
                            Its okay MotionMaker. I figured it out!

                            SWFObject does it for me SWFObject. by simply adding

                            so.addVariable("flashVarText", getQueryParamValue("flashvar"));

                            to the script it pulls (in this case) ?flashvar=variable from the URL! So simple! You get all the credit for doing your best to get it into my thick skull haha. Thank you very much!

                            --][--