views:

2438

answers:

1

Hi all. I’m in need of some dire help here. I'm writing an application in Flex 3 that utilizes a TileList with a custom itemRenderer to display info from a service. Unfortunately, I'm running into an exception with the drag/drop/rearrange portion of the TileList. With dragEnabled and dragMoveEnabled, I receive a fully-reproducible exception when trying to rearrange the tiles in the control:

Exception:

ArgumentError: Error #2004: One of the parameters is invalid. at flash.utils::ByteArray/writeObject() at flash.desktop::Clipboard/putSerialization() at flash.desktop::Clipboard/convertFlashFormat() at flash.desktop::Clipboard/setData() at mx.managers::NativeDragManagerImpl/doDrag()[C:\autobuild\3.2.0\frameworks\projects\airframework\src\mx\managers\NativeDragManagerImpl.as:282] at mx.managers::DragManager$/doDrag()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\DragManager.as:243] at mx.controls.listClasses::ListBase/dragStartHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:9085] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298] at mx.controls.listClasses::ListBase/mouseMoveHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:8822]

Here’s the code for the custom TileList:

<cmp:MemoTileList itemRenderer="CoverNote" dragEnabled="true" itemsChangeEffect="{this.myTileListEffect}" backgroundAlpha="0" id="memoList" dataProvider="{this.management.memoCollection}" right="0.049865723" left="0.05" top="0" bottom="0" focusEnabled="false" focusAlpha="0" borderStyle="none" direction="horizontal" textAlign="left" allowMultipleSelection="false" showEffect="fadeIn" hideEffect="fadeOut" effectEnd="fadeOut" effectStart="fadeIn" dragDrop="onReorder(event)" dragMoveEnabled="true">
</cmp:MemoTileList>

Here's the code for the onReorder(event):

private function onReorder(event:DragEvent):void{
      var indexStartDrag:Number = event.currentTarget.selectedIndex
      var indexStopDrag:Number = this.memoList.calculateDropIndex(event);
      Alert.show(indexStopDrag.toString());

}

When I try to debug, the debugger doesn't seem to indicate to me any piece of code that might be faulty.

Can anyone point me the right direction as to how to solve this?

Thanks in advance!

Tajddin

A: 
ArgumentError: Error #2004: One of the parameters is invalid.

Is one of those "can be whatever" messages ;(

I remember I had it not to long ago, misspelled some function and Eclipse compiled just fine even though it shouldn't have..(a restart of eclipse helped here, but it took me a while before i found out..).

My tip is to remove code until it works and re-add it again, also check number of parameters. Its a "weird" bug for sure, you know one of those, "have to call these two functions in a certain order" and whatnot. Good Luck!

Other stories about the #2004 ;

http://www.coldfusioncommunity.org/profiles/blog/show?id=1439641%3ABlogPost%3A14565 http://blog.3alves.com/blog/post/2007/09/19/argumenterror-error-2004.aspx

This one was interesting; http://code.google.com/p/flexlib/issues/detail?id=113#c3

Daniel T. Magnusson