# OOP question

**URL:** <https://forum.kirupa.com/t/oop-question/317802>\
**Category:** Uncategorized\
**Created:** [January 3, 2011, 12:01pm UTC](https://forum.kirupa.com/t/oop-question/317802 "2011-01-03T12:01:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esseti](https://avatars.discourse-cdn.com/v4/letter/e/bb73d2/32.png) [@Esseti](https://forum.kirupa.com/u/Esseti)\
**Post date:** [January 3, 2011, 12:01pm UTC](https://forum.kirupa.com/t/oop-question/317802/1 "2011-01-03T12:01:47Z")

</div>

Is it possible to add my own custom property to the flash.display.Bitmap using a public static method?

I’m trying to write a bitmap utility that does something to a bitmap, and stores a Number property onto it afterwards.

```auto

// Main.as
package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class Main extends Sprite 
	{
		private var myBitmap:Bitmap;

		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			myBitmap = new _myBitmap(); // linage from library
			trace(myBitmap.myNewProp); // undefined
			Utils.doBitmap(myBitmap);
			trace(myBitmap.myNewProp); // The Math.random() number
		}
		
	}
	
}

```

```auto

// Utils.as
package 
{
	public class Utils
	{
		public function Utils():void 
		{
		}
		public static function doBitmap(image:Bitmap):void {
			// do something
			image.myNewProp = Math.random();
		}
	}
	
}

```

I’m still learning AS3.0 OOP, so please be gentle, but I think that this can’t be done with this method. I think I have to make a new Class that extends ‘Bitmap’, add the prop there, and then in the Main.as make a new instance of that class, point to the target Bitmap, and run the method in the extended ‘Bitmap’ class (?).
