I want to load an image and then use its bitmapData. The program worked when I ran it from flash, but not when I uploaded it online. There seem to be a bunch of weird problems. The
addChild(myLoader)
works online but addChild(loadedPic)
does not, and the myLoader doesn't seem to have bitmapData I can access.
For some reason the urlInput.text = "Done."
will work online but not the urlInput.text = ...
that I added to see what's going on. When I run this on my computer I get the urlInput saying "[object Bitmap] hi" like it should, but online it just says "Loading..." still
var myLoader:Loader = new Loader();
submitButton.addEventListener(MouseEvent.CLICK, buttonRelease);
function buttonRelease(event:MouseEvent){
var fileRequest:URLRequest = new URLRequest(urlInput.text);
urlInput.text = "Loading...";
myLoader.load(fileRequest);
}
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onComplete(e:Event){
urlInput.text = "Done.";
//addChild(myLoader);
//var loadedBitmap = new BitmapData(myLoader.width, myLoader.height);
//loadedBitmap.draw(myLoader);
//var loadedPic = e.target.content;
//loadedPic.width = 300;
//loadedPic.height = 300;
//addChild(loadedPic);
urlInput.text = e.target.content.toString() + " hi";
//usedPic = loadedPic;
}