# problem in displaying diffrent number of image

• Newbie
• Posts: 6

3+ Months Ago

i have a new problem. i am trying to output image client in 3 different positions.(different number of client in each position)
but to no avail. here's my code:-

Code: [ Select ]
function this(c, j)
{
if (c>count)
{
count = c;
if(count>0)
{
if ((count%10)>0 & (count%10)<10) var extra = 1;
else var extra = 0;
var layer = (count/10) + extra;
var layer_tot = parseInt(layer);
for(var i=0; i<layer_tot; i++)
{
mov2_x=(j*Math.cos(i))+150;
mov2_y=(j*Math.sin(i))+150;
}
}
}
}
1. function this(c, j)
2. {
3. if (c>count)
4. {
5.     count = c;
6.     if(count>0)
7.     {
8.         if ((count%10)>0 & (count%10)<10) var extra = 1;
9.         else var extra = 0;
10.         var layer = (count/10) + extra;
11.         var layer_tot = parseInt(layer);
12.         for(var i=0; i<layer_tot; i++)
13.         {
15.             mov2_x=(j*Math.cos(i))+150;
16.             mov2_y=(j*Math.sin(i))+150;
17.             setProperty("client_" add i, _x, mov2_x);
18.             setProperty("client_" add i, _y, mov2_y);
19.         }
20.     }
21. }
22. }

and i am trying to call the function using:-

Code: [ Select ]
this(c0, 150);
this(c1, 100);
this(c2, 50);
1. this(c0, 150);
2. this(c1, 100);
3. this(c2, 50);

before that i set:-
Code: [ Select ]
c0=50;
c1=14;
c2=60;
1. c0=50;
2. c1=14;
3. c2=60;

and it always ouput just the layer with highest number out of c0, c1 and c2.

how can i output all 3 layers at the same time? is there something wrong with the function or the way i call the function?? please help~! i am a beginner...
• Guru
• Posts: 1253
• Loc: Ro

3+ Months Ago

here`s a working one :
Code: [ Select ]
function this(c, j)
{
if (c>count)
{
count = c;
if(count>0)
{
if ((count%10)>0 & (count%10)<10) var extra = 1;
else var extra = 0;
var layer = (count/10) + extra;
var layer_tot = parseInt(layer);
for(var i=crtDepth; i<layer_tot+crtDepth; i++)
{
trace(client._x);
mov2_x=(j*Math.cos(i))+client._x;
mov2_y=(j*Math.sin(i))+150;
}
crtDepth += layer_tot;
trace(crtDepth);
}
}
}
count = 10; c0=50; c1=80; c2=60; crtDepth = 0;
client._x = 10; this(c0, 15);
client._x = 200; this(c1, 20);
client._x = 400; this(c2, 50);
stop();
1. function this(c, j)
2. {
3. if (c>count)
4. {
5.   count = c;
6.   if(count>0)
7.   {
8.    if ((count%10)>0 & (count%10)<10) var extra = 1;
9.    else var extra = 0;
10.    var layer = (count/10) + extra;
11.    var layer_tot = parseInt(layer);
12.    for(var i=crtDepth; i<layer_tot+crtDepth; i++)
13.    {
15.      trace(client._x);
16.          mov2_x=(j*Math.cos(i))+client._x;
17.      mov2_y=(j*Math.sin(i))+150;
18.      setProperty("client_" add i, _x, mov2_x);
19.      setProperty("client_" add i, _y, mov2_y);
20.    }
21.      crtDepth += layer_tot;
22.      trace(crtDepth);
23.   }
24. }
25. }
26. count = 10; c0=50; c1=80; c2=60; crtDepth = 0;
27. client._x = 10; this(c0, 15);
28. client._x = 200; this(c1, 20);
29. client._x = 400; this(c2, 50);
30. stop();
• Newbie
• Posts: 6

3+ Months Ago

Thanx Ice,

I managed to find the solution. Before this I din't realise that each duplicated object overwrites another by calling the same function.
My script is working now. Thanx alot

## Post Information

• Total Posts in this topic: 3 posts
• Users browsing this forum: No registered users and 4 guests
• You cannot post new topics in this forum
• You cannot reply to topics in this forum
• You cannot edit your posts in this forum
• You cannot delete your posts in this forum
• You cannot post attachments in this forum