# Help with tile class

**URL:** <https://forum.kirupa.com/t/help-with-tile-class/280358>\
**Category:** flash\
**Created:** [January 26, 2009, 6:37pm UTC](https://forum.kirupa.com/t/help-with-tile-class/280358 "2009-01-26T18:37:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [January 26, 2009, 6:37pm UTC](https://forum.kirupa.com/t/help-with-tile-class/280358/1 "2009-01-26T18:37:17Z")

</div>

I am making a class for a tiled background.

To initiate my class I am doing:

```auto

import com.ronnieswietek.GUI.BGTile;

var tile:BGTile = new BGTile(new Wood(0,0));
addChild(tile);

```

and my class file looks like:

```auto

package com.ronnieswietek.GUI
{

	import flash.display.*;
	import flash.events.Event;

	public class BGTile extends MovieClip
	{

		private var tile :Sprite;

		public function BGTile(bitmap)
		{

			addEventListener(Event.ADDED_TO_STAGE, initTile);
		}
		
		private function initTile(e:Event):void
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			removeEventListener(Event.ADDED_TO_STAGE, initTile);
			stage.addEventListener(Event.RESIZE, tileBG);
			tileBG();

		}
		
		private function tileBG(e:Event = null):void
		{

			var oldTile:Sprite = tile;
			tile = new Sprite();

			tile.graphics.beginBitmapFill(new Wood(0, 0));
			tile.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
			tile.graphics.endFill();

			addChild(tile);

			if (oldTile != null && oldTile != tile)
			{
				
				removeChild(oldTile);

			}
			
		}
				
	}
	
}

```

Right now in my tileBG function, I am doing tile.graphics.beginBitmapFill(new Wood(0,0));

I need to replace that with the class that I pass in the class constructor. Right now public function BGTile(bitmap) is doing nothing. Anyone have an idea?
