Skip to content

Instantly share code, notes, and snippets.

@bmfs
Last active October 8, 2015 18:53
Show Gist options
  • Save bmfs/ba27868115055c3c093e to your computer and use it in GitHub Desktop.
Save bmfs/ba27868115055c3c093e to your computer and use it in GitHub Desktop.
Load image generated from a url with url variables. It works correctly in Flash Target and fails on HTML5 (openfl 3.3.8)
package;
import openfl.display.Loader;
import openfl.display.Sprite;
import openfl.events.Event;
import openfl.net.URLRequest;
import openfl.text.TextField;
class URLVariablesLoaderTest extends Sprite {
public function new () {
super ();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(e:Event):Void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
var expectedText:TextField = new TextField();
expectedText.text = "Expected:";
addChild(expectedText);
var resultText:TextField = new TextField();
resultText.text = "Result:";
addChild(resultText);
var expectedLoader:Loader = new Loader();
expectedLoader.load(new URLRequest("http://mc-avatars.miniclipcdn.com/1-200.png"));
addChild(expectedLoader);
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest("http://avatars.miniclip.com/players/en/resize.php?uid=1&w=200&h=200"));
addChild(imageLoader);
expectedLoader.y = 30;
imageLoader.y = 30;
resultText.x = 230;
imageLoader.x = 230;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment