GIF player is used to display GIF images in flex.
Class Library Website
Http://www.bytearray.org /? P = 95
Code Acquisition website
Http://code.google.com/p/as3gif/
Environment: flex4 + gifplayer0.6
1. Download The GIF player source code to the project.
2. Create loadingview. mxml
-------------------------------------------
<? XML version = "1.0" encoding = "UTF-8"?>
<S: titlewindow xmlns: FX = "http://ns.adobe.com/mxml/2009"
Xmlns: S = "Library: // ns.adobe.com/flex/spark"
Xmlns: MX = "Library: // ns.adobe.com/flex/mx"
Width = "180" Height = "88"
Creationcomplete = "Init ()"
Title = "loading... please wait... "Enabled =" true ">
<S: layout>
<S: basiclayout/>
</S: layout>
<FX: declarations>
<! -- Place non-visual elements (such as services and value objects) Here -->
</FX: declarations>
<FX: SCRIPT>
<! [CDATA [
Import org.bytearray.gif. Player. gifplayer;
Public var mygifplayer: gifplayer = new gifplayer (true );
Public Function Init (): void {
// Hide the close button
This. closebutton. Visible = false;
// GIF image path
VaR request: URLRequest = new URLRequest ("styles/loading/loadingimage4.gif ");
// Gifplayer loads the image
Mygifplayer. Load (request );
Mygifplayer. Visible = true;
// Bind the image to gifplayer
IMG. addchild (mygifplayer );
}
]>
</FX: SCRIPT>
<Mx: Image id = "IMG" width = "50" Height = "50" x = "66" Y = "3">
</MX: Image>
</S: titlewindow>
3. Call
Private var window: loadingview;
Window = new loadingview ();
Popupmanager. addpopup (window, this, true );
Popupmanager. centerpopup (window );
4. Remove
Popupmanager. removepopup (window );