Movie Loop in AS3

I'm trying to move to AS3. I have a simple animated loop, on
the last frame of the timeline I have a gotoAndPlay(4);
In AS2 the back ground loop plays seamlessly, but in AS3 it
pauses for a second, or a frame, so the loop is not smooth.
Why is that?
Thanks!

When I publish this in Action-Script 2 the back ground loops
seamlessly. But when I publish it in AS3 it pauses. If I remove the
gotoAndPlay and shave a frame off at the end, it loops seamlessly
in AS2 and AS3. But often when making a game, or something, I rely
on making a loop with a gotoAndPlay somewhere on the timeline, is
this possible in AS3?
http://www.calicoradio.com/backgrnd_loop_test_fla.zip
Thanks.

Similar Messages

  • Make flv within a flash movie loop (or entire movie loop?)

    I am needing to make the flv loop from my .fla file which contains .flv files. I know there is a piece of AS 3.0 I need in order to make them loop/make the entire movie loop but I am not sure what it is.

    Well,
    in AS2 you need to use this code in the flv object:
    on (complete){
    this.autoRewind=true;
    this.play();
    Hope it helps

  • Hi.. Im wondering if its possible to automatically launch a quicktime.mov file on my home page of my website, so that everytime the go back to it the .mov loops around

    Hi.. Im wondering if its possible to automatically launch a quicktime.mov file on my home page of my website, so that everytime the go back to it the .mov loops around

    Like this?
    Click to view full size
    OT

  • How do I create a play button for movie clip using AS3

    Hello.
    Bit new to this and have been searching the adobe forums and google. I am trying to create a button that will play an imported MovieClip.
    I have a movie clip that I've imported into it's own layer (Layer1) Frame 1.  I've given the MovieClip an instance name of foundationMovie.
    I've created a button and have that on its own layer(Layer2) above layer1, it is also in Frame 1.
    I've added a
    stop (); action to layer2
    The video is not set to autoplay.
    I want the video to start playing when the viewer clicks the button.  I know I've got to put some kind of event listener using AS3 in my timeline somewhere.
    I've found some code and I've been trying to work with it.  I'm sure I've mutilated it beyond usability but this is what I've got.
    stop ();
    player.addEventListener(MouseEvent.CLICK,play);
    function play(event:MouseEvent)
    gotoAndPlay("foundationMovie");
    If someone could point me the right direction or help me with my code I would really appreciate it.  Thanks.

    First, you need to clear up what you are working with... a movieclip and a video are usually entirely different things.
    Next, your code may get you started on your way with some changes.   You shouldn't use "play" as a function name due to there already being a play() method/function in Flash.
    If the movieclip is a movieclip and has an instance name of "foundationMovie", and your button has an instance name of "player" then the following adjusted code would normally work...
    stop ();
    player.addEventListener(MouseEvent.CLICK,playMovie);
    function playMovie(event:MouseEvent)
         foundationMovie.play();

  • Movie Loop Question

    Hi,
    I created a movie located at this site
    http://www.antiochxc.com/dtc/flash/
    How do I get it to stop looping and to stop so it reveals the
    image? I don't want it to just stop and show nothing.
    Thanks in advance.

    Add stop(); to the last frame...
    And try following some tutorials on the subject "basic
    actionscript".

  • RePost: center movie clips dynamically, as3.0 ?

    I have a question that was somewhat answered but I now have some problems with, as far as implementing the solution is concerned.  I posted in August and I have revisited the file only now to see if I can create the changes necessary to center my mc's dynamically as they are drawn on the stage at runtime.  They need to center to themselves rather than having their registration points in the top left corner, per display object.
    Here is the thread:
    http://forums.adobe.com/message/5760947#5760947
    Thanks in advance for any responses.
    -markerline

    I attempted to reply yesterday but the forums became under maintenance (as we all re-logged in after).
    What I tried to post before the system went down was to give a single example as you had mentioned. To remove the complexity of the rest of the app so this can be understood alone and then implemented into your larger system.
    Centering via container in code is very simple as long as you can grab a hold of the shape in code as well.
    Here's a complete AS3 example of centering a single object inside a container. I just want you to paste this into a new AS3 doc so you can tell me you understand how it works. After that, the more complex multi-object container in a container approach comes in:
    e.g. 2 squares rotating:
    import flash.display.Shape;
    import flash.utils.Timer;
    import flash.events.TimerEvent;
    import flash.display.Sprite;
    // start rotation loop using a Timer to turn all objects
    var moveTimer:Timer = new Timer(10,0);
    // function to rotate objects
    moveTimer.addEventListener(TimerEvent.TIMER, handleTimer);
    // draw a rect shape
    var redrect:Shape = new Shape();
    redrect.graphics.lineStyle(3,0x0,1,true);
    redrect.graphics.beginFill(0xFF0000);
    redrect.graphics.drawRect(0,0,100,100);
    redrect.graphics.endFill();
    addChild(redrect);
    // position at x:100 / y:100 on stage
    redrect.x = 150;
    redrect.y = 200;
    // now draw a blue square but with a container while centering the shape
    // container
    var blueContainer:Sprite = new Sprite();
    addChild(blueContainer);
    // draw a rect shape
    var bluerect:Shape = new Shape();
    bluerect.graphics.lineStyle(3,0x0,1,true);
    bluerect.graphics.beginFill(0x0000FF);
    bluerect.graphics.drawRect(0,0,100,100);
    bluerect.graphics.endFill();
    blueContainer.addChild(bluerect);
    // position in center of container (subtract half width/height)
    //-------------centering code----------------
    bluerect.x -= bluerect.width / 2;
    bluerect.y -= bluerect.height / 2;
    // position container
    blueContainer.x = 400;
    blueContainer.y = 200;
    // start timer which invokes function below
    moveTimer.start();
    // rotate the red rect (upper left reg) and blue (objects centered);
    function handleTimer(e:TimerEvent):void
              // just rotate both to see the registration
              redrect.rotation += 2;
              blueContainer.rotation += 2;
    Now do understand I know I can draw my bluerect with negative coordinates to achieve the same thing inside the shape (e.g. -50,-50,100,100) but the point here is containing potentially a complex object into a single object so the entire outer contents can be measured and rotated from a single center point. That comes after this simple code is understood.

  • Making an Object Move (Smoothly) in AS3

    Hi again, I think I might of already posted this, but the forums are loading at about 400k a sec so I don't feel like wwasting another 25 minutes just look through the first page of threads or my history.
    I have an object that I want to smoothly move along the x axis when the user clicks on the screen.  I first made a prototype that would make the ball end at a location I specified by doing x = 450;.  I then tried looping ball1.x += 1 with a for/do (I encapsulated it with a boolean so the if ball1.x got to 450 it would stop) statement and I couldn't see the ball transition, I just saw it stop at the 450 mark.  Anyone know how to do this?  I know you do because I've seen you it.
    BTW, the reason I didn't just do a motion tween was because I have it set up so you can move it along the y axis by moving the mouse.  Thanks in advance.

    You can find all of the information about the Tween class in the help documentation.
    Here's a line copied from the Tween constructor section.
    public function Tween(obj:Object, prop:String, func:Function, begin:Number, finish:Number, duration:Number, useSeconds:Boolean = false)
    Parameters
    obj:Object — Object that the Tween targets.
    prop:String — Name of the property (obj parameter value) that will be affected.
    func:Function — Name of the easing function to use.
    begin:Number — Starting value of the prop parameter.
    finish:Number — A number indicating the ending value of prop parameter (the target object property to be tweened).
    duration:Number — Length of time of the motion; set to infinity if negative or omitted.
    useSeconds:Boolean (default = false) — A flag specifying whether to use seconds instead of frames. The function uses seconds if true or frames in relation to the value specified in the duration parameter if false.

  • Putting movie clips in AS3 package into movie clip on stage

    Hi - I am a as2/flash animator and am working on an AS3
    project. The AS is in a separate file, inside a package. I am
    modifying existing code.
    The script adds movie clips in a function via addchild.
    What I am hoping to do, is have the movieclips added to a
    clip that already exists on the stage.
    I put a clip on the stage named holder, with the instance
    name holder_mc - and I tried to add the clip with
    holder_mc.addchild in the AS3 file - it seemed to work, but
    manipulating the holder_mc - it looks like the added clips are not
    affected?
    Any help is appreciated.

    Child_array is a property of the Parent class.
    It's only added to in one point, in a function that creates a
    Child and adds it to the array.
    I think I might have found out the problem with my code after
    adding a trace to the function, think I'm creating twice the number
    of clips I'm removing, and the deletion part of my code is fine!
    Turns out AS3 is maybe not so bad after all :P
    Thanks alot for taking the time to reply though kglad!

  • Loading external swf movie to website - AS3

    Hi, once again I am stuck because of AS3, it was sooo easy to load external swf in as2.
    I have a very simple website where HOME does not want the external swf to show but all other pages should have the swf running as a main banner on left hand side.
    My site is built with labels - if you click on any other page except "HOME" the swf should load and stay loaded while navigating on the "following pages",  and when you navigate back to "HOME"the banner should unload.
    Should be easy right? I browse the Internet for 2 days and find millions of code, but nothing that works.
    Do I need a Loader placed on the following pages or an empty movie clip (with an instance name?)
    I tried the below, but it only loads if you click on button "l'ambition" first, since this is the frame where the code is placed, and it is of course not unloading on "HOME. I have a keyframe on label "ambition" where I have a Loader box and the code (both running all over the following pages.
    var request:URLRequest = new URLRequest("main_movie_241x700.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    Do I need an EventListener?
    Anyone...? Please hand me complete code since that will help me a lot. You can see the test site here: http://www.gattadesign.fr/CSD/index.html
    Thanks in avance!
    Anna Gatta

    Thanks for taking your time! Much appreciated.
    I like not complicated :-)  So it is now loading from the start - stretching over the whole timeline. How do I controll the visibility during the "HOME" = that is invisible?
    This is the code I use to load the external swf:
    var Xpos:Number=0;
    var Ypos:Number=0;
    var swf:MovieClip;
    var loader:Loader=new Loader();
    var defaultSWF:URLRequest=new URLRequest("main_movie_241x700.swf");
    loader.load(defaultSWF);
    loader.x=Xpos;
    loader.x=Ypos;
    addChild(loader);

  • QT movie loop problem in IE

    I'm working on a page (in GoLiveCS) which contains 4 80x44 px QTime movies which I've set to loop in the GL inspector. In Safari and Firefox this works fine however in IExplorer (5.2 Mac) when the initia image sequence finishes and it 'loops' I get fantome images of the first frame accumulating to the lower right (+/-100 px x and y) of their position and in the middle of the page : one of the first frame of each film, each time it loops. Whether the films are set to loop in QT Pro 7 or set to loop in GL. If they do not loop there is no fantome image. The only way I've worked around this is to import them into a Flash document, set an action script to loop, then export them as a swf file to replace the .mov files. Is there something I'm doing wrong or perhaps a simpler fix? I've put both the <object> and <embed> tags in attributes. I would prefer to use QT files as opposed to swf files which are quite a bit heavier. Thanks for any help/suggestions...

    Check out these resources listed below:
    Flash
    Embed Params
    and this site for examples of the usage
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_4150
    Look at the alignment parameters and play with the settings
    through the parameters tags to get the look and alignment you are
    looking for.

  • Menu Flickers faster than movie loop ...

    Hello,
    I 've made a menu with a movie (too short) and incrustation. I have modified the movie length (from 2 s to 2 mn) but the buttons still flickers at the same rate than before...making the text "vibrate"

    The arrow (incrustation) flickers, like when the menu loop, on a home dvd player

  • Problem with animation loop in AS3

    I'm having a problem doing an animation loop (a walk cycle in
    this case) in CS3. I never had this problem in Studio 8 and am
    wondering if I've gone crazy or if something has changed in CS3.
    The animation cycle works fine so long as I have it loop
    without using ActionScript, but when I try to loop it using
    gotoAndPlay it skips the last frame (i.e., the frame that the code
    is on). I tried adding an extra frame at the end and placing the
    code on it... it works a bit better, but there's still a bit of odd
    timing during the looping.
    Interestingly, when I save the fla as a Studio 8 file, it
    works fine (if I include that extra frame at the end). I may be
    misremembering, but it seemed to me that Studio 8 didn't require
    that extra frame before CS3.
    Has anyone else seen this? Anyone have a solution to share
    (I'm planning to use ActionScript3, so saving as Studio 8 won't
    solve my problems)?

    Sim-Enzo,
    > Interestingly, when I save the fla as a Studio 8 file,
    it works
    > fine (if I include that extra frame at the end). I may
    be
    > misremembering, but it seemed to me that Studio 8 didn't
    > require that extra frame before CS3.
    It shouldn't require that extra frame, but I wonder if
    you've somehow
    configured your FLA's publish settings for a version of
    ActionScript you're
    not actually using.
    > Has anyone else seen this? Anyone have a solution to
    share
    > (I'm planning to use ActionScript3, so saving as Studio
    8
    > won't solve my problems)?
    If your file works fine in Flash 8, then you must be using
    ActionScript
    2.0 (or lower) for the time being. Based on what you've
    described, I can't
    imagine what's going awry. Can you make that FLA available
    online
    somewhere? See if you can reproduce this issue with a
    simplified version,
    in case your company's policies (or whatever reason(s)) keep
    you from
    uploading the real file somewhere.
    I'll take a look.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Movie looping after starting syntax with stop command, no compiler and syntax errors...

    using action script...
    stop();
    btn001_btn.addEventListener(MouseEvent.CLICK,showimage1);
    function showimage1(event:MouseEvent):void {
    gotoAndPlay(10);
    btn002_btn.addEventListener(MouseEvent.CLICK,showimage2);
    function showimage2(event:MouseEvent):void {
    gotoAndPlay(20);
    however movie is playing without stopping to "Listen" for a Mouse CLICK. Images placed at frame 10 and 20 should appear only when CLICK'd.
    This code is straight out of Classroom in a Book CS4.
    Any suggestions?

    This action code is in frame 1 and frame 9 and 1
    9 have stop(); commands
    hmmmm

  • Center movie clips dynamically, as3.0

    Hi.  I have seen this discussed both on Adobe Forums and other sites but I can't seem to make sense of the code supplied by what I have seen thus far.
    I am trying to center display objects that are added to the stage at runtime dynamically through a basic drawing application.
    the code is something like this:
    1. add an event listener for the drawing event.
    2. add the path you want to draw to a container movie clip on the stage.
    3. add an enter-frame event listener to change the scale of the path randomly .... and this is the moment i want to change the default top,left registration point to the center,center of the path.  each path has its own registration point as i can tell thus far but at this point the scale is happening from the top,left of the container rather than about the path's own self.  and if it were to happen about the path i would have to get the bounds of the path and do some averaging to center the registration point.
    unfortunately i don't know what the code looks like to achieve what i'm trying to get.
    any help is appreciated.  thanks in advance.

    Well if using the graphics.lineTo method is Bitmap data then that is what I'm using.  But each call to the shape that I'm drawing is a new Shape(); .  The second paragraph you wrote seems a bit daunting when viewing it in the abstract sense.  Your first reply was a bit more concrete but I guess the first response didn't account for everything being in one container.  Should I create a container2 Movie Clip and create that as a new box on a per-shape basis so that I have multiple container2 mc's in the following path:
    container.container2[i].shape[i] where i would be an index (such that i++) though the code wouldn't be written exactly that way. ?
    (To store localX,Y positions in an array or vector shouldn't be too hard but I would need to try it several times before I get it right).

  • Play animation (movie clip) randomly as3

    Hello,
    Could anyone out there tell me what as3 code i should be using to make this happen.
    I want the animation (shooting star) to play at random times.
    Many thanks indeed.
    Damien

    on the last frame of your movieclip attach:
    stop();
    this.dispatchEvent(new Event("finished"));
    right click your movieclip in the library, click linkage, tick export for actionscript and assign a class (eg, Starmove).
    you can then use:
    var minTime:uint = 1000;
    var maxTime:uint = 3000;
    var timer:Timer=new Timer(timeF(),0);
    timer.addEventListener(TimerEvent.TIMER,starF);
    timer.start();
    function starF(e:TimerEvent){
    var star:Starmove=new Starmove();
    addChild(star);
    star.x = Math.floor(Math.random()(stage.stageWidth-star.width));  // these two will probably need adjustment
    star.y = Math.floor(Math.random()(stage.stageHeight-star.height)); // ditto
    star.addEventListener("finished",removeStarF);
    timer.delay = timeF();
    function removeStarF(e:Event){
    removeChild(e.currentTarget);
    e.currentTarget.removeEventListener("finished",removeStarF);
    e.currentTarget=null;
    function timeF():uint{
    return minTime+Math.floor(Math.random()*(maxTime-minTime));

Maybe you are looking for