Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8517551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:43:59+00:00 2026-06-11T05:43:59+00:00

The Flash Player does not offer native support for animated GIF files. In the

  • 0

The Flash Player does not offer native support for animated GIF files. In the DHTML runtime, you can just use an animated GIF like any other image resource. But how can an image be used as a resource for a view in the SWF10 or SWF11 runtime?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:44:01+00:00Added an answer on June 11, 2026 at 5:44 am

    Luckily there are a number of existing open source ActionScript libraries with support for playing and generating animated GIFs. We are going to use the as3gif project. We first have to compile the ActionScript source code of as3gif into an SWC library, which then can be used with OpenLaszlo. Download the ZIP file with version 0.6 of as3gif. Extract the ZIP file in your $LPS_HOME folder. You should have a subfolder “GIFPlayer 0.6”.

    $LPS_HOME/GIFPlayer 0.6/

    Go into that folder, and use the Flex SDK compc command to compile the ActionScript classes into an SWC file. For OpenLaszlo 4.9 or 5.0 (as of September 2012), the compc command can be found in $LPS_HOME/WEB-INF/bin/compc. If you use the flex4.6 branch of OpenLaszlo, the path to the compc command is either WEB-INF/flexsdk/4.5.1/bin/compc for the SWF10 runtime, or WEB-INF/flexsdk/4.6.0/bin/compc for the SWF11 runtime.

    $LPS_HOME/WEB-INF/bin/compc -optimize=true
    -static-link-runtime-shared-libraries=true -source-path+=. -output=bin/as3gif_0.6.swc -include-classes org.bytearray.gif.decoder.GIFDecoder
    org.bytearray.gif.encoder.GIFEncoder
    org.bytearray.gif.encoder.LZWEncoder
    org.bytearray.gif.encoder.NeuQuant
    org.bytearray.gif.errors.FileTypeError
    org.bytearray.gif.events.FileTypeEvent
    org.bytearray.gif.events.FrameEvent
    org.bytearray.gif.events.GIFPlayerEvent
    org.bytearray.gif.events.TimeoutEvent
    org.bytearray.gif.frames.GIFFrame org.bytearray.gif.player.GIFPlayer

    After the compilation, you will find the generated SWC file in the subfolder bin:

    bin/as3gif_0.6.swc

    Copy the SWC file into your $LPS_HOME/WEB-INF/flexlib folder. The class which we are going to use to display an animated GIF is the org.bytearray.gif.player.GIFPlayer class.

    Here is an example of an OpenLaszlo class supporting GIFs in both runtimes:

    <canvas>
    <!-- Copyright (c) Raju Bitter / MIT license http://www.opensource.org/licenses/mit-license.php -->
    
      <class name="gifview" extends="view" width="200" height="200">
        <passthrough when="$as3">
          import flash.events.IOErrorEvent;
          import flash.net.URLRequest;
          import org.bytearray.gif.player.GIFPlayer;
          import org.bytearray.gif.events.GIFPlayerEvent;
        </passthrough>
        <attribute name="gifsrc" type="string" value="" />
        <attribute name="__gifplayer" type="object" value="null" />
        <handler name="oninit">
          if (this.gifsrc != '') {
             this.ongifsrc.sendEvent();
          }
        </handler>
        <handler name="ongifsrc">
          if ($dhtml) {
            this.setSource(this.gifsrc);
          } else {
        if (this.__player == null) {
              this.__player = new GIFPlayer();
              this.__player.addEventListener(GIFPlayerEvent.COMPLETE, onGIFLoadComplete);
              this.__player.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
            }
            this.__player.load(new URLRequest(this.gifsrc));
            this.getDisplayObject().addChild(this.__player);
          }
        </handler>
        <method name="onGIFLoadComplete" args="evt"><![CDATA[
          Debug.info("GIF loaded successfully!");
          Debug.info("Total frames: " + this.__player.totalFrames);
          for (var i=1; i <= this.__player.totalFrames; i++) {
            Debug.info("Delay for frame #" + i + ": " + this.__player.getDelay(i));
          }
        ]]></method>
        <method name="onIOError" args="evt">
          Debug.error("Error loading GIF!");
          Debug.inspect(evt);
        </method>
        <!-- Custom unload method -->
        <method name="unload">
           if ($dhtml) {
             super.unload();
           } else {
             this.getDisplayObject().removeChildAt(0);
             // Dispose image resources
         this.__player.dispose();
             this.setAttribute('__player', null);
           }
        </method>
        <method name="stopGIFAnim">
          if ($as3) {
            this.__player.stop();
            Debug.info("Stopped animation at frame " + this.__player.currentFrame);
          } else {
             Debug.warn("Not supported in this runtime");
          }
        </method>
        <method name="startGIFAnim">
          if ($as3) {
            this.__player.play();
          } else {
             Debug.warn("Not supported in this runtime");
          }
        </method>
      </class>
    
      <gifview x="100" y="10" id="gv" gifsrc="animated.gif" />
    
      <button text="Start anim" onclick="gv.startGIFAnim()" />
      <button y="50" text="Stop anim" onclick="gv.stopGIFAnim()" />
      <button y="100" text="Unload GIF" onclick="gv.unload()" />
      <button y="150" text="Load again" onclick="gv.setAttribute('gifsrc', 'animated.gif')" />
    
    </canvas>
    

    The ActionScript class supports starting and stopping animation, and gives you access to the delay for each frame of the GIF.

    OpenLaszlo application with an animated GIF loaded into the SWF11 runtime

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As flash professional does not have support of flash player 11 while testing project
Flash Player 10 specifies: Redirects to policy files outside the originally requested domain will
I have a flash player that loads in some additional features from flash files
I need to embed the Flash player in a native application (C++) in a
This adobe's page says that: In Flash Player, full-screen mode can only be initiated
I have a strange issue where Flash Player in Chrome is not updating unless
Whenever .startb is clicked, my player does not appear. I used this exact method
Does Android support adobe air player ? I am new to these mobile technologies.
In a Flex web application, you can print the version of the flash player
My application requires Adobe Flash player to install. So if you are trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.