The CardList class extends List to provide support for Navigators that display lists of cards.
It also handles drag and drop gestures and allows for reordering of items.
This listener is called when the selection changes based on user interaction, or
when setSelectedIndexWithChangeDispatch or setSelectedIndicesWithChangeDispatch is used
to set the selection.
Implementation public function set dataProvider(value:IList):void
dragStarted
property
public var dragStarted:Boolean = false
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
A boolean to indicate that a drag operation is in progress
enableIdle
property
enableIdle:Boolean Implementation public function get enableIdle():Boolean public function set enableIdle(value:Boolean):void
focusCardDelta
property
protected var focusCardDelta:int
isDragAndDropDisabled
property
isDragAndDropDisabled:Boolean [read-only]
True if drag and drop has been temporarily disabled for card lists.
Implementation protected static function get isDragAndDropDisabled():Boolean
See also
disableDragAndDrop enableDragAndDrop
useDragDropOnFolders
property
public var useDragDropOnFolders:Boolean = false
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
To enable dragDrop on folders during a drag operation.
Some layouts like miniNav allow for drag/drop on folders, whereas others like Linear don't.
useDragDropReordering
property
public var useDragDropReordering:Boolean = false
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
To allow for reordering of items using simple drag and drop gestures.
If this is set to false, drag and drop will still be allowed, but reordering will not occur.
Constructor Detail
CardList
()
Constructor
public function CardList()
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Constructor
Method Detail
addDragData
()
method
override public function addDragData(dragSource:DragSource):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Takes the data set by the list for ordered items and adds it to the attachments
data format. Acrobat uses that for external drag-drops
Parameters
dragSource:DragSource
addListenAndWatch
()
method
public function addListenAndWatch():void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Adds listeners and watchers that are automatically unwatched and unlistened.
addListener
()
method
protected function addListener(listener:IEventDispatcher, type:String, handler:Function):void
Parameters
listener:IEventDispatcher
type:String
handler:Function
addWatcher
()
method
protected function addWatcher(watcher:ChangeWatcher):void
Parameters
watcher:ChangeWatcher
calculateDropLocation
()
method
public function calculateDropLocation(event:DragEvent):DropLocation
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Calculate the dropLocation of the given dragEvent. This is the location where the mouse is gestured to drop.
Parameters
event:DragEvent
Returns
DropLocation — The drop location for this event, or null if the drop operation is not available.
cardFromAttachment
()
method
public static function cardFromAttachment(_dataGroup:DataGroup, attachment:Object):ISimpleCard
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Finds the card associated with the given attachment
Parameters
_dataGroup:DataGroup — The datagroup to which the attachment belongs.
attachment:Object — The attachment whose card is needed.
Returns
ISimpleCard — The card corresponding to the given attachment.
collectionDropEnabled
()
method
public function collectionDropEnabled(event:DragEvent):Boolean
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Helper function that determines whether drag drop is supported
Parameters
event:DragEvent
Returns
Boolean
createDropIndicator
()
method
override public function createDropIndicator():DisplayObject
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Creates a custom dropIndicator for the cardList.
Returns
DisplayObject
dataProviderIsCurrent
()
method
protected function dataProviderIsCurrent():Boolean
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Returns true if the dataProvider for this list matches the CollectionMgr's currentItems.
Things like focus and selection should only be propagated to the CollectionMgr if the
dataProvider is current.
Returns
Boolean
disableDragAndDrop
()
method
public static function disableDragAndDrop():void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Functions used to disable and enable drag and drop. If disabledDragAndDropCounter > 0,
a drag will not be started. Drags can be disabled by other components like ScrollPad.
dragCompleteHandler
()
method
override protected function dragCompleteHandler(event:DragEvent):void
Parameters
event:DragEvent
dragDropHandler
()
method
override protected function dragDropHandler(event:DragEvent):void
Parameters
event:DragEvent
dragEnterHandler
()
method
override protected function dragEnterHandler(event:DragEvent):void
Parameters
event:DragEvent
dragExitHandler
()
method
override protected function dragExitHandler(event:DragEvent):void
Parameters
event:DragEvent
dragOverHandler
()
method
override protected function dragOverHandler(event:DragEvent):void
Parameters
event:DragEvent
dragStartHandler
()
method
override protected function dragStartHandler(event:DragEvent):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Does not start drag if some other component has disabled it. Also distinguishes text selection from a drag.
Parameters
event:DragEvent
enableDragAndDrop
()
method
public static function enableDragAndDrop():void
findCardWithAttachmentFocus
()
method
public function findCardWithAttachmentFocus():SimpleCard
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Finds the card corresponding to the attachment in focus.
Returns
SimpleCard — The Card corresponding to the attachment in focus.
getFolderItemAtDragLocation
()
method
public function getFolderItemAtDragLocation(dropLocation:DropLocation):IAttachment
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Finds the folder at a given dropLocation
Parameters
dropLocation:DropLocation — The drop location at which the folder item needs to be determined.
Returns
IAttachment — The folder item at the drop location. Returns null if there is no folder at the given location
handleDragDropReordering
()
method
protected function handleDragDropReordering(event:DragEvent):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Handles the reordering of items after a dragDrop. However, it does not modify the dataProvider, but invokes
makeNewOrderedList to create an ordered list of items after the drop. Drop on a folder is handled separately by
handleDropOnFolder. It also handles adding of items as a result of an external drag/drop (dragInitiator is null in this case).
However,the new items are already added to the dataProvider in this case as well, this function simply puts them in the correct order.
Parameters
event:DragEvent
handleDropOnFolder
()
method
protected function handleDropOnFolder(folder:IAttachment, event:DragEvent):IList
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Handles drop on a folder. Changes the parent to point to the new location.
Parameters
folder:IAttachment — The folder to which the items are being moved to or added to.
event:DragEvent — The drag event associated with this drop.
Returns
IList — The ordered list of items in the given folder
Updates the host's selection based on the current list selection.
initializeSelectionFromHost
()
method
protected function initializeSelectionFromHost():BooleanReturns
Boolean
keyDownHandler
()
method
override protected function keyDownHandler(event:KeyboardEvent):void
Parameters
event:KeyboardEvent
makeNewOrderedList
()
method
protected function makeNewOrderedList(dropIndex:int, droppingItems:ArrayCollection):IList
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Creates an ordered list of items in the dataProvider after the drop.
Parameters
dropIndex:int — The destination index where the items are being dropped to.
droppingItems:ArrayCollection — The items being droppped.
Returns
IList — An ordered list of the items in the data Provider.
onChildrenCollectionChange
()
method
protected function onChildrenCollectionChange(event:CollectionEvent):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
This function is used when attachments are moved across folders. Once the parent of all attachments
point to the new location, and the attachment has been added to the new collection, the attachments are
sent for reordering.
Parameters
event:CollectionEvent
onCollectionChange
()
method
protected function onCollectionChange(e:CollectionEvent):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Listener to handle collection change events.
Parameters
e:CollectionEvent
onCreationComplete
()
method
protected function onCreationComplete(event:FlexEvent):void
Parameters
event:FlexEvent
onIndexChangeEvent
()
method
protected function onIndexChangeEvent(event:IndexChangeEvent):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
This listener is called when the selection changes based on user interaction, or
when setSelectedIndexWithChangeDispatch or setSelectedIndicesWithChangeDispatch is used
to set the selection.
protected function onOpenFolderTimeComplete(evt:TimerEvent):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Called when the openFolderTimer completes. The current folder is now changed to the cached
toChangeFolder during an ongoing drag.
Parameters
evt:TimerEvent
onResize
()
method
protected function onResize(event:ResizeEvent):void
Parameters
event:ResizeEvent
onScroll
()
method
protected function onScroll(event:Event):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Listener to handle scroll events of the scroller on cardLists.
Parameters
event:Event
partAdded
()
method
override protected function partAdded(partName:String, instance:Object):void
Parameters
partName:String
instance:Object
partRemoved
()
method
override protected function partRemoved(partName:String, instance:Object):void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Parameters
partName:String
instance:Object
removeListenAndWatch
()
method
public function removeListenAndWatch():void
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Function to cleanup the event listeners required by miniNav list. This should be
called when the component is no longer needed, to prevent memory leaks.
removeListener
()
method
protected function removeListener(listener:IEventDispatcher, type:String = null):void
Parameters
listener:IEventDispatcher
type:String (default = null)
reorderAttachments
()
method
protected function reorderAttachments(source:IList):Boolean
Language Version :
ActionScript 3.0
Product Version :
Portfolio 10.0
Runtime Versions :
Flash Player 10.1, AIR 2.0
Sends the reorder command once all the attachments are found in the given list. If items were moved between
lists, this function may have to be called repetitively until it returns true to ensure all items
have been successfully moved and the reorder command has been sent.
Parameters
source:IList — An ordered list of items in the dataProvider.
Returns
Boolean — True if all items are found in the given list and the reorder command was sent successfully.
resizeCachedThumbs
()
method
protected function resizeCachedThumbs():void
setFocusOnIndexChange
()
method
protected function setFocusOnIndexChange(attachment:IAttachment):void