Animated Gif won't stop looping!

I'll try to format my question as best I can.
I have created a Java chat applet, and for the Java chat, I have created a "ChatPane" class for displaying the chat. ChatPane is an extension of Canvas, and every time the paint() method is called, the program loops through visible lines of text drawing them on a buffer image, then draws the buffer on the screen.
My problem lies in animated gifs. In my chatroom, chatters can type textual symbols that will be replaced with an image (or emoticon). I have created my animated icons in a popular animated gif editing program, and I have set particular icons to loop 3 times. The problem is that when the animated icon is displayed in my applet, the animation -doesn't stop- after 3 loops, it loops forever! I can't for the life of me figure out why! Can anyone provide any insight as to why the animations won't stop after 3 loops? The animations work just fine if displayed in a browser by themselves (they stop looping after 3 times)
Thank you for any help!
[email protected]
Tony N.

From what I understand of your problem;
- You have made your own animated gifs
- With the software to make these gifs you have set them to loop their animations 3 times
- They loop continuously
I don't see how java can be expected to interpret the animated gif software instructions to loop only 3 times and would assume that there are various proprietry ways of setting this (an assumption based on applets /javascript etc, that rely on the client-side browser interpreter). So, if you loop your animated gif or have any form of animated gif that you import into your program with getDocumentBase /getCodeBase as a (pre-animated) gif, then this is exactly what I would assume would happen.
The answer is to seperate your images with eg;-
smiley1[0];
smiley1[1];
smiley1[2];
run a seperate thread, cycle through them as you wish and stop.
I'm fairly sure that there is nothing in either the swing libraries or the jmf libraries that can resolve this any other way, so your choices are write extra code and have a pool of threads to control this, or leave it as is.

Similar Messages

  • Animated .gif won't loop a specified amount of times

    I created an animated .gif in photoshop and set it to loop twice. It works fine in every other browser except firefox. Here is a test example:
    http://elliottkirby.com/test/
    The box is set to animate across twice. Any thoughts? I tested setting it to loop "forever" and it works in FF...however the ad I'm creating has a loop time limit. I checked my config settings and image animation is set to normal. Thanks!

    From what I understand of your problem;
    - You have made your own animated gifs
    - With the software to make these gifs you have set them to loop their animations 3 times
    - They loop continuously
    I don't see how java can be expected to interpret the animated gif software instructions to loop only 3 times and would assume that there are various proprietry ways of setting this (an assumption based on applets /javascript etc, that rely on the client-side browser interpreter). So, if you loop your animated gif or have any form of animated gif that you import into your program with getDocumentBase /getCodeBase as a (pre-animated) gif, then this is exactly what I would assume would happen.
    The answer is to seperate your images with eg;-
    smiley1[0];
    smiley1[1];
    smiley1[2];
    run a seperate thread, cycle through them as you wish and stop.
    I'm fairly sure that there is nothing in either the swing libraries or the jmf libraries that can resolve this any other way, so your choices are write extra code and have a pool of threads to control this, or leave it as is.

  • Animated gif will not stop when placed in director

    I have an animated gif I am trying to place into a director
    file.
    When its placed and I press play it will play the animated
    gif over
    and over. I also took the gif and saved it as a swf file
    placed it in
    director it does the same thing. Please tell me what I am
    missing.
    Also I will show the dir file if you need to see it.

    Oops - wrong button - didn't mean to send that yet...
    anyway...
    You don't have much control over Animated Gif members in
    Director. You
    can use
    sprite(animGifSprite).pause()
    to stop the animation and
    sprite(animGifSprite).resume()
    to restart it. The tricky bit is knowing when to do those
    things.
    There is no way I know of to find out if the sprite is at the
    end of
    it's image sequence.
    Perhaps a better way of going about it would be to take the
    animation
    apart into individual frames and load them into a swf member
    (in Flash)
    or a Film Loop in Director. You may have more control over
    the
    animation that way.
    The fact that it keeps repeating over and over again is sort
    of the
    point of an animated gif... though I believe that you can
    make an
    animated gif that specifically does not loop back to the
    start using
    ImageReady or the newer version of Photoshop. Though I have
    not tried
    this...

  • How Do I Change an Animated Gif's Iteration and Loop Settings? (Pshop/Image Ready 7.0)

    Background to Issue (NOT a PPT or Windows issue even though It will seem like that at first but read on...): I have to make Animated GIFS to be inserted into Powerpoint. I work on a Mac but the PPT presentation will be shown on PCs (non-negotiable, since I can't ask hundreds of sales reps who will be using this to install an outdated version of PPT). I already learned that I need to insert the Gifs while working on a PC or else it won't work). Fair enough- I can put it together on a PC, again not the issue. BUT, when I do THAT, the gifs still wn't animate unless I am in PPT 2002. Fair enough (Microsif going backwards not a surprise) So it won't work in PPT 2003 which is what the users will all have. But I need to get the presentation to them asap! I got a bit further in researching and found out that the solution is that I need to set my "Loop Flag" and "Iteration Settings" appropriately. See this link (http://www.soniacoleman.com/Tutorials/PowerPoint/animated_gifs/gifs.htm)
    BUT I am trying to find out if one can do this already somehow in Mac Photoshop 7.0 or Mac Image Ready 7.0, where I made the gif and would prefer to keep making my gifs. Maybe I need to upgrade Image Ready or Pshop to CS? SO THE FINAL QUESTION IS: Is there another way to manual do this without this PC Plug-in?
    NOTE: Yes, I know how how to set the loop to "once" or "forever" in Image Ready when I make my Gifs but apparently I need to do this somewhere else...where the iteration setting lives too?

    There is an ImageAnimator so you may not need to use byte array instead.
    ImageAnimator.Animate Method
    http://msdn.microsoft.com/en-us/library/system.drawing.imageanimator.animate(v=vs.110).aspx
    chanmm
    chanmm

  • Flash won't stop looping

    I have imported a 4 second SWF into Captivate 4. I want it to play through once then stop on the last frame of the SWF. The SWF has a stop embedded on the last frame. The problem is; it won't stop, but keeps on looping right through the SWF stop. I tried placing a 'Next' button with a "Pause after n seconds" on it and used varying intervals from 1 to 5 seconds for the pause to take effect but, you guessed it, the SWF just keeps on a-rolling along. The screen does stay put and does not continue until the 'Next' button is clicked - but I'm trying to get the SWF to play nice, and it won't!
    It seems to be the opposite problem to this post > http://forums.adobe.com/thread/607598 where they want to keep it looping, but it stops instead. Unfortunately there's no answer in this post so I can't reverse engineer a solution!
    Caviat: A colleague created the swf to my spec and I'm assuming they did in fact put the stop where requested. Will post an update if they did not do this.

    Your mismatched timing might be due to the frame rate of the Flash SWF not matching the frame rate of the Captivate movie.
    Check with your Flash developer again to find out what the frame rate was (e.g. 30 frames per second).  Get him to match it to the Captivate project.
    The issue with Flash animations needing to be on the main timeline has been documented before in these forums.  It wasn't an issue in Cp4 but has become so in Cp5 because the new architecture actually loads all the animations at the beginning of the movie. This means that by the time you reach the slide where you want the animation to play, it's already played long before.  This only affects SWF animation that have buried the animation inside a symbol, which is what Flash developers often do to make it all easier to resize and reposition as needed.  When the animation is happening one level down from the main timeline, you can trigger this animation to work properly in Captivate 5 by using some ActionScript in the Flash animation's main timeline.  Here's how:
    Create your animation as a symbol on a single keyframe so that the animation happens on the level one level down from the main timeline.
    Give the animation symbol an instance name (e.g. Fred).
    Add a new layer to the main timeline for ActionScript.  You're only going to need two frames on the main timeline with keyframes on each one.
    Put a stop(); action on the second frame so that it stops the main timeline.
    On the first keyframe put this code or similar: Fred.gotoAndPlay(1);
    What happens here is that when the Captivate SWF loads it will load your animation and start playing it but it will be stopped at the second frame of the main timeline.  When it gets to the slide where you want it to play, it will begin playing again, hit the first frame and then the AS code there will tell the Fred animation to play from its first frame. Hopefully there will be a stop action on its own timeline to terminate it as well.
    I've had to use this trick several times when trying to use the Right_Mark and Wrong_Mark tick and cross SWF animations that come with Captivate 5.  They've obviously not been updated to work properly since the change from Cp4.
    Hope this helps.

  • Animated gif won't work in safari

    I put an animated gif in iWeb and it runs fine in the site in Windows IE 7 and Firefox 3.5, and on my Mac in Firefox, But you can just see the initial frame in Safari.
    Actually I put two on there, the little flag works (has a transparent layer over it to make it clickable), but the bigger one, with 13 layers, does not.
    Is there something in Safari that I need to set?
    http://www.widman.biz/Corvair/English/English.html

    I've been having the same issue. gifs from the web load fine in firefox, but i safari they take forever.
    Also I've noticed that a lot of streaming videos that used to stream just fine are now choppy and start and stop due to slow load times.
    Any help appreciated.

  • Animated GIF won't animate or not even show at all

    I have been using animated GIF with no problem so far but now with iWeb 08 sometimes it works with certain GIFs documents or sometimes won't with other GIFs documents. Why ? And what can I do about this ? What is the solution ?
    Message was edited by: Ti-Jean

    Well Bababooey if you're comparing yourself to a Apple Genius Bar then you should already know my answer, your snarky remark get a snarky reply.  Why would I go to a salesperson to fix my computer problem when I can go directly go to the source itself.  I used to sell Apple computers over 8 years ago and was apple certified before the Genius bar existed. If I am to go about fixing an issue I can't fix on my own I will go to the source itself meaning Apple's programmers and developers - being UI UX Developer myself I know they should have QA'd all platforms and troubleshooted any arising issues. 
    This was also the first time in the 20 years I've been using a Mac that I even attempted to go on this forum which i thought would put me in connection with a certified Apple representative.  This turned out to be a complete waste of time just being a public forum with no Apple employee involved.  I was hoping to find a quick fix but in turn I was only frustrated with stupid responses such as yours that were in no way an answer to my original question. 
    BTW I fixed the issue on my own and without your help or Apples help. I'm glad if all forums point here regarding this issue because I now have the answer. The answer I was looking for from someone earlier was as simple as this {Download Maverick and reinstall the platform - it will take an hour to do but afterward 10.9.2 was installed and my computer is now able to shutdown and restart without having to do a hard boot.}  No more software update bar at top and no problems with my drive which I told both you and Grant - I know my computer better than you and I've probably been using them longer than you. 
    So again Babowa you were so wrong...... and I am right.
    Again anyone having the same problem, I suggest reinstalling Maverick and you'll be suprised 10.9.2 will work fine.

  • Animated Gifs won't animate when forwarded to other people from mail...

    I received a cute series of animated gif files via email today. I decided to forward the mail to a few friends and included myself on the list since I've had issues with forwarded gif files not animating in the past. Several friends received the files in working order. Others, including myself, received what appear to be the first frame of each of the animations but not animating at all.
    Any suggestions?
    Bruce

    try another usb port but usb is a poor way to charge the batt.
    if you look under menu/settings/batt, at the bottom it says you won't show a full charge with usb charging.
    i have the phone off & charge with wall adapter for 3 hours.

  • Animated GIF won't Animate while page is loading

    Hi all,
    I need my animated gif to be animated while other page elements are loading, but it is frozen until the page loads. Any advice?
    Regards,
    Kelly
    Personal Blog: http://thebitsthatbyte.com

    There are few options available, refer to the following posts,
    http://stackoverflow.com/questions/5829382/animated-gif-while-loading-page-does-not-animate
    http://www.webdeveloper.com/forum/showthread.php?90647-RESOLVED-ie-animated-gif-freeze-til-page-loads
    http://forums.asp.net/t/1814498.aspx?loader+gif+IE+problem
    --Cheers

  • Animated GIFs won't display properly in Mail.app

    I have a weird problem with animated GIFs received as attachments in Mail.app. On my Mac mini, they're only displayed as the first frame within the Mail message window and the animations don't play. But on my iMac G4, the same messages display the animations properly within Mail.app. Both Macs are currently running Mac OS X 10.4.4, but I've observed this problem since 10.4.3. I have the same software installed on both machines. Does anyone have any ideas why this is happening?

      * Test.java
      * Created on January 13, 2007, 6:52 PM
      * To change this template, choose Tools | Template Manager
      * and open the template in the editor.
    package Test;
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
      * @author Calbrenar
    public class Test extends JFrame
        private JList testList;
        private DefaultListModel listModel;
        private JScrollPane serverLogScroller;
        private Container container;
        /** Set up GUI */
        public Test()
           super ("List Test");
           //Get content pane
           container = getContentPane();
           container.setLayout(new FlowLayout());
           listModel = new DefaultListModel();
           listModel.addElement("");
           testList = new JList(listModel);
           testList.setVisibleRowCount(1);
           //testList.setFixedCellHeight(35);
           //testList.setFixedCellWidth(400);
           serverLogScroller = new JScrollPane(testList);
           serverLogScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
           serverLogScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
           container.add( new JScrollPane( testList));
           setSize(700, 75);
           setVisible(true);
        public void addStatus(String str)
           listModel.add(0, str);
           //testList.setPreferredSize(new Dimension(400, 15));
           //serverLogScroller.revalidate();
           container.validate();
        public static void main ( String args[])
           Test application = new Test();
           application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
           application.addStatus("-ERR");
           application.addStatus("+OK Enter Password");
           application.addStatus("-ERR Bad Pass");
    } // end class Test

  • Flash CS5 Won't Stop Looping, Even with Stop Action in Place

    The timeline has a stop action at the end of the movie (frame 770), but continues to loop. Publish Settings HTML tab has "loop" unchecked as well.
    The movie has a lightning storm that plays throughout the entire timeline that was purchased from iStockPhoto. Perhaps some of their coding is conflicting (see below coding). Other than those two codes for the storm, the only other code in the Action script is a stop action at the end of the movie. Hope someone can help me out. Thanks!
    ACTION: LAYER FRAME 1
    setProperty("", _x, random(420));
    if (random(2) == 0)
        setProperty("", _xscale, -100);
    else
        setProperty("", _xscale, 100);
    } // end else if
    ACTION: LAYER FRAME 13
    if (random(50) != 0)
        gotoAndPlay(12);
    } // end if
    ACTIONS FRAME 770
    stop();

    Hi, I noticed your thread. Did you know you are on the Flash Player Forum that is for the browser plugins?
    I'm not even sure which Adobe Forum would be the best but you can choose from here:
    http://forums.adobe.com/index.jspa
    Thanks,
    eidnolb

  • Non-looping animated gif issue....

    Hi, I have an issue with animated gif files where they do not replay correctly when I return to the slide that contains them. They play fine the first time viewed, but not if you return to it. It seems the only way I'm able to keep the gif playing is if I set it to endlessly loop. And if I do that, the animation doesn't start from the beginning when I return to the slide. I just want the animation to start over and play from the beginning once every time I go back to the slide.
    My animations were made in Flash and exported as gif animations. I'm using Captivate 7 and my client needs the course to be all HTML5 (no Flash).
    Has anyone been able to get a animated gif (not set to loop) to play correctly (meaning from the beginning of it) if you return to the slide after viewing it already?
    Thanks,
    Dan

    Hey Rick, thanks for your reply. I liked you idea and had hope, but I tried this and it had no effect. What I have figured out from testing however is that if I go back 1 to 5 slides and return to the animation slide it doesn't reset and just shows the last slide of the animation only. But if I go back 6 or more it does reset the animation. That's very strange! I tested this several times and got the same result. I wonder if there is a buffer of memory of some sort that drops slide info after 5 slides? Or something stranger?

  • Animated GIF frame loss

    I have an applet that has a JPanel with a JLabel in it. That JLabel was created with an ImageIcon constructor with an animated gif image. The gif has eleven frames (each with replace set) and is set to loop. When I bring up the applet the image animates through the first 7 frames then stops. I can File/Open the gif in Netscape and it looks fine - animates all images and loops. Looking at it with:
    setDebugGraphicsOptions(DebugGraphics.BUFFERED_OPTION); or FLASH_OPTION
    it looks good until that 7th frame then I start to see flash of grey the size of the JLabel.
    I understand that the ImageObserver defaults to the JLabel. But I have tried directly setting it with no joy. I have also tried calling .flush() on the image with no joy. So I tried a different animated gif and it stopped on the 3rd frame (but also appears fine in a browser).
    I am on day 2 of trying to figure this out (pulling my hair out).
    I cut this down quite a bit, so there may be syntax errors.
    public class RRR extends JApplet implements RRRConsts
    public void init()
    loadImages();
    myJPanel = new MyJPanel();
    contentPane.add(myJPael);
    private void loadImages()
    try
    problemImage = loadImage(new URL(getDocumentBase(),
    "problem.gif"));
    catch (Exception e)
    { logger.log(Level.SEVERE, "Unable to load images", e); }
    private Image loadImage(URL url) throws InterruptedException
    Image image = getImage(url);
    MediaTracker tracker = new MediaTracker(this);
    tracker.addImage(image, 0);
    tracker.waitForID(0);
    return image;
    MyJPanel myJPanel = null;
    static Image problemImage = null;
    class MyJPanel extends JPanel implements RRRConsts
    MyJPanel()
    setLayout(null);
    setBounds(0,0,468,540);
    setOpaque(false);
    buildUI();
    private void buildUI()
    myLabel = new MyLabel();
    add(myLabel);
    private MyLabel myLabel = null;
    class MyLabel extends JLabel implements RRRConsts, ActionListener
    MyLabel()
    super(new ImageIcon(RRR.problemImage));
    }

    I just had the same problem. It seems that when using an animated gif as ImageIcon it will not be loaded compeltly if it is too large. The maximum seems to be somewhere between 60 - 70 KB.
    I managed to use a higher compression on my gifs to make them smaller, but I haven't found any general solution yet.

  • An Animated GIF displays, i.e. moves, for about 5 minutes, then freezes. Other GIFs from the site work indefinitely, and this GIF works indefinitely on IE. Why does it freeze in Firefox?

    An Animated Avatar GIF file moves as expected for about 5 minutes, and then freezes. Other animated avatars from the same site work fine, and move indefinitely. To confirm that the site had not exchanged the file for a non-animated version, I right-clicked and selected 'View Image Info' and when I did so, it moved for about half a second. (The image file was the one uploaded.) Loaded the page in IE, this avatar moves indefinitely.
    Any ideas why an animated GIF stops in Firefox?

    The answer is that Animated GIF files include a Loop Enable Flag as well as a Loop Limit Count. This GIF had a count which should have allowed it to loop for almost 2 hours. But in Firefox it only loops for about 5 minutes.
    It appears Firefox is misinterpreting this value to be a Frame Count rather than a Cycle Count.
    Is there any Firefox Employees reading this, and can acknowledge this has been added to their Opportunity (a.k.a. Bug) List?

  • Why doesn't the "View image info" show how many frames are in animated gifs?

    When I right click on an image, then click "View Image Info" it used to show how many frames were included in an animated gif. This stopped working in Firefox 4. Why is that?

    I'm not too sure what I did but it works now.

Maybe you are looking for