[flexcoders] Re: How to get Textinput position?

2007-09-12 Thread flexawesome
great, I see but I was serious how to get a textInput position in
form ( id=textInput ) by click the button?

for example like coding below? huummm


evt.currentTarget.parent.localToGlobal (new
Point(evt.currentTarget.x,evt.target.textInput.y)).y 


Cheers

--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 Assuming that what you want is global coordinates, it's even simpler to
 do
  
 event.currentTarget.localToGlobal(new Point(0, 0)).x
  
 which works because the upper-left of any component is (0, 0) in its own
 local coordinate system.
  
 - Gordon
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of flexawesome
 Sent: Tuesday, September 11, 2007 8:32 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 you are SO COOL. Thank you so much :)
 
 have a nice day
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , Sven Woermann sven.woermann@
 wrote:
 
  Hi, try this. You are basically calling the localToGlobal method on
 the
  parent container of the TextInput and give it the position of the
 TextInput
  relative to it's parent.
  
  event.currentTarget.parent.localToGlobal(new
 Point(event.currentTarget.x,
  event.currentTarget.y)).x
  
  
  
  
  On 9/11/07, flexawesome flexawesome@ wrote:
  
  
   Hi Gordeon,
  
   Thank you so much to reply it as I am new to flex, and don't know
 how
   to use localToGlobal() it in my app below, I am appreciate if you
   can show me the code , that would be great!
  
   THANKS :)
  
  
   --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com,
 Gordon
   Smith gosmith@ wrote:
   
The x and y properties of a DisplayObject are in the coordinate
   system
of its parent. So you're getting the location of the top-left of
 the
TextInput relative to the top-left of the FormItem. If you want
coordinates in a different coordinate system, use localToGlobal()
   and
globalToLocal().
   
- Gordon
   

   
From: flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com
   [mailto:flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com]
 On
Behalf Of flexawesome
Sent: Monday, September 10, 2007 7:11 PM
To: flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com
Subject: [flexcoders] Re: How to get Textinput position?
   
   
   
   
humm...parent doesn't work... and I correct the code below..
   
Cheers
   

   
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml 
 
viewSourceURL=srcview/index.html
mx:Script
![CDATA[
   
import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.controls.Alert;
   
private function createMsg(event:Event):void {
   
var target:UIComponent = UIComponent(event.currentTarget);
   
var alert:Alert;
   
Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
Show Me, Alert.YES | Alert.NO)
}
   
]]
/mx:Script
   
mx:Panel
mx:Form
mx:FormItem label=Label1
mx:TextInput focusOut=createMsg(event);/
/mx:FormItem
mx:FormItem label=Label2
mx:TextInput/
/mx:FormItem
mx:FormItem label=Label3
mx:TextInput/
/mx:FormItem
/mx:Form
/mx:Panel
   
/mx:Application
   
--- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com 
 flexcoders%40yahoogroups.commailto:
   flexcoders% flexcoders%25
   40yahoogroups.com
, Alex Harui aharui@ wrote:

 Might be event.currentTarget.parent.x. There is no Label1 in
 your
 sample. Also see localToGlobal



 

 From: flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com 
 flexcoders%40yahoogroups.commailto:
   flexcoders% flexcoders%25
   40yahoogroups.com
   
[mailto:flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com 
 flexcoders%40yahoogroups.commailto:
   flexcoders% flexcoders%25
   40yahoogroups.com
] On
 Behalf Of flexawesome
 Sent: Monday, September 10, 2007 11:43 AM
 To: flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com
 mailto:
   flexcoders% flexcoders%25
   40yahoogroups.com
 Subject: [flexcoders] How to get Textinput position?



 Hi guys :)

 I am working on flex, and looks hard to get the target object x
   and
y
 position. do you have any ideas?

 Cheers  THANKS

 

 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http

RE: [flexcoders] Re: How to get Textinput position?

2007-09-12 Thread Gordon Smith
I wish I could understand what you don't understand. Here's a complete
working example.

- Gordon

?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;

mx:Script
![CDATA[
 
import mx.controls.Alert;
  
private function createMsg(event:Event):void
{
var topLeft:Point = new Point(0, 0);
topLeft = event.currentTarget.localToGlobal(topLeft);
Alert.show(the X position of the top left of LABEL 1 in
global coordinates is  + topLeft.x, Show Me, Alert.YES | Alert.NO);
}

]]
 /mx:Script

mx:Panel
mx:Form
mx:FormItem label=Label1
mx:TextInput focusOut=createMsg(event);/
/mx:FormItem
mx:FormItem label=Label2
mx:TextInput/
/mx:FormItem
mx:FormItem label=Label3
mx:TextInput/
/mx:FormItem
/mx:Form
/mx:Panel

/mx:Application



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of flexawesome
Sent: Wednesday, September 12, 2007 9:43 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: How to get Textinput position?



great, I see but I was serious how to get a textInput position in
form ( id=textInput ) by click the button?

for example like coding below? huummm

evt.currentTarget.parent.localToGlobal (new
Point(evt.currentTarget.x,evt.target.textInput.y)).y 

Cheers

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Gordon Smith [EMAIL PROTECTED] wrote:

 Assuming that what you want is global coordinates, it's even simpler
to
 do
 
 event.currentTarget.localToGlobal(new Point(0, 0)).x
 
 which works because the upper-left of any component is (0, 0) in its
own
 local coordinate system.
 
 - Gordon
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of flexawesome
 Sent: Tuesday, September 11, 2007 8:32 AM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 you are SO COOL. Thank you so much :)
 
 have a nice day
 
 --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com
 , Sven Woermann sven.woermann@
 wrote:
 
  Hi, try this. You are basically calling the localToGlobal method on
 the
  parent container of the TextInput and give it the position of the
 TextInput
  relative to it's parent.
  
  event.currentTarget.parent.localToGlobal(new
 Point(event.currentTarget.x,
  event.currentTarget.y)).x
  
  
  
  
  On 9/11/07, flexawesome flexawesome@ wrote:
  
  
   Hi Gordeon,
  
   Thank you so much to reply it as I am new to flex, and don't know
 how
   to use localToGlobal() it in my app below, I am appreciate if you
   can show me the code , that would be great!
  
   THANKS :)
  
  
   --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com flexcoders%40yahoogroups.com,
 Gordon
   Smith gosmith@ wrote:
   
The x and y properties of a DisplayObject are in the coordinate
   system
of its parent. So you're getting the location of the top-left of
 the
TextInput relative to the top-left of the FormItem. If you want
coordinates in a different coordinate system, use
localToGlobal()
   and
globalToLocal().
   
- Gordon
   

   
From: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com flexcoders%40yahoogroups.com
   [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com flexcoders%40yahoogroups.com]
 On
Behalf Of flexawesome
Sent: Monday, September 10, 2007 7:11 PM
To: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com flexcoders%40yahoogroups.com
Subject: [flexcoders] Re: How to get Textinput position?
   
   
   
   
humm...parent doesn't work... and I correct the code below..
   
Cheers
   

   
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 
 http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml  
http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml  
 
viewSourceURL=srcview/index.html
mx:Script
![CDATA[
   
import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.controls.Alert;
   
private function createMsg(event:Event):void {
   
var target:UIComponent = UIComponent(event.currentTarget);
   
var alert:Alert;
   
Alert.show(the X position of LABEL 1 is
+event.currentTarget.x,
Show Me, Alert.YES

[flexcoders] Re: How to get Textinput position?

2007-09-12 Thread flexawesome

Hey Gordon,

I am appreciate for your promptly response, sorry for my confusion. I
mean if I know the id name for the textInput, is there a way to click
the button to get the position for ti_2?

Have a nice day :)

=
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;

mx:Script
![CDATA[
 
import mx.controls.Alert;
  
private function createMsg(event:Event):void
{
var topLeft:Point = new Point(0, 0);
topLeft = event.currentTarget.localToGlobal(topLeft);
Alert.show(the X position of the top left of LABEL 1 in
global coordinates is  + topLeft.x, Show Me, Alert.YES | Alert.NO);
}

]]
 /mx:Script

mx:Panel
mx:Form
mx:FormItem label=Label1
mx:TextInput id=ti_1 /
/mx:FormItem
mx:FormItem label=Label2
mx:TextInput id=ti_2 /
/mx:FormItem
mx:FormItem label=Label3
mx:TextInput id=ti_3 /
/mx:FormItem

mx:Button label=Button click=createMsg(event);/

/mx:Form
/mx:Panel

/mx:Application


--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 I wish I could understand what you don't understand. Here's a complete
 working example.
 
 - Gordon
 
 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
 
 mx:Script
 ![CDATA[
  
 import mx.controls.Alert;
   
 private function createMsg(event:Event):void
 {
 var topLeft:Point = new Point(0, 0);
 topLeft = event.currentTarget.localToGlobal(topLeft);
 Alert.show(the X position of the top left of LABEL 1 in
 global coordinates is  + topLeft.x, Show Me, Alert.YES | Alert.NO);
 }
 
 ]]
  /mx:Script
 
 mx:Panel
 mx:Form
 mx:FormItem label=Label1
 mx:TextInput focusOut=createMsg(event);/
 /mx:FormItem
 mx:FormItem label=Label2
 mx:TextInput/
 /mx:FormItem
 mx:FormItem label=Label3
 mx:TextInput/
 /mx:FormItem
 /mx:Form
 /mx:Panel
 
 /mx:Application
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of flexawesome
 Sent: Wednesday, September 12, 2007 9:43 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 great, I see but I was serious how to get a textInput position in
 form ( id=textInput ) by click the button?
 
 for example like coding below? huummm
 
 evt.currentTarget.parent.localToGlobal (new
 Point(evt.currentTarget.x,evt.target.textInput.y)).y 
 
 Cheers
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , Gordon Smith gosmith@ wrote:
 
  Assuming that what you want is global coordinates, it's even simpler
 to
  do
  
  event.currentTarget.localToGlobal(new Point(0, 0)).x
  
  which works because the upper-left of any component is (0, 0) in its
 own
  local coordinate system.
  
  - Gordon
  
  
  
  From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 ] On
  Behalf Of flexawesome
  Sent: Tuesday, September 11, 2007 8:32 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
  Subject: [flexcoders] Re: How to get Textinput position?
  
  
  
  you are SO COOL. Thank you so much :)
  
  have a nice day
  
  --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
  , Sven Woermann sven.woermann@
  wrote:
  
   Hi, try this. You are basically calling the localToGlobal method on
  the
   parent container of the TextInput and give it the position of the
  TextInput
   relative to it's parent.
   
   event.currentTarget.parent.localToGlobal(new
  Point(event.currentTarget.x,
   event.currentTarget.y)).x
   
   
   
   
   On 9/11/07, flexawesome flexawesome@ wrote:
   
   
Hi Gordeon,
   
Thank you so much to reply it as I am new to flex, and don't know
  how
to use localToGlobal() it in my app below, I am appreciate if you
can show me the code , that would be great!
   
THANKS :)
   
   
--- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com 
  mailto:flexcoders%40yahoogroups.com flexcoders%40yahoogroups.com,
  Gordon
Smith gosmith@ wrote:

 The x and y properties of a DisplayObject are in the coordinate
system
 of its parent. So you're getting the location of the top-left of
  the
 TextInput relative to the top-left of the FormItem. If you want
 coordinates in a different coordinate system, use
 localToGlobal()
and
 globalToLocal().

 - Gordon

RE: [flexcoders] Re: How to get Textinput position?

2007-09-12 Thread Gordon Smith
Ahh.. I was confused because what you really want to know is, Given an
String specifying a component's id, how do I get a reference to that
component?
 
The answer to that is to use this[id]:
 
var id:String = ti_2;
var textInput:TextInput = this[id];
 
Of course, once you have a reference to a component, you can get its
position or any other property.
 
- Gordon



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of flexawesome
Sent: Wednesday, September 12, 2007 1:27 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: How to get Textinput position?




Hey Gordon,

I am appreciate for your promptly response, sorry for my confusion. I
mean if I know the id name for the textInput, is there a way to click
the button to get the position for ti_2?

Have a nice day :)

=
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 

mx:Script
![CDATA[

import mx.controls.Alert;

private function createMsg(event:Event):void
{
var topLeft:Point = new Point(0, 0);
topLeft = event.currentTarget.localToGlobal(topLeft);
Alert.show(the X position of the top left of LABEL 1 in
global coordinates is  + topLeft.x, Show Me, Alert.YES | Alert.NO);
}

]]
/mx:Script

mx:Panel
mx:Form
mx:FormItem label=Label1
mx:TextInput id=ti_1 /
/mx:FormItem
mx:FormItem label=Label2
mx:TextInput id=ti_2 /
/mx:FormItem
mx:FormItem label=Label3
mx:TextInput id=ti_3 /
/mx:FormItem

mx:Button label=Button click=createMsg(event);/

/mx:Form
/mx:Panel

/mx:Application


--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Gordon Smith [EMAIL PROTECTED] wrote:

 I wish I could understand what you don't understand. Here's a complete
 working example.
 
 - Gordon
 
 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 
 
 mx:Script
 ![CDATA[
 
 import mx.controls.Alert;
 
 private function createMsg(event:Event):void
 {
 var topLeft:Point = new Point(0, 0);
 topLeft = event.currentTarget.localToGlobal(topLeft);
 Alert.show(the X position of the top left of LABEL 1 in
 global coordinates is  + topLeft.x, Show Me, Alert.YES | Alert.NO);
 }
 
 ]]
 /mx:Script
 
 mx:Panel
 mx:Form
 mx:FormItem label=Label1
 mx:TextInput focusOut=createMsg(event);/
 /mx:FormItem
 mx:FormItem label=Label2
 mx:TextInput/
 /mx:FormItem
 mx:FormItem label=Label3
 mx:TextInput/
 /mx:FormItem
 /mx:Form
 /mx:Panel
 
 /mx:Application
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of flexawesome
 Sent: Wednesday, September 12, 2007 9:43 AM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 great, I see but I was serious how to get a textInput position in
 form ( id=textInput ) by click the button?
 
 for example like coding below? huummm
 
 evt.currentTarget.parent.localToGlobal (new
 Point(evt.currentTarget.x,evt.target.textInput.y)).y 
 
 Cheers
 
 --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com
 , Gordon Smith gosmith@ wrote:
 
  Assuming that what you want is global coordinates, it's even simpler
 to
  do
  
  event.currentTarget.localToGlobal(new Point(0, 0)).x
  
  which works because the upper-left of any component is (0, 0) in its
 own
  local coordinate system.
  
  - Gordon
  
  
  
  From: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com
 ] On
  Behalf Of flexawesome
  Sent: Tuesday, September 11, 2007 8:32 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
  Subject: [flexcoders] Re: How to get Textinput position?
  
  
  
  you are SO COOL. Thank you so much :)
  
  have a nice day
  
  --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
  , Sven Woermann sven.woermann@
  wrote:
  
   Hi, try this. You are basically calling the localToGlobal method
on
  the
   parent container of the TextInput and give it the position of the
  TextInput
   relative to it's parent.
   
   event.currentTarget.parent.localToGlobal(new
  Point(event.currentTarget.x,
   event.currentTarget.y)).x
   
   
   
   
   On 9/11/07, flexawesome flexawesome@ wrote:
   
   
Hi Gordeon,
   
Thank you so much to reply it as I am new to flex, and don't
know
  how
to use localToGlobal() it in my app below, I am appreciate if
you
can show me the code , that would be great!
   
THANKS

[flexcoders] Re: How to get Textinput position?

2007-09-12 Thread flexawesome
hehe, because I am using data validator to check each filed, and need
to display customize error message. I know the existing flex component
of data validator can be used.

however, I would like to click button to check all validator, if there
is a problem I need to display the message on the top of field. heheh
that's why I need to get the filed position to display my error msg there.

Cheers

--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 Ahh.. I was confused because what you really want to know is, Given an
 String specifying a component's id, how do I get a reference to that
 component?
  
 The answer to that is to use this[id]:
  
 var id:String = ti_2;
 var textInput:TextInput = this[id];
  
 Of course, once you have a reference to a component, you can get its
 position or any other property.
  
 - Gordon
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of flexawesome
 Sent: Wednesday, September 12, 2007 1:27 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 
 Hey Gordon,
 
 I am appreciate for your promptly response, sorry for my confusion. I
 mean if I know the id name for the textInput, is there a way to click
 the button to get the position for ti_2?
 
 Have a nice day :)
 
 =
 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
 
 mx:Script
 ![CDATA[
 
 import mx.controls.Alert;
 
 private function createMsg(event:Event):void
 {
 var topLeft:Point = new Point(0, 0);
 topLeft = event.currentTarget.localToGlobal(topLeft);
 Alert.show(the X position of the top left of LABEL 1 in
 global coordinates is  + topLeft.x, Show Me, Alert.YES | Alert.NO);
 }
 
 ]]
 /mx:Script
 
 mx:Panel
 mx:Form
 mx:FormItem label=Label1
 mx:TextInput id=ti_1 /
 /mx:FormItem
 mx:FormItem label=Label2
 mx:TextInput id=ti_2 /
 /mx:FormItem
 mx:FormItem label=Label3
 mx:TextInput id=ti_3 /
 /mx:FormItem
 
 mx:Button label=Button click=createMsg(event);/
 
 /mx:Form
 /mx:Panel
 
 /mx:Application
 
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , Gordon Smith gosmith@ wrote:
 
  I wish I could understand what you don't understand. Here's a complete
  working example.
  
  - Gordon
  
  ?xml version=1.0?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
  
  mx:Script
  ![CDATA[
  
  import mx.controls.Alert;
  
  private function createMsg(event:Event):void
  {
  var topLeft:Point = new Point(0, 0);
  topLeft = event.currentTarget.localToGlobal(topLeft);
  Alert.show(the X position of the top left of LABEL 1 in
  global coordinates is  + topLeft.x, Show Me, Alert.YES | Alert.NO);
  }
  
  ]]
  /mx:Script
  
  mx:Panel
  mx:Form
  mx:FormItem label=Label1
  mx:TextInput focusOut=createMsg(event);/
  /mx:FormItem
  mx:FormItem label=Label2
  mx:TextInput/
  /mx:FormItem
  mx:FormItem label=Label3
  mx:TextInput/
  /mx:FormItem
  /mx:Form
  /mx:Panel
  
  /mx:Application
  
  
  
  From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 ] On
  Behalf Of flexawesome
  Sent: Wednesday, September 12, 2007 9:43 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
  Subject: [flexcoders] Re: How to get Textinput position?
  
  
  
  great, I see but I was serious how to get a textInput position in
  form ( id=textInput ) by click the button?
  
  for example like coding below? huummm
  
  evt.currentTarget.parent.localToGlobal (new
  Point(evt.currentTarget.x,evt.target.textInput.y)).y 
  
  Cheers
  
  --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
  , Gordon Smith gosmith@ wrote:
  
   Assuming that what you want is global coordinates, it's even simpler
  to
   do
   
   event.currentTarget.localToGlobal(new Point(0, 0)).x
   
   which works because the upper-left of any component is (0, 0) in its
  own
   local coordinate system.
   
   - Gordon
   
   
   
   From: flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
 mailto:flexcoders%40yahoogroups.com
  ] On
   Behalf Of flexawesome
   Sent: Tuesday, September 11, 2007 8:32 AM
   To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 mailto:flexcoders%40yahoogroups.com 
   Subject: [flexcoders] Re: How to get Textinput position?
   
   
   
   you are SO COOL. Thank you so much :)
   
   have a nice day
   
   --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com 
  mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders%40yahoogroups.com
   , Sven

[flexcoders] Re: How to get Textinput position?

2007-09-12 Thread flexawesome
humm Gordon,

I have a reference to a component (ti_2), but still can't get the 
right position, do you mind to have a look? :)

Thanks

==
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;

mx:Script
![CDATA[

import mx.controls.Alert;

private function createMsg
(event:Event):void
{
var id:String = ti_2;
var txtInput:TextInput = this
[id];

var xPos:int = txtInput.x;

//You flex, please show me your 
position :)
 //var xPos:int = ti_2.x;
trace(xPos)
}

]]
/mx:Script

mx:Panel
mx:Form

mx:FormItem label=Label1
mx:TextInput id=ti_1 /
/mx:FormItem

mx:FormItem label=Label2
mx:TextInput id=ti_2 /
/mx:FormItem

mx:FormItem label=Label3
mx:TextInput id=ti_3 /
/mx:FormItem

mx:Button label=Button click=createMsg
(event);/
/mx:Form
/mx:Panel

/mx:Application
===

--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 Ahh.. I was confused because what you really want to know 
is, Given an
 String specifying a component's id, how do I get a reference to that
 component?
  
 The answer to that is to use this[id]:
  
 var id:String = ti_2;
 var textInput:TextInput = this[id];
  
 Of course, once you have a reference to a component, you can get its
 position or any other property.
  
 - Gordon
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of flexawesome
 Sent: Wednesday, September 12, 2007 1:27 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 
 Hey Gordon,
 
 I am appreciate for your promptly response, sorry for my confusion. 
I
 mean if I know the id name for the textInput, is there a way to 
click
 the button to get the position for ti_2?
 
 Have a nice day :)
 
 =
 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
 
 mx:Script
 ![CDATA[
 
 import mx.controls.Alert;
 
 private function createMsg(event:Event):void
 {
 var topLeft:Point = new Point(0, 0);
 topLeft = event.currentTarget.localToGlobal(topLeft);
 Alert.show(the X position of the top left of LABEL 1 in
 global coordinates is  + topLeft.x, Show Me, Alert.YES | 
Alert.NO);
 }
 
 ]]
 /mx:Script
 
 mx:Panel
 mx:Form
 mx:FormItem label=Label1
 mx:TextInput id=ti_1 /
 /mx:FormItem
 mx:FormItem label=Label2
 mx:TextInput id=ti_2 /
 /mx:FormItem
 mx:FormItem label=Label3
 mx:TextInput id=ti_3 /
 /mx:FormItem
 
 mx:Button label=Button click=createMsg(event);/
 
 /mx:Form
 /mx:Panel
 
 /mx:Application
 
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 , Gordon Smith gosmith@ wrote:
 
  I wish I could understand what you don't understand. Here's a 
complete
  working example.
  
  - Gordon
  
  ?xml version=1.0?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
  
  mx:Script
  ![CDATA[
  
  import mx.controls.Alert;
  
  private function createMsg(event:Event):void
  {
  var topLeft:Point = new Point(0, 0);
  topLeft = event.currentTarget.localToGlobal(topLeft);
  Alert.show(the X position of the top left of LABEL 1 in
  global coordinates is  + topLeft.x, Show Me, Alert.YES | 
Alert.NO);
  }
  
  ]]
  /mx:Script
  
  mx:Panel
  mx:Form
  mx:FormItem label=Label1
  mx:TextInput focusOut=createMsg(event);/
  /mx:FormItem
  mx:FormItem label=Label2
  mx:TextInput/
  /mx:FormItem
  mx:FormItem label=Label3
  mx:TextInput/
  /mx:FormItem
  /mx:Form
  /mx:Panel
  
  /mx:Application
  
  
  
  From: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 ] On
  Behalf Of flexawesome
  Sent: Wednesday, September 12, 2007 9:43 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com 
  Subject: [flexcoders] Re: How to get Textinput position?
  
  
  
  great, I see but I was serious how to get a textInput 
position in
  form ( id=textInput ) by click the button?
  
  for example like coding

[flexcoders] Re: How to get Textinput position?

2007-09-11 Thread flexawesome

Hi Gordeon,

Thank you so much to reply it as I am new to flex, and don't know how 
to use localToGlobal()  it in my app below, I am appreciate if you 
can show me the code , that would be great!

THANKS :)

--- In flexcoders@yahoogroups.com, Gordon Smith [EMAIL PROTECTED] wrote:

 The x and y properties of a DisplayObject are in the coordinate 
system
 of its parent. So you're getting the location of the top-left of the
 TextInput relative to the top-left of the FormItem. If you want
 coordinates in a different coordinate system, use localToGlobal() 
and
 globalToLocal().
  
 - Gordon
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of flexawesome
 Sent: Monday, September 10, 2007 7:11 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 
 humm...parent doesn't work... and I correct the code below..
 
 Cheers
 
 
 
 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
 viewSourceURL=srcview/index.html
 mx:Script
 ![CDATA[
 
 import mx.core.IFlexDisplayObject;
 import mx.core.UIComponent;
 import mx.controls.Alert;
 
 private function createMsg(event:Event):void {
 
 var target:UIComponent = UIComponent(event.currentTarget); 
 
 var alert:Alert; 
 
 Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
 Show Me, Alert.YES | Alert.NO)
 }
 
 ]]
 /mx:Script
 
 mx:Panel
 mx:Form
 mx:FormItem label=Label1
 mx:TextInput focusOut=createMsg(event);/
 /mx:FormItem
 mx:FormItem label=Label2
 mx:TextInput/
 /mx:FormItem
 mx:FormItem label=Label3
 mx:TextInput/
 /mx:FormItem
 /mx:Form
 /mx:Panel
 
 /mx:Application
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 , Alex Harui aharui@ wrote:
 
  Might be event.currentTarget.parent.x. There is no Label1 in your
  sample. Also see localToGlobal
  
  
  
  
  
  From: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 ] On
  Behalf Of flexawesome
  Sent: Monday, September 10, 2007 11:43 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com 
  Subject: [flexcoders] How to get Textinput position?
  
  
  
  Hi guys :)
  
  I am working on flex, and looks hard to get the target object x 
and 
 y
  position. do you have any ideas?
  
  Cheers  THANKS
  
  
  
  ?xml version=1.0?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
  http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml 
 
  viewSourceURL=srcview/index.html
  mx:Script
  ![CDATA[
  
  import mx.core.IFlexDisplayObject;
  import mx.core.UIComponent;
  import mx.controls.Alert;
  
  
  private function createMsg(event:Event):void {
  
  var target:UIComponent = UIComponent(event.currentTarget); 
  
  var alert:Alert; 
  
  Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
  Show Me, Alert.YES | Alert.NO)
  }
  
  ]]
  /mx:Script
  
  mx:Panel
  mx:Form
  mx:FormItem label=Label
  mx:TextInput focusOut=createMsg(event);/
  /mx:FormItem
  mx:FormItem label=Label
  mx:TextInput/
  /mx:FormItem
  mx:FormItem label=Labe3
  mx:TextInput/
  /mx:FormItem
  /mx:Form
  /mx:Panel
  
  /mx:Application
 





Re: [flexcoders] Re: How to get Textinput position?

2007-09-11 Thread Sven Woermann
Hi, try this. You are basically calling the localToGlobal method on the
parent container of the TextInput and give it the position of the TextInput
relative to it's parent.

event.currentTarget.parent.localToGlobal(new Point(event.currentTarget.x,
event.currentTarget.y)).x




On 9/11/07, flexawesome [EMAIL PROTECTED] wrote:


 Hi Gordeon,

 Thank you so much to reply it as I am new to flex, and don't know how
 to use localToGlobal() it in my app below, I am appreciate if you
 can show me the code , that would be great!

 THANKS :)


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Gordon
 Smith [EMAIL PROTECTED] wrote:
 
  The x and y properties of a DisplayObject are in the coordinate
 system
  of its parent. So you're getting the location of the top-left of the
  TextInput relative to the top-left of the FormItem. If you want
  coordinates in a different coordinate system, use localToGlobal()
 and
  globalToLocal().
 
  - Gordon
 
  
 
  From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On
  Behalf Of flexawesome
  Sent: Monday, September 10, 2007 7:11 PM
  To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
  Subject: [flexcoders] Re: How to get Textinput position?
 
 
 
 
  humm...parent doesn't work... and I correct the code below..
 
  Cheers
 
  
 
  ?xml version=1.0?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
  http://www.adobe.com/2006/mxml 
  viewSourceURL=srcview/index.html
  mx:Script
  ![CDATA[
 
  import mx.core.IFlexDisplayObject;
  import mx.core.UIComponent;
  import mx.controls.Alert;
 
  private function createMsg(event:Event):void {
 
  var target:UIComponent = UIComponent(event.currentTarget);
 
  var alert:Alert;
 
  Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
  Show Me, Alert.YES | Alert.NO)
  }
 
  ]]
  /mx:Script
 
  mx:Panel
  mx:Form
  mx:FormItem label=Label1
  mx:TextInput focusOut=createMsg(event);/
  /mx:FormItem
  mx:FormItem label=Label2
  mx:TextInput/
  /mx:FormItem
  mx:FormItem label=Label3
  mx:TextInput/
  /mx:FormItem
  /mx:Form
  /mx:Panel
 
  /mx:Application
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto:
 flexcoders% flexcoders%25
 40yahoogroups.com
  , Alex Harui aharui@ wrote:
  
   Might be event.currentTarget.parent.x. There is no Label1 in your
   sample. Also see localToGlobal
  
  
  
   
  
   From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto:
 flexcoders% flexcoders%25
 40yahoogroups.com
 
  [mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.commailto:
 flexcoders% flexcoders%25
 40yahoogroups.com
  ] On
   Behalf Of flexawesome
   Sent: Monday, September 10, 2007 11:43 AM
   To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com mailto:
 flexcoders% flexcoders%25
 40yahoogroups.com
   Subject: [flexcoders] How to get Textinput position?
  
  
  
   Hi guys :)
  
   I am working on flex, and looks hard to get the target object x
 and
  y
   position. do you have any ideas?
  
   Cheers  THANKS
  
   
  
   ?xml version=1.0?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
  http://www.adobe.com/2006/mxml
   http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml
  
   viewSourceURL=srcview/index.html
   mx:Script
   ![CDATA[
  
   import mx.core.IFlexDisplayObject;
   import mx.core.UIComponent;
   import mx.controls.Alert;
  
  
   private function createMsg(event:Event):void {
  
   var target:UIComponent = UIComponent(event.currentTarget);
  
   var alert:Alert;
  
   Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
   Show Me, Alert.YES | Alert.NO)
   }
  
   ]]
   /mx:Script
  
   mx:Panel
   mx:Form
   mx:FormItem label=Label
   mx:TextInput focusOut=createMsg(event);/
   /mx:FormItem
   mx:FormItem label=Label
   mx:TextInput/
   /mx:FormItem
   mx:FormItem label=Labe3
   mx:TextInput/
   /mx:FormItem
   /mx:Form
   /mx:Panel
  
   /mx:Application
  
 

  



[flexcoders] Re: How to get Textinput position?

2007-09-11 Thread flexawesome
you are SO COOL. Thank you so much :)

have a nice day

--- In flexcoders@yahoogroups.com, Sven Woermann [EMAIL PROTECTED]
wrote:

 Hi, try this. You are basically calling the localToGlobal method on the
 parent container of the TextInput and give it the position of the
TextInput
 relative to it's parent.
 
 event.currentTarget.parent.localToGlobal(new
Point(event.currentTarget.x,
 event.currentTarget.y)).x
 
 
 
 
 On 9/11/07, flexawesome [EMAIL PROTECTED] wrote:
 
 
  Hi Gordeon,
 
  Thank you so much to reply it as I am new to flex, and don't know how
  to use localToGlobal() it in my app below, I am appreciate if you
  can show me the code , that would be great!
 
  THANKS :)
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com,
Gordon
  Smith gosmith@ wrote:
  
   The x and y properties of a DisplayObject are in the coordinate
  system
   of its parent. So you're getting the location of the top-left of the
   TextInput relative to the top-left of the FormItem. If you want
   coordinates in a different coordinate system, use localToGlobal()
  and
   globalToLocal().
  
   - Gordon
  
   
  
   From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On
   Behalf Of flexawesome
   Sent: Monday, September 10, 2007 7:11 PM
   To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
   Subject: [flexcoders] Re: How to get Textinput position?
  
  
  
  
   humm...parent doesn't work... and I correct the code below..
  
   Cheers
  
   
  
   ?xml version=1.0?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
   http://www.adobe.com/2006/mxml 
   viewSourceURL=srcview/index.html
   mx:Script
   ![CDATA[
  
   import mx.core.IFlexDisplayObject;
   import mx.core.UIComponent;
   import mx.controls.Alert;
  
   private function createMsg(event:Event):void {
  
   var target:UIComponent = UIComponent(event.currentTarget);
  
   var alert:Alert;
  
   Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
   Show Me, Alert.YES | Alert.NO)
   }
  
   ]]
   /mx:Script
  
   mx:Panel
   mx:Form
   mx:FormItem label=Label1
   mx:TextInput focusOut=createMsg(event);/
   /mx:FormItem
   mx:FormItem label=Label2
   mx:TextInput/
   /mx:FormItem
   mx:FormItem label=Label3
   mx:TextInput/
   /mx:FormItem
   /mx:Form
   /mx:Panel
  
   /mx:Application
  
   --- In flexcoders@yahoogroups.com
flexcoders%40yahoogroups.commailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
   , Alex Harui aharui@ wrote:
   
Might be event.currentTarget.parent.x. There is no Label1 in your
sample. Also see localToGlobal
   
   
   

   
From: flexcoders@yahoogroups.com
flexcoders%40yahoogroups.commailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
  
   [mailto:flexcoders@yahoogroups.com
flexcoders%40yahoogroups.commailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
   ] On
Behalf Of flexawesome
Sent: Monday, September 10, 2007 11:43 AM
To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com
mailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
Subject: [flexcoders] How to get Textinput position?
   
   
   
Hi guys :)
   
I am working on flex, and looks hard to get the target object x
  and
   y
position. do you have any ideas?
   
Cheers  THANKS
   

   
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
   http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml
   
viewSourceURL=srcview/index.html
mx:Script
![CDATA[
   
import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.controls.Alert;
   
   
private function createMsg(event:Event):void {
   
var target:UIComponent = UIComponent(event.currentTarget);
   
var alert:Alert;
   
Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
Show Me, Alert.YES | Alert.NO)
}
   
]]
/mx:Script
   
mx:Panel
mx:Form
mx:FormItem label=Label
mx:TextInput focusOut=createMsg(event);/
/mx:FormItem
mx:FormItem label=Label
mx:TextInput/
/mx:FormItem
mx:FormItem label=Labe3
mx:TextInput/
/mx:FormItem
/mx:Form
/mx:Panel
   
/mx:Application
   
  
 
   
 





RE: [flexcoders] Re: How to get Textinput position?

2007-09-11 Thread Gordon Smith
Assuming that what you want is global coordinates, it's even simpler to
do
 
event.currentTarget.localToGlobal(new Point(0, 0)).x
 
which works because the upper-left of any component is (0, 0) in its own
local coordinate system.
 
- Gordon



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of flexawesome
Sent: Tuesday, September 11, 2007 8:32 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: How to get Textinput position?



you are SO COOL. Thank you so much :)

have a nice day

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Sven Woermann [EMAIL PROTECTED]
wrote:

 Hi, try this. You are basically calling the localToGlobal method on
the
 parent container of the TextInput and give it the position of the
TextInput
 relative to it's parent.
 
 event.currentTarget.parent.localToGlobal(new
Point(event.currentTarget.x,
 event.currentTarget.y)).x
 
 
 
 
 On 9/11/07, flexawesome [EMAIL PROTECTED] wrote:
 
 
  Hi Gordeon,
 
  Thank you so much to reply it as I am new to flex, and don't know
how
  to use localToGlobal() it in my app below, I am appreciate if you
  can show me the code , that would be great!
 
  THANKS :)
 
 
  --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com,
Gordon
  Smith gosmith@ wrote:
  
   The x and y properties of a DisplayObject are in the coordinate
  system
   of its parent. So you're getting the location of the top-left of
the
   TextInput relative to the top-left of the FormItem. If you want
   coordinates in a different coordinate system, use localToGlobal()
  and
   globalToLocal().
  
   - Gordon
  
   
  
   From: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com
  [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com]
On
   Behalf Of flexawesome
   Sent: Monday, September 10, 2007 7:11 PM
   To: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com
   Subject: [flexcoders] Re: How to get Textinput position?
  
  
  
  
   humm...parent doesn't work... and I correct the code below..
  
   Cheers
  
   
  
   ?xml version=1.0?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 
   http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml 

   viewSourceURL=srcview/index.html
   mx:Script
   ![CDATA[
  
   import mx.core.IFlexDisplayObject;
   import mx.core.UIComponent;
   import mx.controls.Alert;
  
   private function createMsg(event:Event):void {
  
   var target:UIComponent = UIComponent(event.currentTarget);
  
   var alert:Alert;
  
   Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
   Show Me, Alert.YES | Alert.NO)
   }
  
   ]]
   /mx:Script
  
   mx:Panel
   mx:Form
   mx:FormItem label=Label1
   mx:TextInput focusOut=createMsg(event);/
   /mx:FormItem
   mx:FormItem label=Label2
   mx:TextInput/
   /mx:FormItem
   mx:FormItem label=Label3
   mx:TextInput/
   /mx:FormItem
   /mx:Form
   /mx:Panel
  
   /mx:Application
  
   --- In flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
flexcoders%40yahoogroups.commailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
   , Alex Harui aharui@ wrote:
   
Might be event.currentTarget.parent.x. There is no Label1 in
your
sample. Also see localToGlobal
   
   
   

   
From: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
flexcoders%40yahoogroups.commailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
  
   [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com 
flexcoders%40yahoogroups.commailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
   ] On
Behalf Of flexawesome
Sent: Monday, September 10, 2007 11:43 AM
To: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com  flexcoders%40yahoogroups.com
mailto:
  flexcoders% flexcoders%25
  40yahoogroups.com
Subject: [flexcoders] How to get Textinput position?
   
   
   
Hi guys :)
   
I am working on flex, and looks hard to get the target object x
  and
   y
position. do you have any ideas?
   
Cheers  THANKS
   

   
?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 
   http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml 
http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml 
   
viewSourceURL=srcview/index.html
mx:Script
![CDATA[
   
import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.controls.Alert;
   
   
private function createMsg(event:Event):void {
   
var target:UIComponent = UIComponent(event.currentTarget

[flexcoders] Re: How to get Textinput position?

2007-09-10 Thread flexawesome

humm...parent doesn't work... and I correct the code below..

Cheers



?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
viewSourceURL=srcview/index.html
mx:Script
![CDATA[

import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.controls.Alert;


private function createMsg(event:Event):void {

var target:UIComponent = UIComponent(event.currentTarget); 

var alert:Alert; 

Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
Show Me, Alert.YES | Alert.NO)
}

]]
/mx:Script

mx:Panel
mx:Form
mx:FormItem label=Label1
mx:TextInput focusOut=createMsg(event);/
/mx:FormItem
mx:FormItem label=Label2
mx:TextInput/
/mx:FormItem
mx:FormItem label=Label3
mx:TextInput/
/mx:FormItem
/mx:Form
/mx:Panel

/mx:Application

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Might be event.currentTarget.parent.x.  There is no Label1 in your
 sample.  Also see localToGlobal
 
  
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of flexawesome
 Sent: Monday, September 10, 2007 11:43 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] How to get Textinput position?
 
  
 
 Hi guys :)
 
 I am working on flex, and looks hard to get the target object x and 
y
 position. do you have any ideas?
 
 Cheers  THANKS
 
 
 
 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
 viewSourceURL=srcview/index.html
 mx:Script
 ![CDATA[
 
 import mx.core.IFlexDisplayObject;
 import mx.core.UIComponent;
 import mx.controls.Alert;
 
 
 private function createMsg(event:Event):void {
 
 var target:UIComponent = UIComponent(event.currentTarget); 
 
 var alert:Alert; 
 
 Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
 Show Me, Alert.YES | Alert.NO)
 }
 
 ]]
 /mx:Script
 
 mx:Panel
 mx:Form
 mx:FormItem label=Label
 mx:TextInput focusOut=createMsg(event);/
 /mx:FormItem
 mx:FormItem label=Label
 mx:TextInput/
 /mx:FormItem
 mx:FormItem label=Labe3
 mx:TextInput/
 /mx:FormItem
 /mx:Form
 /mx:Panel
 
 /mx:Application





RE: [flexcoders] Re: How to get Textinput position?

2007-09-10 Thread Gordon Smith
The x and y properties of a DisplayObject are in the coordinate system
of its parent. So you're getting the location of the top-left of the
TextInput relative to the top-left of the FormItem. If you want
coordinates in a different coordinate system, use localToGlobal() and
globalToLocal().
 
- Gordon



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of flexawesome
Sent: Monday, September 10, 2007 7:11 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: How to get Textinput position?




humm...parent doesn't work... and I correct the code below..

Cheers



?xml version=1.0?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 
viewSourceURL=srcview/index.html
mx:Script
![CDATA[

import mx.core.IFlexDisplayObject;
import mx.core.UIComponent;
import mx.controls.Alert;

private function createMsg(event:Event):void {

var target:UIComponent = UIComponent(event.currentTarget); 

var alert:Alert; 

Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
Show Me, Alert.YES | Alert.NO)
}

]]
/mx:Script

mx:Panel
mx:Form
mx:FormItem label=Label1
mx:TextInput focusOut=createMsg(event);/
/mx:FormItem
mx:FormItem label=Label2
mx:TextInput/
/mx:FormItem
mx:FormItem label=Label3
mx:TextInput/
/mx:FormItem
/mx:Form
/mx:Panel

/mx:Application

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Alex Harui [EMAIL PROTECTED] wrote:

 Might be event.currentTarget.parent.x. There is no Label1 in your
 sample. Also see localToGlobal
 
 
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of flexawesome
 Sent: Monday, September 10, 2007 11:43 AM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] How to get Textinput position?
 
 
 
 Hi guys :)
 
 I am working on flex, and looks hard to get the target object x and 
y
 position. do you have any ideas?
 
 Cheers  THANKS
 
 
 
 ?xml version=1.0?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml 
 http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml  
 viewSourceURL=srcview/index.html
 mx:Script
 ![CDATA[
 
 import mx.core.IFlexDisplayObject;
 import mx.core.UIComponent;
 import mx.controls.Alert;
 
 
 private function createMsg(event:Event):void {
 
 var target:UIComponent = UIComponent(event.currentTarget); 
 
 var alert:Alert; 
 
 Alert.show(the X position of LABEL 1 is +event.currentTarget.x,
 Show Me, Alert.YES | Alert.NO)
 }
 
 ]]
 /mx:Script
 
 mx:Panel
 mx:Form
 mx:FormItem label=Label
 mx:TextInput focusOut=createMsg(event);/
 /mx:FormItem
 mx:FormItem label=Label
 mx:TextInput/
 /mx:FormItem
 mx:FormItem label=Labe3
 mx:TextInput/
 /mx:FormItem
 /mx:Form
 /mx:Panel
 
 /mx:Application