0

Having problem to load external image in gif player. I am using as3gif class package
This is working :

   import flash.display.Sprite;
    import flash.net.URLRequest;
    import org.gif.player.GIFPlayer;
                    var request:URLRequest = new URLRequest("diego.gif");

                var player:GIFPlayer = new GIFPlayer();
                player.load(request);

                addChild(player);

and This is not working :

import flash.display.Sprite;
    import flash.net.URLRequest;
    import org.gif.player.GIFPlayer;

                   var request:URLRequest = new URLRequest("http://www.idea-files.com/problemGif/127.gif");

                    var player:GIFPlayer = new GIFPlayer();
                    player.load(request);

                    addChild(player);

When I test in my flash CS5 it loaded image. But on server not load the image Can you give me any advice ?

user2105386
  • 55
  • 3
  • 9
  • What happens when you try to load the image? If it gives an error, you should include it in your question. – puggsoy Feb 26 '13 at 20:54
  • not give error. when I test in CS5 adobe by command CTRL+ENTER it is working and when I test on server it is not working. – user2105386 Feb 26 '13 at 20:58
  • What do you mean by "not working" though? How can you tell whether it's working or not? Isn't it displaying the image? – puggsoy Feb 26 '13 at 21:31
  • yes, not displaying the image. – user2105386 Feb 26 '13 at 21:34
  • Can we assume that you're getting the gif file from another domain? That is, is www.idea-files.com your web site or someone elses? I've never used gif's in Flash, perhaps this is a cross domain issue. – Sunil D. Feb 26 '13 at 23:36
  • Yes Sunil D. you are right this is a cross domain issue. Can you tell me is it possible to solve? Thanks for your attention – user2105386 Feb 27 '13 at 00:10
  • @user2105386 do you have access to the remote domain? If so, you can set up a cross domain policy file (crossdomain.xml) – david.emilsson Feb 27 '13 at 01:08

1 Answers1

2

If you have access to the remote domain, you can deploy a crossdomain.xml file there. That is a file that Flash Player looks for to see if that domain is allowing Flash apps from other sites to access it's data. Generally for JPEG and PNG images this isn't necessary, unless you want to actually access the bitmap data that those images contain.

By default Flash doesn't display GIF's (or maybe just animated GIF's), and that library you're using is likely getting at the bitmap data to make the animation. Hence, in this scenario you can think about doing one of the following:

  1. Deploy a crossdomain.xml on that server. I'll omit the steps to do this, as it's well documented by Adobe.

  2. If you don't control that server you should contact that site and ask them if they will allow you to download the image so you can deploy it on your own server or embed it in your SWF. Or ask if they can deploy a crossdomain.xml file for you.

  3. Create your own animation in Flash Professional, this removes the need for the GIF library.

  4. Create your own animated GIF.

Sunil D.
  • 17,983
  • 6
  • 53
  • 65