17 Replies Latest reply on Oct 12, 2006 11:06 AM by crazyjoemilan

    Need Motion Assistance

    SmileyGirl23
      I have a Flash scroller-type item that I have created that I am needing help enhancing. The images are actually swfs that are called via xml. These swfs contain an image and a button to link them to an external link. Those work fine. My "scroller" works just fine. However, I need to get a sliding-in and sliding-out look to them when they are "scrolled" through, instead of just populating on top of one another. I am more than happy to provide my code and any other necessary items for assistance on this. Since this is required by my boss, I am really hoping to get this knocked out soon and to his specifications. Any and all assistance on this issue is greatly appreciated!
        • 1. Re: Need Motion Assistance
          crazyjoemilan Level 2
          is your scroll-bar coded, or timeline tweened?

          I mean, when you use the scrollbar, are your images tweened for motion, or do you change their ._x or ._y values with AS?

          If its the former, thats a simple tween property you can choose.

          If its the latter, you can use a % to control that.
          StartX = currentMC._x
          FinishX = (variable to wherever they're moving)
          distanceToMove = (FinishX - StartX) / 4

          currentMC._x += distanceToMove

          Then just loop that. Make sense?
          • 2. Re: Need Motion Assistance
            SmileyGirl23 Level 1
            I do not have a scroll-bar. I have an arrow on either side of a box where my images display. These arrows make the images "scroll" through. Right now, when I click on an arrow, the image simply loads in my movie clip. I need it to look like it is sliding in from the side.
            • 3. Re: Need Motion Assistance
              crazyjoemilan Level 2
              oh, well then thats easy. Just create a movieclip, name the instance Holder1, and make it slide from left to right. (and right all the way off the stage). Put "stop();" on each of the 3 keyframes.

              Now you can change your actionscript to load the movie into Holder1 and it will replace whatever is in there right now ( probably a color field ). Each time you call for it to load, it will replace the previously loaded item.
              • 4. Re: Need Motion Assistance
                SmileyGirl23 Level 1
                I'm not quite sure I understand what you mean by "make it slide from left to right. (and right all the way off the stage). Put "stop();" on each of the 3 keyframes."

                Would it be beneficial to you to help me if I gave you my code and you added in what I need? I admit, I'm still learning ActionScript.
                • 5. Re: Need Motion Assistance
                  crazyjoemilan Level 2
                  no problem :)

                  What code are you using to load movies. I was actually going to show you the slightly easier route of doing it half timeline, half actionscript. Check out...

                  http://www.13studios.com/Cstest

                  the banner on the right of the screen loads .swf files, and does what you're hoping to do. Here is how to do that...

                  create a movieclip from a block of color (roughly the size of your loaded images). Name the instance of that movieclip "Holder1". Animate Holder1 using a motion tween. (select the frames and right click: create Motion tween) Create a Keyframe on frame 10, and frame 20.

                  on frame 1, move your object to the left of the stage.
                  on frame 10, leave the object in the middle of the area
                  on frame 20, move the object to the right of the stage.

                  once you do this, you will have created a very simple animation of a block of color (called Holder1) to slide from one side of the screen to the other. Let me know when you do this, and we'll get started on the second step.
                  • 6. Re: Need Motion Assistance
                    SmileyGirl23 Level 1
                    You rock! I have attached the code I am/was using to load my movie. My images (which are actually swfs) are loaded via xml. I have completed your steps, oh wise one, and await your next set...I can follow instructions well. :)

                    • 7. Re: Need Motion Assistance
                      crazyjoemilan Level 2
                      hahaha

                      okay, good, you're pulling it from XML perfectly, and you don't give yourself enough credit. Assuming you know what your code is doing, here is the next step...

                      If you want to have 2 images scroll in and out (at the same time) like mine does in the 13studios example, you'll need to create 2 movieclips. I think I have both of those on the same timeline actually, since their motion is symbiotic. For the sake of just gettin' it done, we'll ignore that and come back to it later.

                      So...
                      frame 1 - loads the image, and when done loading, plays.
                      frame 10 stops (for a time?)
                      frame 20 - does nothing in this example, not even stop();

                      frame 1
                      -----------
                      if you're working on the main timeline, which technically is a bad idea for larger sites/files (don't worry about it right now), frame one's button actions will look just like yours now.

                      BUT- we're going to want to build in some kind of preloader, if anything just to tell the file when its ready to slide to the next one.
                      //example, next.onRelease button
                      next.onRelease = function() {
                      if (whoIsOn < urls.length -1 ) {
                      whoIsOn--
                      Holder1.loadMovie(urls[whoIsOn]);
                      play();
                      // you'll play the timeline in which Holder1 sits. Normally its a very good idea to keep this off the main timeline, but no biggy for a little guy like this.
                      }
                      }

                      so now your script will load the movie, and slide from one end to the other. You'll need to update the instance names of "holder" to "Holder1" (or keep it at holder, and change our movieclip name to "holder");

                      since each image is going to button oriented, we really don't need a timer to auto-scroll through the images, so frame 10 should just say
                      stop();

                      lemme know when you get that part working.
                      • 8. Re: Need Motion Assistance
                        SmileyGirl23 Level 1
                        Well, it is somewhat working. The first image scrolls in beautifully and stops. The next arrow will change the image, however, it is not the sliding motion...it just loads it like it originally was. I'm sure this is all me messing it up. I'm not sure exactly how far you were wanting it to work, so this may be all you had intended for me to do.

                        I SO appreciate all of your help on this!!!
                        • 9. Re: Need Motion Assistance
                          crazyjoemilan Level 2
                          oh yeah, sorry, I've been very busy today. My apologies for leaving you hanging.

                          now what you need to do is script Holder1 (or "holder") to play(); THEN it needs to load another movie when it hits frame one again. Instead of loading right away, it'll play, then load. So don't call your function on(Release), call it when it hits frame one.

                          It'll be tough, but I think you can put the rest together. Lemme know if you need more specifics.

                          If you want to make it a little flashier, you'll make
                          Holder1
                          and
                          Holder2
                          (on the same timeline)
                          Animate one to move in as the other leaves. Then just have your actionscript rotate whether it loads into Holder1 or Holder2.
                          • 10. Re: Need Motion Assistance
                            SmileyGirl23 Level 1
                            No need to apologize...I understand how it is to get busy with something. It's not like all you do is sit around waiting for someone to have a problem.

                            I'm not quite sure how to script it to load another movie when it hits frame 1 again, especially since frame 10 has a stop(); on it. And yes, I would like to know how to make the holder1/holder2 thing work, since I need it to look like it slides in from the right and slides out to the left as the image changes.
                            • 11. Re: Need Motion Assistance
                              crazyjoemilan Level 2
                              no problem, your code is already scripted to load the next file.

                              holder.loadMovie(urls[whoIsOn]);

                              "urls" in this case is an array, so you can access the values in the array by saying...
                              urls[0] or urls[1] or urls[2]
                              but instead of writing it out each time you're using a variable that automatically does it. whoIsOn is the variable, and after it loads each time you say

                              whoIsOn-- or whoIsOn++
                              so those change the value of "whoIsOn" by one (either +1 or -1)

                              Now instead of having that action on a button, with an on(release), you just move it to frame one, and you make the prev and next button just change the value of "whoIsOn" and play the movieclip.

                              frame 1 loads, slides to frame 10- stops.
                              next or previous button is clicked:
                              slides to frame 20, changes value of whoIsOn, DOES NOT STOP... soooooooo...

                              frame 1 loads, slides to frame 10- stops.
                              next or previous button is clicked:
                              slides to frame 20, changes value of whoIsOn, DOES NOT STOP... soooooooo...

                              make sense?
                              • 12. Re: Need Motion Assistance
                                SmileyGirl23 Level 1
                                Ehh...kinda....I understand the concept, but actually executing it seems to be escaping me. I guess I'm having a blonde moment.

                                You said to take my action of updating my whoIsOn variable from my previous and next buttons and place it on Frame 1...of the slider, I presume. Right now, I have a separate Actions layer on top of the Slider layer. So, to take the place of this code for my buttons, I'm not sure how to update whoIsOn with the button click.

                                Also, I'm needing to work in that slide-in-from-the-right, slide-out-to-the-left thing....

                                If doing this would be easier and quicker via email, feel free to email me instead of posting. Email Me
                                • 13. Need Motion Assistance
                                  crazyjoemilan Level 2
                                  okay, so I edited the code- we'll see if it works. A few things.

                                  Because we're working on the main timeline, we'll be running into a few problems. Instead of just calling the xml once, we'll now call it each time we hit frame 1. What we should do is have holder in a parent movieclip. There are other ways to solve this, but ignore it for now. Just look at my source code, see if you can make sense of it.
                                  • 14. Re: Need Motion Assistance
                                    SmileyGirl23 Level 1
                                    I understand your code, but it didn't work. I placed it into my fla and the holder slid into place and nothing else happened. None of my images showed up and nothing changed when I clicked my buttons. If we need to split this into separate timelines or something to make it easier, I'm open to that...but you will have to step me through that. I am just learning AS, so I apologize for my stupidity in this.
                                    • 15. Re: Need Motion Assistance
                                      crazyjoemilan Level 2
                                      please link your .fla file so I can walk you through it then :)
                                      • 16. Re: Need Motion Assistance
                                        SmileyGirl23 Level 1
                                        boy, don't you just hate getting people like me needing your help!?
                                        I really do appreciate it!
                                        I only have my .fla sitting on my desktop right now...I have not moved it up to my server yet. Also, I am not sure how you would gain access to it if I did. I will supply you with whatever you need to help me solve this issue...I just don't know the best way to get it to you.
                                        • 17. Re: Need Motion Assistance
                                          crazyjoemilan Level 2
                                          if its less than 5 megs just email it to me, otherwise, you can put it on your server, and just link it to me, like it was a normal html file. Its always a challenge to explain whats happening in my head to anyone who is not in my head. Its a problem I run into quite often, but its most certainly not your fault. We'll get it ;)