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.
// 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