Dear saravanan

That works only when the parent.x = 0 and parent.y = 0.
But say if my parent is a Rectangle and its x = 100 and y = 100 and
the width = 50 and height = 50
then without using if condition..

i had used

child.x = parent.width  * Math.random() ;
child.y = parent.height * math.random() ;

if(child.x > parent.x)
{
     parent.addChild(child);
}


this is the way i am doing right now.
but how to do it without using if condition
because using it creates some other problem in my program. :(

Sp please help out ....


On Jan 12, 4:18 pm, Saravanan <[email protected]> wrote:
> Do u want to arrange childrens within the parent space....
>
> then use children.y = math.random()*parent.height
> children.x = math.random()*parent.width
>
> --sara
>
> On Jan 12, 2:25 pm,sudhi<[email protected]> wrote:
>
> > I am coding in Actionscript 3.0. I have a Sprite object which has to
> > generate some children objects during runtime but i want it to take
> > random positions and the position of child should be within the
> > parent. so can anybody tell me how to keep the x, y of child within
> > the parent x, y.
>
> > please help
> > Thanks in advance

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to