Why some pictures disappear in AS3?
There are 17 symbols my project. Each symbol contains one image. It is required display 9 random images and shuffle them. symbols are named: p1 , p2 , p3 and so on ... The project works properly except that one or two images disappears from the 9 random images!!
I can not find the reason?? Would you help me, please? Thanks in advance,
This images features 3 runs (CTRL + Enter) of my project.

Here is my code:
stop();
var i:int; i=0;
var pic:Array =[9];
var c :int;
do
{
pic=randomRange(1, 17);
for (c=1;c<i;c++) // the "for loop" prevents repeating pictures
{
if (pic==pic[i-c])
{
pic=randomRange(1, 17);
trace("repeated pic:" , c)
c--;
}
}
// re-arranging some picturs using nine "if" conditions:
if (i==0)
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 100 ;
this ["p"+pic].y = 75 ;
trace (i);
}
if (i==1)
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 280 ;
this ["p"+pic].y = 75 ;
trace (i);
}
if (i==2)
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 460 ;
this ["p"+pic].y = 75 ;
trace (i);
}
if (i==3) // new row
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 100;
this ["p"+pic].y = 255;
trace (i);
}
if (i==4)
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 280;
this ["p"+pic].y = 255;
trace (i);
}
if (i==5)
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 460;
this ["p"+pic].y = 255;
trace (i);
}
if (i==6) // new row
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 100;
this ["p"+pic].y = 435;
trace (i);
}
if (i==7)
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 280;
this ["p"+pic].y = 435;
trace (i);
}
if (i==8)
{
this ["p"+pic].width = 175 ;
this ["p"+pic].height = 175 ;
this ["p"+pic].x = 460;
this ["p"+pic].y = 435;
trace (i);
}
trace (pic) ;
i++;
}
while (i<9)
function randomRange(minNum:Number, maxNum:Number):Number // This function produces a random number
{
return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);
}
