7 Replies Latest reply: Jul 20, 2012 5:55 AM by diluant RSS

    Action script _root.attachMovie

    diluant

      Hi all!  I have a big problem at work. Here is the situation.  I have an html passing a variable as an array to my flash.  In the flash i want to call a couple of symbols depending on the variable from html and display them as a slideshow. I need to add these symbols dynamically but i dont know where to start.  I have created all my movie symbols and linked them for actionscript.  I have created a simple line of code just to display one symbol using _root.attachMovie and the  symbol does not show. here it the code:

       

      _root.attachMovie(usb, usb,1);

      usb.x = 276.15;

      usb.y = 199.50;

       

      Now the symbol should be visible right? What am i doing wrong?

        • 1. Re: Action script _root.attachMovie
          kglad MVP

          1.  is usb defined?

          2.  is the value of usb the linkage id of a movieclip?

          • 2. Re: Action script _root.attachMovie
            diluant Community Member

            Yes my symbols are linked.  usb is the link of the symbol named MC_usb.

            • 3. Re: Action script _root.attachMovie
              diluant Community Member

              what do you mean defined?

              • 4. Re: Action script _root.attachMovie
                kglad MVP

                what's the following show:

                 

                trace(usb);

                var mc:MovieClip=_root.attachMovie(usb, usb,1);

                trace(mc);

                • 5. Re: Action script _root.attachMovie
                  diluant Community Member

                  I will paste my code so you have better understanding.  Here is what i have in my flash:

                   

                  txt1.text = logos;

                   

                  It seems I have difficulties passing the FlashVars from html.  I have created a dynamic text box which I gave the instance name txt1.  In my html, I have the following code for the flash:

                   

                  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="60" id="FlashID" title="logoflash">

                       <param name="movie" value="logo.swf" />

                       <param name=FlashVars value="logos=usb%2mp3" />

                       <param name="quality" value="high" />

                       <param name="wmode" value="opaque" />

                       <param name="swfversion" value="6.0.65.0" />

                       <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->

                       <!--[if !IE]>-->

                       <object type="application/x-shockwave-flash" data="logo.swf" width="300" height="60">

                            <!--<![endif]-->

                            <param name=FlashVars value="logos=usb%2mp3" />

                            <param name="quality" value="high" />

                            <param name="wmode" value="opaque" />

                            <param name="swfversion" value="6.0.65.0" />

                            <param name="expressinstall" value="Scripts/expressInstall.swf" />

                       </object>

                  </object>

                   

                  I have already wrote "fla" in the text box.  When I preview the flash only all that shows is "f".  When I preview the html within Dreamweaver, there is nothing on the text box.

                   

                  When i try your code:

                   

                  trace(usb);

                  var mc:MovieClip=_root.attachMovie(usb, usb,1);

                  trace(mc);

                   

                  Nothing shows...I have worked with that 4 hours yesterday and read everything, I`m lost!!!

                  • 6. Re: Action script _root.attachMovie
                    diluant Community Member

                    All i get in the output is

                     

                    undefined

                    undefined

                    undefined

                    undefined

                    • 7. Re: Action script _root.attachMovie
                      diluant Community Member

                      ...of course i get undefined i run the flash without the html...

                      I have found the way to show the symbols, my problems was they showed completely off the bounds of scene...

                      My problem now is the FlashVars