# Tiled Image Background

**URL:** <https://forum.kirupa.com/t/tiled-image-background/328737>\
**Category:** flash\
**Created:** [June 12, 2012, 7:37am UTC](https://forum.kirupa.com/t/tiled-image-background/328737 "2012-06-12T07:37:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiec](https://avatars.discourse-cdn.com/v4/letter/a/f04885/32.png) [@amiec](https://forum.kirupa.com/u/amiec)\
**Post date:** [June 12, 2012, 7:37am UTC](https://forum.kirupa.com/t/tiled-image-background/328737/1 "2012-06-12T07:37:12Z")

</div>

So I have a navigation background bar that adjusts it’s with to the stage and the height is defined in it’s XML file. Now this works great, I’m trying to add a tiled image to the background. The image is the same height as the background graphic so it only needs to be repeated on the x axis. Below is my code, I feel something small may be off because it looks right but it doesn’t want to work. ☹

```auto

protected function _initMenuBg():void
        {
            var size : Object = StageController.getInstance().getSize();
            var h : int = size.h;
            var w : int = size.w;
            _mainMenuBg = new Sprite();
            _mainMenuBg.alpha = 0;
            Tweener.addTween(_mainMenuBg, { alpha:1, time:tweenerTime, transition:"easeoutquad" } );
            
            var bgloader = new Loader();
            bgloader.load(new URLRequest("assets/images/nav-background.png"));
            var bitground:BitmapData = new BitmapData(bgloader.width, bgloader.height, false);
            bitground.draw(bgloader);
            
            _mainMenuBg.graphics.beginBitmapFill(bitground, null, true, true);
            DrawRectUtil.draw(_mainMenuBg, w, _mainMenuBgHeight, _mainMenuBgColor, _mainMenuBgAlpha);
            _mainMenuBg.graphics.endFill();

            container.addChildAt(_mainMenuBg, 0);
        }

```
