# Sprite Problem

**URL:** <https://forum.kirupa.com/t/sprite-problem/266455>\
**Category:** flash\
**Created:** [July 21, 2008, 12:09am UTC](https://forum.kirupa.com/t/sprite-problem/266455 "2008-07-21T00:09:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adnan794](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@adnan794](https://forum.kirupa.com/u/adnan794)\
**Post date:** [July 21, 2008, 12:09am UTC](https://forum.kirupa.com/t/sprite-problem/266455/1 "2008-07-21T00:09:23Z")

</div>

Hello

I am making a portfolio page. I have a class called PotfolioList that creats Thumnails and adds it to a container sprite. This sprite can be reterived from other classes by calling a getSprite method.

When I call this method form another class the sprite does not contain anything. I am pasting the code for this class here.

```auto

// Class creats thumbnials and adds them to _pContainer sprite
public class PortfolioList extends Sprite
	{
                 // Conatiner sprite to add thumbnails
		private var _pContainer:Sprite;
		
		public function PortfolioList()
		{
			_pContainer = new Sprite();
			
                          // this function creats 10 movie clips from PortfolioThumb class
                          for (var i:int = 0; i < 10; i++)
			{
				var pThumb:PortfolioThumb = new PortfolioThumb;
				pThumb.x = (pThumb.width + 60) * i ;

				// add thumnails to _pContainer Sprite
                                  _pContainer.addChild(pThumb);
				i++;

			}
		}
		public function getSprite():Sprite
		{

			//return _pContainer containing all the thumbnails
			return _pContainer;
		}
	}

```

If I use this in another class

var pList:PortfolioList = new PortfolioList;  
trace(pList.getSprite().numChildren); // traces 0

Can anyone please help me on this?

Thanks
