Loading external images.

TomEllard

  • Posts: 27
Let's say you have some still photographs that you'd like to show in a game or interactive show running in Flash player (not Mobile). You'd like to show them one at a time at a reasonable size. You could make them backgrounds, but that will pump up the size of the swf considerably so that it'll take a while to start up. In Mobile mode I can see Atlases as addressing this kind of problem.

In Flash you could load them as external files. There's a tutorial in AS3 here:
http://blog.728media.com/2009/03/11/how-to-load-external-images-in-actionscript-30/

Which makes sense but I can't figure out how that lines up with Stencyl. Is there a way to load backgrounds on the fly?
Anyone have a suggestion here?

camaleonyco

  • Posts: 204
To make that code work you should import the needed packages before loading the image, perhaps you can try a code block with this:

import flash.display.Loader;
import flash.system.*;
Security.allowDomain("*");

var request:URLRequest = new URLRequest("http://your.image/url/here.jpg");
var myImage:Loader = new Loader()
myImage.load(request);
org.flixel.FlxG.state.addChildAt(myImage, 0);


Not sure if that would work, but let's give it a try.

EDIT:
Sorry, I didn't notice this was an old post... did you find a solution to your problem?

malospam

  • *
  • Posts: 467
Yeah that'd be great if we can get an answer on this, I was wondering about that also.
Visit Reddit's Stencyl page and contribute to spread the word about this amazing program!
http://www.reddit.com/r/stencyl

stepstream

  • Posts: 40
I've been wondering the same thing!