I am having an issue with a class I’m working on. I currently load an image as a bitmap and store its data into regState:BitmapData so that I may make new instances of that image later on. When I test if I can use the loaded data at a later time with my newBitmapIntance() function, it says that regState is null. I’m lost as to why this is the case, since it works flawlessly to create an instance of itself in my loadContent() function. Any way I can successfully hold on to my loaded bitmapdata for later use?
My class so far for reference:
[COLOR=#00008B]package[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]import[/COLOR][COLOR=#000000] flash[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]display[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]MovieClip[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]import[/COLOR][COLOR=#000000] flash[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]events[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Event[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]import[/COLOR][COLOR=#000000] flash[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]net[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]URLRequest[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]import[/COLOR][COLOR=#000000] flash[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]display[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Loader[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]import[/COLOR][COLOR=#000000] flash[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]display[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]Bitmap[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]import[/COLOR][COLOR=#000000] flash[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]display[/COLOR][COLOR=#000000].[/COLOR][COLOR=#2B91AF]BitmapData[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]public[/COLOR][COLOR=#00008B]class[/COLOR][COLOR=#2B91AF]MyObj[/COLOR][COLOR=#00008B]extends[/COLOR][COLOR=#2B91AF]MovieClip[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]private[/COLOR][COLOR=#00008B]var[/COLOR][COLOR=#000000] regState[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]BitmapData[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]public[/COLOR][COLOR=#00008B]function[/COLOR][COLOR=#2B91AF]MyObj[/COLOR][COLOR=#000000]()[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]public[/COLOR][COLOR=#00008B]function[/COLOR][COLOR=#000000] loadImage[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]url[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]String[/COLOR][COLOR=#000000]):[/COLOR][COLOR=#00008B]void[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]var[/COLOR][COLOR=#000000] urlRequest[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]URLRequest[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#00008B]new[/COLOR][COLOR=#2B91AF]URLRequest[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]url[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]var[/COLOR][COLOR=#000000] imgLdr[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]Loader[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#00008B]new[/COLOR][COLOR=#2B91AF]Loader[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
imgLdr[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]urlRequest[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
imgLdr[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]contentLoaderInfo[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#2B91AF]Event[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]COMPLETE[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] loadContent[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]private[/COLOR][COLOR=#00008B]function[/COLOR][COLOR=#000000] setRegState[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]temp[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]BitmapData[/COLOR][COLOR=#000000]):[/COLOR][COLOR=#00008B]void[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]this[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]regState [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] temp[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]clone[/COLOR][COLOR=#000000]();[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]public[/COLOR][COLOR=#00008B]function[/COLOR][COLOR=#000000] getRegState[/COLOR][COLOR=#000000]():[/COLOR][COLOR=#2B91AF]BitmapData[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]return[/COLOR][COLOR=#00008B]this[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]regState[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]private[/COLOR][COLOR=#00008B]function[/COLOR][COLOR=#000000] loadContent[/COLOR][COLOR=#000000]([/COLOR][COLOR=#00008B]event[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]Event[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]var[/COLOR][COLOR=#000000] temp[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]Bitmap[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#00008B]event[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]target[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]content [/COLOR][COLOR=#00008B]as[/COLOR][COLOR=#2B91AF]Bitmap[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]this[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]setRegState[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]temp[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]bitmapData[/COLOR][COLOR=#000000]);[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]this[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]addChild[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]newBitmapIntance[/COLOR][COLOR=#000000]());[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]public[/COLOR][COLOR=#00008B]function[/COLOR][COLOR=#000000] newBitmapIntance[/COLOR][COLOR=#000000]():[/COLOR][COLOR=#2B91AF]Bitmap[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]{[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]var[/COLOR][COLOR=#000000] temp[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#2B91AF]Bitmap[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#00008B]new[/COLOR][COLOR=#2B91AF]Bitmap[/COLOR][COLOR=#000000]([/COLOR][COLOR=#00008B]this[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]getRegState[/COLOR][COLOR=#000000]());[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]return[/COLOR][COLOR=#000000] temp[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#000000]}[/COLOR]
[COLOR=#000000][FONT=Consolas]}
[/FONT][/COLOR]