likedworlds.swf
The Liked Worlds panel in Trove that displays the player's saved/liked club worlds in a scrollable list, allowing them to teleport to a world or remove it from their favourites. It appears in a small window and supports both PC and console layouts.
Document/main class: LikedWorlds (extends _kiwi.Core.UIComponent)
SWF-specific classes: 4 (plus ~12 asset-wrapper/skin classes)
Main class: LikedWorlds
LikedWorlds is the root UIComponent. The constructor:
- Creates a
WorldsViewDataSourceinstance and assigns it toworldsView.dataSource. - Listens on
worldsViewfor custom"ShowRemoveOption"and"HideButtons"events. - In non-Iggy mode, populates 4 stub world entries for preview.
- On console, hides itself and starts an
ENTER_FRAMEloop that waits foronTargetFrame()before callingsetupTranslation(), showing the window, and hiding console buttons when the list is empty. - Calls
setupTranslation()(inherited) and sets the header title via component inspector to$LikedWorlds_WinTitle.
configUI() sets header.allowFontResize = true.
Key fields
worldsView : WorldsView— the main scrollable list; backed bydataSource.dataSource : WorldsViewDataSource— manages the sorted array of{worldId, worldName, clubName}records; handles add/remove/clear withDataChangeEventnotifications.closeButton : MovieClip— a_kiwi.Controls.WindowCloseButton(chid 46), placed on the PC frame only; the control itself sendsPOST_SOUND_EVENT("Play_ui_window_close")andOnRequestCloseon click.header : WindowHeaderSmall— window title bar; title translate key$LikedWorlds_WinTitle;allowFontResize = true.consoleRemoveButton : MovieClip— console-only "Remove" action button; shown/hidden based on selection state.consoleEnterButton : MovieClip— console-only "Enter World" action button; hidden when list is empty.
Event handlers
ShowRemoveButton(e:DataEvent)— setsconsoleRemoveButton.visible = Boolean(e.data)(true when a non-locked world is selected on console).HideButtons()— hides both console action buttons (dispatched byWorldsViewwhen the item pool empties).onEnterFrame()— console initialisation gate; pollsonTargetFrame(); once true, callssetupTranslation(), makes the window visible, and hides console buttons if list is empty.
Frame scripts / timeline
frame1—stop()(PC layout, labelledPC).frame11—stop()(console layout, labelledConsole): removescloseButtonand two PC-only art pieces and placesconsoleRemoveButtonandconsoleEnterButton.- Stage 582×502 at 24 fps, 20 frames.
Runtime dependencies & integration
- IggyFunctions.inIggy — checked indirectly via
WorldsViewDataSource(registers ExternalInterface callbacks there). - translate key:
$LikedWorlds_WinTitle(window header),$LikedWorlds_GotoWorld(Enter button inWorldListItem). - IsConsole() — gates console button visibility; also used in
WorldsViewDataSource.insertItemSortedto choosenatCaseComparevs locale string comparison. - DataEvent (
_kiwi.Controls.DataEvent) — carries theShowRemoveOptionboolean payload.
Other game-specific classes
WorldsViewDataSource
Extends _kiwi.Core.UIComponent. Maintains itemData:Array of {worldId, worldName, clubName} objects. Registers ExternalInterface callbacks in Iggy: clear, addItem, removeItem.
addItem(worldId, worldName, clubName)— inserts sorted by world name usingnatCaseCompare(console) orlocaleCompare(PC), dispatchingDataChangeEvent(DATA_CHANGE, ADD, [], insertIndex). The engine sends the whole list as oneaddItemcall per world.removeItem(worldId)— finds byworldId; dispatchesPRE_DATA_CHANGE / REMOVEbefore splicing.clear()— splices all; dispatchesREMOVE_ALL.getItemData(index) : Object,getItemDataCount() : int— read accessors for the view.- Uses
flash.utils.natCaseCompareon console for natural-order sort.
WorldsView
Embed symbol90; extends _kiwi.Controls.ScrollableView. Implements a virtualised, pool-based scrollable list of WorldListItem rows.
- Pool size: 16 items (
ITEM_POOL_SIZE). - On construction: creates pool of
WorldListItemclones, setsvertScrollbarVisible = true,verticalStep = 3. - Registers ExternalInterface callbacks
selectIndexandgetWorldIdFromIndexin Iggy. draw()— responds toSCROLLandDATAinvalidation; callsupdateLayout().updateLayout()— computesgetVisibleItemRange()(based on scroll rect and item height), returns out-of-range items to pool, repopulates visible range, relayouts item positions, updates content size.getVisibleItemRange()— returns aRangeobject covering[scrollTop / itemHeight, scrollBottom / itemHeight](with one item of padding).relayoutItems()— positions items aty = dataIndex * itemHeight; alternatesalternateColoron even indices.repopulateItems()— pullsWorldListItemfrom pool, callssetData(dataSource.getItemData(i)), inserts sorted bydataIndex.selectIndex(index:int, isLocked:Boolean)— console: scrolls to position, setsisSelectedon the matching item, dispatches"ShowRemoveOption".getWorldIdFromIndex(index:int) : String— returns theworldIdat a given data index. The engine refers to worlds only by their index in this sorted order (here and inselectIndex) and acts on the id this returns, so the data source's insertion order is part of the contract.returnItemToPool(i)— removes from display, pushes to pool; dispatches"HideButtons"when items list empties.- Responds to
DataChangeEvent: ADD →onItemAdded, CHANGE →onItemUpdated, REMOVE_ALL →onCleared; pre-event REMOVE →onItemWillRemove(clears visible items that include the removed index).
WorldListItem
Embed symbol27; extends _kiwi.Core.UIComponent. One row in the list.
- Fields:
worldTextField,clubTextField(display name/club),enterButton(LabelButton, label$LikedWorlds_GotoWorld),deleteButton(LabelButton, label empty),mc_row_bg(alternating row background),_worldId,_dataIndex,_isSelected,_alternateColor. setData(obj)— sets world/club name text fields,worldId,isSelected(callsenterButton.validateNow()).clone()— returns a newWorldListItempre-filled with current data; used to populate the pool.onEnterWorld—ExternalInterface.call("OnEnterWorld", worldId).onDeleteWorld—ExternalInterface.call("OnDeleteWorld", worldId).set isSelected— on console hides/showsenterButtonbased on selection;mc_row_bg.visibletracksalternateColor.- Frame 1 (PC) / frame 10 (console) stops.
Asset wrappers (~12 classes): ScrollArrowDown_*Skin (disabled/down/over/up), ScrollArrowUp_*Skin (disabled/down/over/up), ScrollThumb_*Skin (down/over/up), ScrollTrack_skin, ScrollBar_thumbIcon, focusRectSkin, btnKick, btnGreen_small.
Notable logic
- Virtualised list:
WorldsViewuses a 16-item pool and only creates/positions items in the visible scroll range plus one item of padding, keeping memory constant regardless of list length. - Sorted insert: new worlds are always inserted in alphabetical order (natural order on console, locale-uppercase on PC); the sort fires a
DataChangeEvent(ADD, index)so the view knows exactly where to invalidate. - Console selection model:
selectIndexscrolls the scrollbar to the proportional position of the selected index before relayouting, ensuring the selected row is visible. It then iterates displayed items to applyisSelected, and dispatchesShowRemoveOptionif the world is not locked. - ExternalInterface calls (outgoing):
OnEnterWorld(worldId),OnDeleteWorld(worldId)fromWorldListItem, plusPOST_SOUND_EVENT/OnRequestClosefrom the window close button;selectIndexandgetWorldIdFromIndexare incoming callbacks registered onWorldsView. - DataChangeEvent chain:
WorldsViewDataSourcedispatches standard FL DataChangeEvents;WorldsViewlistens and either partially or fully clears/repopulates the pool depending on change type.