# \[Flash CS3\] Newbie: Return x,y from class

**URL:** <https://forum.kirupa.com/t/flash-cs3-newbie-return-x-y-from-class/238779>\
**Category:** flash\
**Created:** [September 14, 2007, 10:40pm UTC](https://forum.kirupa.com/t/flash-cs3-newbie-return-x-y-from-class/238779 "2007-09-14T22:40:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpann](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tpann](https://forum.kirupa.com/u/tpann)\
**Post date:** [September 14, 2007, 10:40pm UTC](https://forum.kirupa.com/t/flash-cs3-newbie-return-x-y-from-class/238779/1 "2007-09-14T22:40:01Z")

</div>

I’ve got a file in which I place a .swf on the stage as follows:

var cellphone:LayoutClass = new LayoutClass(100, 250);  
addChild(cellphone);

LayoutClass looks like this:

package {  
import flash.display.Sprite;  
import flash.display.Loader;  
import flash.net.URLRequest;

public class LayoutClass extends Sprite {  
var xx:Number;  
var yy:Number;  
public function LayoutClass(xx, yy) {

var thing:Loader = new Loader();  
addChild(thing);  
thing.load(new URLRequest(“images/cellphone\_picture.swf”));  
thing.x = xx;  
thing.y = yy;  
}  
}  
}

This works nicely, placing object at stage coordinates (100, 250). However, in the file (not in the class)…

trace ("object.x = " + object.x + ", "object.y = " + object.y);

… yeilds…

object.x = 0, object.y = 0

So even though object is located at stage coordinates (100, 250), it’s somehow got a local coordinate of (0, 0). When I attempt to attach an animation of RF waves emanating from the cell phone (using cellphone.addChild(waves);), the waves center at stage coordinate (0, 0) rather than from the registration point of the cell phone swf.

I also enabled dragging for the cellphone and when I drag it while the waves are animating, the waves move with it. So I know the waves are actually attached to the cellphone. How do I get the waves to emanate from the registration point of the cellphone?

This is probably pretty simple but I’m missing it. Any help?

Thanks,  
Tim
