To copy yourself would look something like this
myDragDropHandler(event:DragEvent):void
{
If (event.action == DragManager.COPY)
{
event.preventDefault();
var index:int = calculateDropIndex(event);
var items:Array =
event.dragSource.dataForFormat("items");
var n:int = items.length;
for (var i:int = 0; I < n; i++)
{
var newVO:VO = new VO();
var oldVO:VO = items[i] as VO;
newVo.prop1 = oldVO.prop1;
newVo.prop2 = oldVO.prop2;
dataProvider.addItemAt(newVO,
index);
}
}
}
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of florian.salihovic
Sent: Tuesday, August 19, 2008 4:37 PM
To: [email protected]
Subject: [flexcoders] Re: ItemRenderer returns empty Object instead of
encapsuled data - update
Thanx for the info. This is really helpful to know.
Is there perhaps a short example to start with?
Best regards and thanx for the help!
--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Ah, ok. The default copy mechanism won't work on typed objects unless
> they are [RemoteClass] or use registerClassAlias. You can always
> override the dragDrop handle and do your own intelligent copy.
>
>
>
> ________________________________
>
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of florian.salihovic
> Sent: Tuesday, August 19, 2008 3:18 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: ItemRenderer returns empty Object instead of
> encapsuled data - update
>
>
>
> Hello Alex,
>
> dragMoveEnabled is making the difference. When i don't use any
> ItemRenderer the called i
> get [object PlayListItem] and the collections i wrapped in typed
> methods.
>
> It seems like the DataGridDragProxy works not right, when
> dragMoveEnabled is set to
> false. Actually it does in my case as far as i can say.
>
> Best regards.
>
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> , "Alex Harui" <aharui@> wrote:
> >
> > Are you using modules or sub-applications? Where does the data come
> > from? It seems like it isn't being converted correctly. Have you
> > proven that each collection contains the correct object and not
> Objects?
> >
> >
> >
> > ________________________________
> >
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of florian.salihovic
> > Sent: Tuesday, August 19, 2008 2:05 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Re: ItemRenderer returns empty Object instead
of
> > encapsuled data - update
> >
> >
> >
> > Update:
> >
> > Using a for each loop shows me even the right value, but it's type
is
> > lost.
> > override public function set data(value:Object):void {
> > trace(describeType(value));
> > for each(var a:* in value) {
> > trace(a)
> > }
> > if (this._item == value) {
> > return;
> > }
> > super.data = value;
> > if (value is IPlayListItem) {
> > this._item = IPlayListItem(value);
> > }
> > this.dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
> > }
> >
> > -> the condition value is IPLayListItem is actually never true.
> >
> > Best regards
> >
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > , "florian.salihovic" <florian.salihovic@> wrote:
> > >
> > > Something i forgot to add:
> > > in the Debugger the passed Object, which is said to be not
> convertable
> > in the desired
> > > type, shows the right properties.
> > >
> > > Pretty strange to me.
> > >
> > >
> > >
> > > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com> , "florian.salihovic"
> > <florian.salihovic@> wrote:
> > > >
> > > > Here is the stacktrace:
> > > > TypeError: Error #1034: Typumwandlung fehlgeschlagen:
> > [EMAIL PROTECTED] kann
> > nicht
> > > in
> > > > de.blitzeinschlag.playlisteditor.model.playlists.IPlayListItem
> > umgewandelt werden.
> > > > at
> >
>
de.blitzeinschlag.playlisteditor.view.playlists.listClasses::ListItemRen
> > derer/set
> > > >
> > >
> >
>
data()[/Users/florian/Workspaces/blitzeinschlag/PlayListEditor/src/de/bl
> > itzeinschlag/playl
> > > isteditor/view/playlists/listClasses/ListItemRenderer.mx
> > > > ml:99]
> > > > at
> > >
> >
>
mx.controls::List/makeRowsAndColumns()[E:\dev\3.1.0\frameworks\projects\
> > framework\
> > > src\mx\controls\List.as:1286]
> > > > at
> > > >
> > >
> >
>
mx.controls.listClasses::ListBase/makeRowsAndColumnsWithExtraRows()[E:\d
> > ev\3.1.0\fra
> > > meworks\projects\framework\src\mx\controls\listClasses
> > > > \ListBase.as:1359]
> > > > at
> > > >
> > >
> >
>
mx.controls.listClasses::ListBase/updateDisplayList()[E:\dev\3.1.0\frame
> > works\projects\fr
> > > amework\src\mx\controls\listClasses\ListBase.as:3657]
> > > > at
> > >
> >
>
mx.controls::List/updateDisplayList()[E:\dev\3.1.0\frameworks\projects\f
> > ramework\src\m
> > > x\controls\List.as:1003]
> > > > at
> > > >
> > >
> >
>
mx.controls.listClasses::ListBase/validateDisplayList()[E:\dev\3.1.0\fra
> > meworks\projects\f
> > > ramework\src\mx\controls\listClasses\ListBase.as:3279]
> > > > at
> > >
> >
>
mx.managers::LayoutManager/validateDisplayList()[E:\dev\3.1.0\frameworks
> > \projects\fra
> > > mework\src\mx\managers\LayoutManager.as:605]
> > > > at
> > > >
> > >
> >
>
mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.1.0\framewor
> > ks\projects\
> > > framework\src\mx\managers\LayoutManager.as:678]
> > > > at Function/http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply>
> <http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply> >
> > <http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply>
> <http://adobe.com/AS3/2006/builtin::apply
<http://adobe.com/AS3/2006/builtin::apply> > > ()
> > > > at
> > >
> >
>
mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.1.0\frameworks\proj
> > ects\framewo
> > > rk\src\mx\core\UIComponent.as:8565]
> > > > at
> > >
> >
>
mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.1.0\frameworks\proje
> > cts\framewor
> > > k\src\mx\core\UIComponent.as:8508]
> > > >
> > > > And this is the argument which is passed to the "set data"-field
> > implementation:
> > > > <type name="Object" isDynamic="true" isFinal="false"
> > isStatic="false">
> > > > <method name="hasOwnProperty" declaredBy="Object"
> > returnType="Boolean"
> > > uri="http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin>
> <http://adobe.com/AS3/2006/builtin <http://adobe.com/AS3/2006/builtin>
>
> > <http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin> <http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin> >
> > ">
> > > > <parameter index="1" type="*" optional="true"/>
> > > > </method>
> > > > <method name="isPrototypeOf" declaredBy="Object"
> > returnType="Boolean"
> > > uri="http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin>
> <http://adobe.com/AS3/2006/builtin <http://adobe.com/AS3/2006/builtin>
>
> > <http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin> <http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin> >
> > ">
> > > > <parameter index="1" type="*" optional="true"/>
> > > > </method>
> > > > <method name="propertyIsEnumerable" declaredBy="Object"
> > returnType="Boolean"
> > > uri="http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin>
> <http://adobe.com/AS3/2006/builtin <http://adobe.com/AS3/2006/builtin>
>
> > <http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin> <http://adobe.com/AS3/2006/builtin
<http://adobe.com/AS3/2006/builtin> >
> > ">
> > > > <parameter index="1" type="*" optional="true"/>
> > > > </method>
> > > > </type>
> > > >
> > > > Any input would be thankfull!
> > > >
> > > > Best regards
> > > >
> > > > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <aharui@>
wrote:
> > > > >
> > > > > If you get an runtime exception, always use a debug build and
> post
> > the
> > > > > full stacktrace.
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > >
> > > > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com>
> > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > ] On
> > > > > Behalf Of florian.salihovic
> > > > > Sent: Monday, August 18, 2008 9:30 AM
> > > > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>
> <mailto:flexcoders%40yahoogroups.com>
> > <mailto:flexcoders%40yahoogroups.com>
> > > > > Subject: [flexcoders] ItemRenderer returns empty Object
instead
> of
> > > > > encapsuled data.
> > > > >
> > > > >
> > > > >
> > > > > I have two instances of mx:controls::List. Both use the same
> > > > > ItemRenderer. A TypeError
> > > > > occours, when i drop one item from one List into the other
List.
> > Instead
> > > > > of the encapsuled
> > > > > type (an instance of an interface, typed to the interface)
just
> an
> > empty
> > > > > Ombject instance is
> > > > > returned.
> > > > >
> > > > > I implement mx.core.IDataRenderer,
> > > > > mx.controls.listClasses.IDropInListItemRenderer and
> > > > > mx.controls.listClasses.IListItemRenderer in my component.
Here
> is
> > the
> > > > > code for the
> > > > > overwritten data and listData Propertys:
> > > > >
> > > > > private var _item:IPlayListItem;
> > > > > private var _listData:BaseListData;
> > > > >
> > > > > [Bindable("dataChange")]
> > > > > override public function get data():Object {
> > > > > return this._item;
> > > > > }
> > > > >
> > > > > [Bindable("dataChange")]
> > > > > public function get listData():BaseListData {
> > > > > return this._listData
> > > > > }
> > > > >
> > > > > override public function set data(value:Object):void {
> > > > > trace("ListItemRenderer.data: "+value);
> > > > > super.data = value;
> > > > > if (!value) {
> > > > > return;
> > > > > }
> > > > > if (this._item == value) {
> > > > > return;
> > > > > }
> > > > > if (value is IPlayListItem) {
> > > > > super.data = IPlayListItem(value);
> > > > > this._item = IPlayListItem(value);
> > > > > }
> > > > > this.dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
> > > > >
> > > > > }
> > > > >
> > > > > public function set listData(value:BaseListData):void {
> > > > > if (this._listData == value) {
> > > > > return;
> > > > > }
> > > > > this._listData = value;
> > > > > this.dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
> > > > > }
> > > > >
> > > > > What am i missing?
> > > > >
> > > > > Best regards!
> > > > >
> > > >
> > >
> >
>