News About Examples Downloads Buy
 
 

 

Since the introduction of Flash MX it's been possible to load jpg's dynamically from a server into a Flash movie at runtime.

However, it has only been possible to load either swf files or "non-progressive" jpg's and only from the same domain.

img2swf is a server application that converts a range of image formats to swf at runtime making it possible to dynamically load them into Flash via loadMovie.

Simply by appending the URL of the img2swf server application to the front of an image URL it is possible to load the following formats directly into Flash from anywhere on the web;

  • gif (both static, animated** and transparent)
  • png (with transparency)
  • jpg (both progressive and non-progressive)
  • bmp
  • tiff
  • ico
**playback speed of animated gifs are controlled by the main movie speed.

Click here to see examples


img2swf and Flashplayer 7

With the latest Flash player you can now import images (jpg or swf) directly into text fields.
img2swf supports this functionality allowing you to include gif, png and more!


How do I use it?

//If necessary, create a movieClip for the image to be loaded into
_root.createEmptyMovieClip("imageHolder",0);
//This is the path to the img2swf application
var img2swfApp="http://www.myDomain.com/toSwf.aspx?url=";
//The full URL to the image that is to be loaded
var imageURL="http://www.myOrAnotherDomain.com/img2swf_samp.gif";
//LoadMovie action with the img2swf parameter appended
_root.imageHolder.loadMovie(img2swfApp+imageURL,this);

With the proper server configuration (described in the readme.txt of the server edtion) the following syntax can also be used.

_root.imageHolder.loadMovie("http://www.domain.com/sample.gif.i2s",this);

Prevent Caching
If you need to prevent caching, as with webcams, add a timestamp to the end of your URL.

//Create a date object
var ts=new Date();
var timestamp="&timestamp="+ts.getTime();
//Add the timestamp to the end of the URL from the example above
_root.imageHolder.loadMovie(img2swfApp+imageURL+timestamp,this);


Please send any queries or feedback to img2swf@stromberglarsen.dk

img2swf is a product of StrømbergLarsen ApS, all rights reserved.