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._UpdateDeleteProd1.Form10.FormItem102.HBox103.Button104 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.getElementById() 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.