Embedding GIF image

Hello!
Is there any convenient way to embed GIF image into flash
file? Embedding JPG image was easy using HTML <img> tag, but
that does not seem to work with GIF.
The reason I need this, so the argument ?image could be
passed to flash file and the image inside flash would switch
according to the passed argument (without editing .FLA file
itself).
Thank you in advance!

ok - the real problem here is that you are using the 'actual'
file as it loads to act as the preloader - in this case the
majority of the file will load previous to the preloader initiating
anything because it will not function until the file is
instantiated. a much better way of handling this is to use the
MovieClipLoader class and create a 'loading' swf file that IS the
preloader, which in turn 'loads' the actual swf. you then use the
onLoadProgress handler of the MCL class to control the events of
the load and then you can initiate the opening methods in the load
file using the onLoadInit handler.
so you would make a file that is the same size as the main
file, then place your preloader assets and code constructs for the
options you're using within that file - call mcl.loadClip() and
load the 'main' swf in that way. the preloader should then only be
a few k at the most and load almost instantly, and show the
progress properly. this is the best way to go when dealing with
large files.

Similar Messages

  • Embeding a .gif image in Flex Application.

    Hi All ,
         In my application , i have a requirement like : i need to play .gif images , But Flex does not support .gif animation , it will display .gif as normal .jpeg image.
    So i used : AnimatedGIFImage.as --> http://code.google.com/p/as3gif/
    But it is giving Error like :
    Please Help....

    I think that you are looking for a kind of this code. Am I right?
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GradientPaint;
    import java.awt.geom.Rectangle2D;
    import javax.swing.JFrame;
    public class DemoPaint
         public static void main(String args[])
              GradientFrame gf = new GradientFrame("Gradient Frame");
              gf.setSize(300,200);
              gf.setResizable(false);
              gf.setVisible(true);
    class GradientFrame extends JFrame
         Color red_color = new Color(128,0,0);
         GradientFrame(String title)
              super(title);
         public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              GradientPaint gp = new GradientPaint(0,0,red_color,getWidth(),0,new Color(red_color.getRed(),red_color.getGreen(),red_color.getBlue(),0));
              g2.setPaint(gp);
              Rectangle2D rect = new Rectangle2D.Double(0,0,getWidth(),getHeight()/2);
              g2.fill(rect);
    }

  • Blank Image when using a gif image from a SQL Server Database

    Post Author: scsmith
    CA Forum: Publishing
    Hello,
    I'm trying to use a field from a SQL Server DB that has embedded GIF files. In Crystal Reports when I add the field to the report the picture is blank for every row. Any ideas?

    Post Author: kchiu
    CA Forum: Publishing
    i'm having the same issue. 
    I believe crystal doesn't support gif datatypes.
    I'm trying to either convert the images, or find a work around in crystal, but haven't found anything.

  • Error while loading a logo .gif image to the banner

    Hi all,
    I'm running Portalea on NT platform and I receive the following error, trying to load a gif image as a logo to the banner (this is in spanish but I hope you can understand it):
    Wed, 27 Dec 2000 07:03:25 GMT
    ORA-06510: PL/SQL: excepcisn definida por el usuario no tratada
    ORA-06512: en "PORTAL30.WWDOC_DOCU_BRI_TRG", lmnea 60
    ORA-06510: PL/SQL: excepcisn definida por el usuario no tratada
    ORA-04088: error durante la ejecucisn del disparador 'PORTAL30.WWDOC_DOCU_BRI_TRG'
    DAD name: portal30
    PROCEDURE : PORTAL30.wwptl_banner.savecustom
    URL : http://ORACLE1:80/pls/portal30/PORTAL30.wwptl_banner.savecustom
    PARAMETERS :
    ===========
    ENVIRONMENT:
    ============
    PLSQL_GATEWAY=WebDb
    GATEWAY_IVERSION=2
    SERVER_SOFTWARE=Apache/1.3.12 (Win32) ApacheJServ/1.1 mod_ssl/2.6.4 OpenSSL/0.9.5a mod_perl/1.22
    GATEWAY_INTERFACE=CGI/1.1
    SERVER_PORT=80
    SERVER_NAME=ORACLE1
    REQUEST_METHOD=POST
    QUERY_STRING=
    PATH_INFO=/pls/portal30/PORTAL30.wwptl_banner.savecustom
    SCRIPT_NAME=/pls
    REMOTE_HOST=
    REMOTE_ADDR=192.168.100.224
    SERVER_PROTOCOL=HTTP/1.1
    REQUEST_PROTOCOL=HTTP
    REMOTE_USER=
    HTTP_CONTENT_LENGTH=6443
    HTTP_CONTENT_TYPE=multipart/form-data; boundary=---------------------------7d02753210f0280
    HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
    HTTP_HOST=oracle1
    HTTP_ACCEPT=application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-comet, */*
    HTTP_ACCEPT_ENCODING=gzip, deflate
    HTTP_ACCEPT_LANGUAGE=es
    HTTP_ACCEPT_CHARSET=
    HTTP_COOKIE=portal30=AB515A5F55262E576590647AC04D98A8EF1D5A6F56D19ECCD710BDB4A08D2354903C0CA288FDE0C9283E116C71C00B1B3821CEAB7A24979CFF326F4979143EE1FD147BC097C2AD7705313C93DAB32D8 4A6CF71C26B267CC0B2FEA03B385A2E84; portal30_sso=7452540140821A6010973F5CAC7E7D17C7498F309E15C228015C1C0546A702F5AFDE500B69BDCB8DE5C29DD726FC8DEEE85A1DC979ECC7B8A6A16CADEF1DAB0C0ACEC11897D5B99B1033884D61307BEA7AE581C 8AB988C8CBBBDCE6174BA01F6
    Authorization=
    HTTP_IF_MODIFIED_SINCE=
    null

    Hi,
    No errors was found in the installation log. I'm looking in the WWDOC_DOCUMENT$ table and found records that make references to my previous tries to upload the logo image. In order to make others tries, how can I delete this information? Are references to this files in any other table?.
    I'm looking over the solution provide by Laurent Baresse, refering to the NLS_LANGUAJE problem ... (Thanks Laurent).
    Best regards
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Karthika Siva ([email protected]):
    Fernando,
    Are you able to upload any documents into a content area? Please look at your installation log file (install.log) for any errors that may have occured during the installation of the product. Also make sure that the tablespace containing the WWDOC_DOCUMENT$ table is not full.
    Karthika<HR></BLOCKQUOTE>
    null

  • Animated Gif Image does not render correctly on screen

    I have added animated gif image to the scene it does not render correctely.it shakes on the screen. plz give me any suggestion
    i use following code
    Image logo= new Image(getClass().getResourceAsStream("images/image.gif"));
    logoLabel.setGraphic(new ImageView(logo));

    Hello user,
    I think gif are rendered smoothly.
    Are you sure you are not making many object of same images everytime?
    Thanks.
    Narayan

  • Animated gif image

    Hi
    I like to create an animated gif image from a given set of images with java. I like to do this with the given set of java api as I do not want to use a commercial graphics library. Can anyone provide me with a sample example.
    Thanks

    Hi
    I like to resize a gif image. Currently i am using the following code but the resized image is not smooth.
    public BufferedImage resizeImage(BufferedImage img, int newW, int newH)
              int w = img.getWidth();
              int h = img.getHeight();
              BufferedImage dimg = new BufferedImage(newW, newH, img.getType());
              Graphics2D g = dimg.createGraphics();
              g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
              g.drawImage(img, 0, 0, newW, newH, 0, 0, w, h, null);
              g.dispose();
              return dimg;
    Is there a way to resize a gif image in a smooth way as the example given in the gif4j library
    Thanks

  • Animated GIF image gets distorted while playing.

    Hi,
    I have some animated gif images which I need to show in a jLabel and a jTextPane. But some of these images are getting distorted while playing in the two components, though these images are playing properly in Internet Explorer. I am using the methods insertIcon() of jTextPane and setIcon() of jLabel to add or set the gif images in the two components. Can you please suggest any suitable idea of how I can get rid of this distortion? Thanks in advance.

    In the code below is a self contained JComponent that paints a series of BufferedImages as an animation. You can pause the animation, and you specify the delay. It also has two static methods for loading all the frames from a File or a URL.
    Feel free to add functionality to it, like the ability to display text or manipulate the animation. You may wan't the class to extend JLabel instead of JComponent. Just explore around with the painting. If you have any questions, then feel free to post.
    The downside to working with an array of BufferedImages, though, is that they consume more memory then a single Toolkit gif image.
    import javax.swing.JComponent;
    import java.awt.image.BufferedImage;
    import java.awt.Graphics;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.ImageInputStream;
    public class JAnimationLabel extends JComponent {
        /**The default animation delay.  100 milliseconds*/
        public static final int DEFAULT_DELAY = 100;
        private BufferedImage[] images;
        private int currentIndex;
        private int delay;
        private boolean paused;
        private boolean exited;
        private final Object lock = new Object();
        //the maximum image width and height in the image array
        private int maxWidth;
        private int maxHeight;
        public JAnimationLabel(BufferedImage[] animation) {
            if(animation == null)
                throw new NullPointerException("null animation!");
            for(BufferedImage frame : animation)
                if(frame == null)
                    throw new NullPointerException("null frame in animation!");
            images = animation;
            delay = DEFAULT_DELAY;
            paused = false;
            for(BufferedImage frame : animation) {
                maxWidth = Math.max(maxWidth,frame.getWidth());
                maxHeight = Math.max(maxHeight,frame.getHeight());
            setPreferredSize(new java.awt.Dimension(maxWidth,maxHeight));
        //This method is called when a component is connected to a native
        //resource.  It is an indication that we can now start painting.
        public void addNotify() {
            super.addNotify();
            //Make anonymous thread run animation loop.  Alternative
            //would be to make the AnimationLabel class extend Runnable,
            //but this would allow innapropriate use.
            exited = false;
            Thread runner = new Thread(new Runnable() {
                public void run() {
                    runAnimation();
            runner.setDaemon(true);
            runner.start();
        public void removeNotify() {
            exited = true;
            super.removeNotify();
        /**Returns the animation delay in milliseconds.*/
        public int getDelay() {return delay;}
        /**Sets the animation delay between two
         * consecutive frames in milliseconds.*/
        public void setDelay(int delay) {this.delay = delay;}
        /**Returns whether the animation is currently paused.*/
        public boolean isPaused() {
            return exited?true:paused;}
        /**Makes the animation paused or resumes the painting.*/
        public void setPaused(boolean paused) {
            synchronized(lock) {
                this.paused = paused;
                lock.notify();
        private void runAnimation() {
            while(!exited) {
                repaint();
                if(delay > 0) {
                    try{Thread.sleep(delay);}
                    catch(InterruptedException e) {
                        System.err.println("Animation Sleep interupted");
                synchronized(lock) {
                    while(paused) {
                        try{lock.wait();}
                        catch(InterruptedException e) {}
        public void paintComponent(Graphics g) {
            if(g == null) return;
            java.awt.Rectangle bounds = g.getClipBounds();
            //center image on label
            int x = (getWidth()-maxWidth)/2;
            int y = (getHeight()-maxHeight)/2;
            g.drawImage(images[currentIndex], x, y,this);
            if(bounds.x == 0 && bounds.y == 0 &&
               bounds.width == getWidth() && bounds.height == getHeight()) {
                 //increment frame for the next time around if the bounds on
                 //the graphics object represents a full repaint
                 currentIndex = (currentIndex+1)%images.length;
            }else {
                //if partial repaint then we do not need to
                //increment to the the next frame
    }

  • Digital watermarking gif images

    I ve writed a program which watermarks png and non-animated gif images .But there is a problem because we started to use animated gif images. How can we watermark animated gif images without corrupting animation of the image?
    Regards
    Murat

    I haven't done much with gif animation, but here's an example that extracts the series of BufferedImages
    from a gif file. Good luck!
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import java.net.URL;
    import java.util.*;
    import javax.imageio.*;
    import javax.imageio.metadata.*;
    import javax.imageio.stream.*;
    import javax.swing.*;
    import org.w3c.dom.*;
    public class ViewGif extends JPanel {
        private BufferedImage[] images;
        private Point[] offsets;
        private BufferedImage composite;
        public static void main(String[] args) throws IOException {
            JPanel app = new ViewGif();
            app.setBackground(Color.RED);
            JFrame frame = new JFrame("ViewGif");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(new JScrollPane(app));
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public ViewGif() throws IOException {
            URL url = new URL("http://members.aol.com/royalef/sunglass.gif");
            Iterator readers = ImageIO.getImageReadersBySuffix("gif");
            if (!readers.hasNext())
                throw new IOException("no gif readers");
            ImageReader reader = (ImageReader) readers.next();
            if (readers.hasNext())
                System.out.println("(there were oither readers)");
            ImageInputStream iis = ImageIO.createImageInputStream(url.openStream());
            reader.setInput(iis);
            final int numImages = reader.getNumImages(true);
            images = new BufferedImage[numImages];
            offsets = new Point[numImages];
            for(int i=0; i<numImages; ++i) {
                images[i] =  reader.read(i);
                offsets[i] = getPixelOffsets(reader, i);
            composite = new BufferedImage(images[0].getWidth(), images[0].getHeight(),
                BufferedImage.TYPE_INT_ARGB);
            final Graphics2D g2 = composite.createGraphics();
            g2.drawImage(images[0], offsets[0].x, offsets[0].y, null);
            new javax.swing.Timer(100, new ActionListener(){
                int j = 1;
                public void actionPerformed(ActionEvent evt) {
                    g2.drawImage(images[j], offsets[j].x, offsets[j].y, null);
                    j = (j+1) % numImages;
                    repaint();
            }).start();
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Insets insets = getInsets();
            g.drawImage(composite, insets.left, insets.top, null);
        public Dimension getPreferredSize() {
            Insets insets = getInsets();
            int w = insets.left + insets.right + composite.getWidth();
            int h = insets.top + insets.bottom + composite.getHeight();
            return new Dimension(w,h);
        static Point getPixelOffsets(ImageReader reader, int num) throws IOException {
            IIOMetadata meta = reader.getImageMetadata(num);
            Point point = new Point(-1,-1);
            Node root = meta.getAsTree("javax_imageio_1.0");
            for (Node c = root.getFirstChild(); c != null; c = c.getNextSibling()) {
                String name = c.getNodeName();
                if ("Dimension".equals(name)) {
                    for (c = c.getFirstChild(); c != null; c = c.getNextSibling()) {
                        name = c.getNodeName();
                        if ("HorizontalPixelOffset".equals(name))
                            point.x = getValueAttribute(c);
                        else if ("VerticalPixelOffset".equals(name))
                            point.y = getValueAttribute(c);
                    return point;
            return point;
        static int getValueAttribute(Node node) {
            try {
                return Integer.parseInt(node.getAttributes().getNamedItem("value").getNodeValue());
            } catch (NumberFormatException e) {
                return -2;

  • Problem at displaying animated gif images !!!!!!!!!!!!

    hello everyone......i am trying to display an animated gif image..............so till far i have no issues on this....
    but i face problem when :
    i have created a class called SimpleGame which extends JPanel....
    public class SimpleGame extends JPanel
    //code
    public void paintComponent(Graphics g)
    //code to draw image
    }now i have written another class with main method
    public class MyGame extends SimpleGame
    public MyGame()
            JFrame frame=new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(800, 600);
            frame.setUndecorated(true);
            frame.setLocationRelativeTo(null);
            frame.getContentPane().add(this);
            frame.setVisible(true);
            this.repaint();
    }so image gets displayed but only one frame of animated image......image that is displayed is static.....since it is a animated gif,,,,,so some how animation is not rendered......only one frame is displayed......
    why is it happening ??
    if i try to display animated image from a single class i mean my paintComponent method and main method is at same class then i do not face problem.....
    but if my paint method is in another class and i am using that method from another class then animation does not get rendered.........
    any help !!!!! please...........

    class SimpleGame extends JPanel
    Image img=new ImageIcon("y.gif");
    public void paintComponent(Graphics g)
    g.drawImage(img,150,150,this);
    }main class//
    class MyGame extends SimpleGame
    public MyGame()
            JFrame frame=new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(800, 600);
            frame.setUndecorated(true);
            frame.setLocationRelativeTo(null);
            frame.getContentPane().add(this);
            frame.setVisible(true);
            this.repaint();
    public static void main(String[] args)
    new MyGame();
    }my image gets displayed.......but only single frame of a animated image....animation is not happening..........

  • Animated gif images not working, n73 problem pleas...

    my phone is n73music. when i try to use animated or gif images as wallpapers, the images are not moving as they should do in standby mode on the display. what could be the problem, please advice. thankyou.

    Sorry, N73/ME is a s60 phone and s60 doesnt support moving animated GIG, PNG file format as wallpaper

  • Animated GIF Image on a JPanel.

    How can I display an animated GIF image on a JPanel? It should animate after displaying.
    Regards

    I think this code should display an animated GIF image on a JPanel.
    -Mani
    import javax.swing.*;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.*;
    public class Animation {
    public static void main(String args[]) {
    JLabel imageLabel = new JLabel();
    JLabel headerLabel = new JLabel();
    JFrame frame = new JFrame("JFrame Animation");
    JPanel jPanel = new JPanel();
    //Add a window listner for close button
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    // add the header label
    headerLabel.setFont(new java.awt.Font("Comic Sans MS", Font.BOLD, 16));
    headerLabel.setText("Animated Image!");
    jPanel.add(headerLabel, java.awt.BorderLayout.NORTH);
    //frame.getContentPane().add(headerLabel, java.awt.BorderLayout.NORTH);
    // add the image label
    ImageIcon ii = new ImageIcon("d:/dog.gif");
    imageLabel.setIcon(ii);
    jPanel.add(imageLabel, BorderLayout.CENTER);
    frame.getContentPane().add(jPanel, java.awt.BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
    }

  • Problem with Gif image

    Having a problem with gif image not showing up. It will show up in netscape6.2, but not in IE 5.0. Both are using the java 1.4 plugin. They are basic buttons (zoom in, zoom out, etc) and they actions work, just the icons aren't showing. Any help would be great! Below is a snip of code:
    JPanel toolBarsPanel = new JPanel();
    javax.swing.JToolBar toolbar = new javax.swing.JToolBar();
    JButton zoomin = new JButton(new ImageIcon("tut/zoomin.gif"));
    JButton fullext = new JButton(new ImageIcon("tut/fullextent.gif"));
    JButton identify = new JButton(new ImageIcon("tut/identify.gif"));
    JButton btn = new JButton(new ImageIcon("tut/addtheme.gif"));
    toolbar.add(zoomin);
    toolbar.add(fullext);
    toolbar.add(identify);
    toolbar.add(btn);
    add(toolbar, BorderLayout.NORTH);
    Thanks again for any help!

    I used to do a lot of work in this sort of thing. After a while we were able to convince our bosses to use generated HTML (JSPs, etc.), so the problem moved to porting JavaScript to different platforms! (Platforms in this context means the different browser/OS combinations, etc.).
    The only two things I can recommend are:
    - complete control over you code. You will have to fix it! (Tried you apps on a Mac yet?)
    - assume a minimal install. Don't assume users are going to have any fancy tools installed on their PC, unless you are developing an Intranet app, where you know the spec of the machines that are going to be using it.
    As regarding getting IE to use a relative address, I don't think you are going to have any luck their, I'm afraid! (Although I am curious. It has been some time, but I though it did use relative addresses. Are you absolutely sure about this, did you check this out with System.outs and that?
    HTH,
    Manuel Amago.

  • Photoshop CS4 Gif Image

    Sir,
    i am using photosop cs4. and making a gif image of width & height of (928x82). but when i am exporting it to gif image, it's quality get reduced. Is there any way to keep the quality of gif image intact after exporting. please do the needfull ASAP.

    Sir, i have tried an animated gif with background color and another animated gif without background color.
    Gif with background color keeps text resolution safe. But Gif without background color disturbs the text resolution. why is it so?  bcz i want an animated transparent gif.

  • Loss transparency in an animated GIF image when resizing

    Hi Friends,
    I have to write a program to resize GIF, JPEG , and PNG images. I wrote and it works but when i resize a GIF file it loses its transparency and give a black color for transparent area.
    I used a GifDecoder found at www.fmsware.com/stuff/GifDecoder.java
    and a gif encoder found at jmge.net/java/gifenc/Gif89a090b.zip.
    i don't know where the problem is .
    i have some small problems in here.
    How can i preserve the transparency of GIF image?
    How can i set a transparent color in Graphic2D object? smtimes it may help me. or error may be in the encoder.
    Help me guys.
    Thanks and regards,
    Manjula

    Java comes with gif encoder/decoders.
    Gifs are indexed images. This means that, for example, each pixel is an 8 bit value that is used to look up the correct 24 bit value in the index table. Gifs handle transparency by allowing one particular pixel value to be nominated as transparent.
    If you just rescale the image then you will likely cause pixels with the magic "transparent" value to change their value and become normal pixels. Alternately pixels that are not transparent may have their values changed such that they are transparent.
    Possibly the easyist solution to to force the image into a full RGBA image. Scale this then perform post processing on the image. I.e convert it back into an indexed image, looking at the values of the alpha channel (prior to making it indexed and if they are high enough then modify the corresponding pixel in the indexed image to have the magic transparent value. Then use Metadata passed to your Image writer to indicate which value is transparent.
    matfud

  • Problem Saving Gererating GIF Image

    Hello, we are having a problem in production environment when try to right mouse and select Print on an mii grid. Works just fine in all of our non-production environments. Checked the System Security pull downs and they all matched non-prod. Was not sure which one to compare, was not a ImageStorageServlet on pull down menu.
    After right mouse and select Print on grid, get:
    -Java Applet Window popup message - Problem Saving Gererating GIF Image
    -Then - blank browser page - .../XMII/ImageStorageServlet/View/null
    - Non-production servers works fine produces grid on browser page - XMII/ImageStorageServlet/View/2084280301
    NetWeaver Log:
    Location - com.sap.xmii.servlet.ImageStorageServlet
    Full Message Text
    ImageStorage - Error saving GIF file 
    Full Message Text
    ImageStorage - Error generating GIF output
    Any help would be appreciated.
    Thanks

    David,
    Have you put in a support ticket for this? I recommend doing so since its occurring in your production environment. You should also attach your log files as well.
    Regards,
    Kevin

Maybe you are looking for