7 Replies Latest reply on Jul 23, 2008 6:46 PM by robdillon

    Help me with Positioning SWF on stage

    as3132 Level 1
      Hi all,

      On a site I am building I use the following code to exactly position an SWF on the stage of my main SWF:

      on (release) {
      _root.createEmptyMovieClip("loadingclip", 2);
      loadMovie("images/logo1.swf", "loadingclip");
      loadingclip._x = 175;
      loadingclip._y = 250;
      }
      on (rollOut) {
      _root.createEmptyMovieClip("loadingclip", 2);
      removeMovieClip("images/logo1.swf");

      The problem: it all works fine until you start clicking more erratically as some user do when they loose patience.
      Then the movie starts playing closer to the area where you are clicking which closer to the top of the stage.
      how can I make the SWF position itself exactly where I want it, but not encounter the issue I just mentioned.

      thanks!
        • 1. Re: Help me with Positioning SWF on stage
          robdillon Most Valuable Participant
          Can you explain in greater detail what you are trying to achieve? There is part of a rollout event function that you are showing here that makes no sense in the context of the release event function. What are these functions attached to?
          • 2. Re: Help me with Positioning SWF on stage
            as3132 Level 1
            I am simply trying to position a SWF at the exact spot I want on the stage, after a button is clicked.
            I used this code I found which gives "x" and "y" values so the external SWF appears exactly where I want and not at the top left corner of the main "parent" SWF.

            if you have another way of doing this (maybe simpler) I would love to hear about it.

            thanks!
            • 3. Re: Help me with Positioning SWF on stage
              robdillon Most Valuable Participant
              There is nothing really wrong with your on release function. I don't really understand why you would want this to happen more than once. Once you've loaded in the new movie once, you don't want to load it in again, its there for you to use.

              What is that rollout function to be used for?
              • 4. Re: Help me with Positioning SWF on stage
                as3132 Level 1
                here is the URL where this page resides: http://visionbyamit.com/07site/

                once you're there, click on any of the TOP RIGHT 3 buttons and you'll be taken to a page that has about 12 of these buttons. if you click nought times while ERRATICALLY moving between them, you will see the occurrence I referred to in my original question (i.e. the new SWF moving to the top of the page away from its location). And this is what I am trying to prevent from happening.

                thanks again! hope you can help solving this, or help me figure out another way of doing this.
                -A
                • 5. Re: Help me with Positioning SWF on stage
                  robdillon Most Valuable Participant
                  What looks like is happening is that the rollOut event function that you have is causing a second movieClip to be created and this new clip is inheriting the loading content from the release event function. I'm guessing that the new position for the loading clip is the position of the loadingclip when its in the upper left corner.

                  This rollOut event function is the problem. If your intention is to remove the current contents of loadingclip when the user roll off the current button, then you can simply use unloadMovie(loadingclip); That will dump the current contents.

                  Alternately, you could create one empty movieclip instance for each button and load in the content for each when the movie starts. Position each one off the visible area of the stage and just move the clip when the user selects one of the buttons. This relieves the user from having to endure all of those loading waits, particularly if the user selects a button more than once.
                  • 6. Re: Help me with Positioning SWF on stage
                    as3132 Level 1
                    "This rollOut event function is the problem. If your intention is to remove the current contents of loadingclip when the user roll off the current button, then you can simply use unloadMovie(loadingclip); That will dump the current contents."

                    I would love if you can write the the way the copy would be if you added the unloadMovie line in. that is for us (as in me) code-challenged designers.

                    THANKS
                    • 7. Re: Help me with Positioning SWF on stage
                      robdillon Most Valuable Participant
                      on (rollOut) {
                      unloadMovie("logo1.swf");
                      }

                      is probably what you're looking for.