PDA

View Full Version : BitmapData Problem



letseatfood
March 17th, 2010, 01:55 PM
Hello,

I have the following scenario:

The Document class loads a list of external bitmap images. As the images are loaded, the following takes place for each:


var obj:Object = new Object();
obj.bmpData = bmp.bitmapData;
obj.bmpFilename = bmpFilename;
bmpDataList.push(obj);
As you can see, an object is created and the bitmapData is stored inside of it. This object is added to an array.

Later, when a key is pressed, a new instance of a class is created. A function is called that retrieves the appropriate bitmapData and this is passed to the constructor of the new instance. Example:



//Instance is created:
var newChar:BaseChar = new LowA(getBmpData("a"));

//Function getBmpData
protected function getBmpData(str:String):BitmapData
{
for(var i:int = 0; i < bmpDataList.length; i++)
{
if(str === bmpDataList[i].bmpFilename)
{
return bmpDataList[i].bmpData;
}
}
return null;
}
The problem is that getBmpData returns null when the SWF is accessed on the remote server. Result = no images seen. It works just fine locally.

Any ideas? I can post more code if necessary.
Thanks,
Mike

letseatfood
March 17th, 2010, 03:01 PM
Nevermind! Got it working.