Well, you can use getChildAt() and assume indexes (they are less likely
to change).  You can subclass the components and walk their trees
assigning names

 

________________________________

From: Zoran Avramov [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 13, 2008 2:54 PM
To: flexcoders@yahoogroups.com; Alex Harui
Subject: RE: [flexcoders] AS 3.0 event target problem!!!

 

Yep I thought you did something like that for the numbering and that is
definitely not going to work. In terms of walking the tree and assigning
names this will not work either since one of my requirements (It sucks
to be me...) is to use my path or control name (that I just got from
clicking on a button lets say) on a different instance of the .swf and
this new instance will not have those names that I will generate. Is
there any way that I can associate a control on the .swf with some type
of identifier that can be used at a different instance of the .swf and
select that control.



--- On Wed, 8/13/08, Alex Harui <[EMAIL PROTECTED]> wrote:

From: Alex Harui <[EMAIL PROTECTED]>
Subject: RE: [flexcoders] AS 3.0 event target problem!!!
To: [EMAIL PROTECTED], flexcoders@yahoogroups.com
Date: Wednesday, August 13, 2008, 2:40 PM

Hmm.  I thought the name property of every sprite was filled out.  You
could certainly walk the tree and find things with no name and give them
names.

 

The numbering has to do with when it got instantiated.  The
ConfirmScreen was the 388th thing, UIComponent was the 418th, etc.  But
one UI change or timing glitch can change those numbers.

 

________________________________

From: Zoran Avramov [mailto:zoran_ [EMAIL PROTECTED] com] 
Sent: Wednesday, August 13, 2008 2:21 PM
To: [EMAIL PROTECTED] ups.com ; Alex Harui
Subject: RE: [flexcoders] AS 3.0 event target problem!!!

 

What happens when the object does not have a name (or it does not have a
static name) like the close button that I mentioned below? Also can you
share something on how the numbering schema works (ConfirmScreen388.
UIComponent418. Button422), maybe I can match the numbering somehow that
if that information is publicly available. 

--- On Wed, 8/13/08, Alex Harui <[EMAIL PROTECTED] com> wrote:

From: Alex Harui <[EMAIL PROTECTED] com>
Subject: RE: [flexcoders] AS 3.0 event target problem!!!
To: [EMAIL PROTECTED] com, [EMAIL PROTECTED] ups.com
Date: Wednesday, August 13, 2008, 12:53 PM

The root of a SWF is a SystemManager.  All Popups and the Application
are children of the SystemManager.

 

You may be able to use getChildByName and get more consistent results.

 

We have a much more sophisticated technology we use in house to exercise
components similar to what you are doing.  Maybe it will be public
someday.

 

________________________________

From: Zoran Avramov [mailto:zoran_ [EMAIL PROTECTED] com] 
Sent: Wednesday, August 13, 2008 9:40 AM
To: [EMAIL PROTECTED] ups.com
Cc: Alex Harui
Subject: RE: [flexcoders] AS 3.0 event target problem!!!

 

Hi Alex/Gordon

 

The problem with assigning IDs is that the popup container has that
close button (the path that I gave) when you create the actual popup.
For example the button that I gave an example with no path to the root
(ConfirmScreen388. UIComponent418. Button422) , is created by just
setting this flag 'showCloseButton="true"' in the code below. I need to
be able to find a way to identify that button or any other DisplayObject
that I want to monitor for clicks and then execute those clicks on a
different instance of the same .swf. I have not found a good way to do
this and if you can help me understand how you render your DOM in flex
(at least the part that will help me do this) it would be greatly
appreciated. 

 

<mx:TitleWindow xmlns:mx="http://www.adobe. com/2006/ mxml
<http://www.adobe.com/2006/mxml> "
 layout="vertical"
 close="PopUpManager. removePopUp( this)"
 showCloseButton="true">

 

 

Thanks,

Zoran

 



--- On Tue, 8/12/08, Alex Harui <[EMAIL PROTECTED] com> wrote:

        From: Alex Harui <[EMAIL PROTECTED] com>
        Subject: RE: [flexcoders] AS 3.0 event target problem!!!
        To: [EMAIL PROTECTED] ups.com
        Date: Tuesday, August 12, 2008, 9:38 PM

He's surprised that the popup isn't parented by the app.  Popups are
parented by the systemMgr which also parents the app.

 

Id's are per-document (or per-mxml file) so you can traverse documents
and pull objects by their ids.

 

________________________________

From: [EMAIL PROTECTED] ups.com [mailto: [EMAIL PROTECTED] ups.com ]
On Behalf Of Gordon Smith
Sent: Tuesday, August 12, 2008 7:54 PM
To: [EMAIL PROTECTED] ups.com
Subject: RE: [flexcoders] AS 3.0 event target problem!!!

 

What do you mean by "I don't have the path to the root"?

 

If you assign an id to each component, the toString() method will use
that instead of a dynamically generated name like Button498.

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: [EMAIL PROTECTED] ups.com [mailto: [EMAIL PROTECTED] ups.com ]
On Behalf Of zoran_101
Sent: Tuesday, August 12, 2008 4:30 PM
To: [EMAIL PROTECTED] ups.com
Subject: [flexcoders] AS 3.0 event target problem!!!

 

I have an interesting problem regarding event.target in Flex 
2/ActionScript 3.0. I am using the Flex Grocer app in order to try 
something out. I am attaching listeners to all the click events and 
then printing out event.target to keep track of my events and where 
we clicked, nothing revolutionary here very easy stuff. Once I get 
the paths I would like to run code that will execute my steps and 
play the clicks back based on the event.target information that I got 
and I was able to do that except when we have popups. Here is the 
problem:

When I execute a click on a button with event.target =
DataEntry0._ UpdateDeleteProd 1.Form10. FormItem102. HBox103.Button10 4 
A poupup appears and then I click on the close button on that popup 
with event.target=
ConfirmScreen464. UIComponent494. Button498

COUPLE OF PROBLEMS HERE:
1) I don't have the path to the root (DataEntry0) even though I 
use the standard event.target.
2) This is even a bigger problem, the DOM path 
(ConfirmScreen464. UIComponent494. Button498) is dynamically generated 
(the numbers are dynamically generated) so when I use that path that 
I got during the time I was monitoring the app, when I use my code to 
play the events that very same target does not correspond to the 
popup that the fist event caused. 

I tried using IDs but in Flex I have not found anything like 
document.getElement ById() that is available in JavaScript. Any help 
on this will be greatly appreciated.

Thanks

p.s. I looked at the automation library that Flex has (and Mercury 
QTP uses) but that will not work for me.

 

 

 

 

Reply via email to