[flexcoders] Re: Question about getting the type of item / component with drag and drop

2009-12-10 Thread turbo_vb
See #1 in Gordon's response.

-TH

--- In flexcoders@yahoogroups.com, "timgerr"  wrote:
>
> What is the best way to check if it is a panel?
> 
> timgerr
> 
> --- In flexcoders@yahoogroups.com, Gordon Smith  wrote:
> >
> > 1. if (dragEvent.currentTarget is Panel)
> > 
> > 2. currentTarget is generically typed as Object, which doesn't have an 
> > addChild() method. But if you have already checked that the dropTarget is a 
> > Panel, it's safe to do a cast:
> > 
> > Panel(dragEvent.currentTarget).addChild(...);
> > 
> > Gordon Smith
> > Adobe Flex SDK Team
> > 
> > From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
> > Behalf Of timgerr
> > Sent: Wednesday, December 09, 2009 12:01 PM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Question about getting the type of item / component 
> > with drag and drop
> > 
> > 
> > 
> > Hello all,
> > I have been tasked with creating a menu that gets build with drag and drop 
> > components. I have followed this tutorial 
> > (http://www.flexafterdark.com/tutorials/Flex-Drag-and-Drop) and have 
> > learned a lot.
> > 
> > I have a few questions to get to the next stage so I will ask a few 
> > questions.
> > 
> > 1. When I drop (or drag over) an item like a panel, how can I tell what 
> > that UIComponent is, how can I tell that is a panel?
> > 
> > 2. How can I get that panel as an object so I can do something like 
> > panelid.addChild(new dropped item)?
> > 
> > Thanks for the read,
> > timgerr
> > 
> > Here is the code that I have from the tutorial.
> > 
> > 
> > http://www.adobe.com/2006/mxml"; layout="absolute"
> > name="Drag and Drop tutorial" creationComplete="Init()">
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
>




[flexcoders] Re: Question about getting the type of item / component with drag and drop

2009-12-09 Thread timgerr
What is the best way to check if it is a panel?

timgerr

--- In flexcoders@yahoogroups.com, Gordon Smith  wrote:
>
> 1. if (dragEvent.currentTarget is Panel)
> 
> 2. currentTarget is generically typed as Object, which doesn't have an 
> addChild() method. But if you have already checked that the dropTarget is a 
> Panel, it's safe to do a cast:
> 
> Panel(dragEvent.currentTarget).addChild(...);
> 
> Gordon Smith
> Adobe Flex SDK Team
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
> Behalf Of timgerr
> Sent: Wednesday, December 09, 2009 12:01 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Question about getting the type of item / component 
> with drag and drop
> 
> 
> 
> Hello all,
> I have been tasked with creating a menu that gets build with drag and drop 
> components. I have followed this tutorial 
> (http://www.flexafterdark.com/tutorials/Flex-Drag-and-Drop) and have learned 
> a lot.
> 
> I have a few questions to get to the next stage so I will ask a few questions.
> 
> 1. When I drop (or drag over) an item like a panel, how can I tell what that 
> UIComponent is, how can I tell that is a panel?
> 
> 2. How can I get that panel as an object so I can do something like 
> panelid.addChild(new dropped item)?
> 
> Thanks for the read,
> timgerr
> 
> Here is the code that I have from the tutorial.
> 
> 
> http://www.adobe.com/2006/mxml"; layout="absolute"
> name="Drag and Drop tutorial" creationComplete="Init()">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>