7 Replies Latest reply on Mar 7, 2011 3:05 AM by unamus3d

    Moving everthing on stage?

    unamus3d

      is it possible to select everything on stage and move it slightly in 1 direction with action script on key press? anyway at all.

       

      i cant put it in a movieclip and move it like that because lots of different thngs come onto stage further down the time line

        • 1. Re: Moving everthing on stage?
          Ned Murphy Adobe Community Professional & MVP

          Are you talking about moving things while editing the file or while running the file?  I don't see how other things down the timeline have any bearing in the matter.

          • 2. Re: Moving everthing on stage?
            unamus3d Level 1

            While running ofcourse, its fairly simple to just move something whilst editing i think even a person using the program for the first time will know how .

             

            i have a movieclip that on key press moves on stage, and on key press moves off  (clasic tween to slide). i want everything thats currently onstage to kinda of move (Tween like or frame by frame to create a slide effect) in a certain direction.

             

            is this possible at all via any methods

             

            im not sure if it is possible i cant seem to find what im looking for so i thought id ask here where  the experts are.

            • 3. Re: Moving everthing on stage?
              Ned Murphy Adobe Community Professional & MVP

              Your original description was vague.  Selecting things is a manual activity, not something code does... you'd be surprised what folks who just started using Flash don't know how to do, and typos are not scarce around here, so I had to ask.

               

              You haven't explained why you cannot place everything in a movieclip and move it all as one.  I still cannot see how other objects elsewhere on the timeline would have an impact.

               

              There is a way to go thru what's on the stage to try to move them as individual pieces, but they have to be objects that can be targeted using actionscript, such as movieclips...

               

              Finding movieclips on current stage/timeline - AS2
              --------------------------------------------------

              function movieclipF():Array{

                  var a:Array=[];

                  for(obj in this){

                      if(typeof(this[obj])=="movieclip" && this[obj]._parent==this){

                         a.push(this[obj]);

                     }

                  }

                  return a;

              }

               

              Once you have that array of movieclips, you can loop thru it as needed to adjust the position of each one for a keypress interaction.

              • 4. Re: Moving everthing on stage?
                unamus3d Level 1

                alright ill look into it and have a bash at it later, thank you

                • 5. Re: Moving everthing on stage?
                  Ned Murphy Adobe Community Professional & MVP

                  You're welcome

                  • 6. Re: Moving everthing on stage?
                    Rothrock Level 5

                    Technically everything on the stage is inside a movieclip -- the maintimeline. You can move the whole stage with code like:

                     

                    _level0._x+=5;

                    • 7. Re: Moving everthing on stage?
                      unamus3d Level 1

                      Oh im only just getting round to trying out and this approach does look alot better, how ever is there ways to add exceptions like set certain movieclips onto different levels.