Project OutFox Wiki
Project OutFox home View the OutFox Wiki source on GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage


The DynamicActorScroller is an ActorScroller that fills in its children on the fly.

The best example for the use of this class is the HighScore scroller, which constantly updates itself with new information everytime an item is deloaded from the screen.

The biggest different about this and ActorScroller is that DynamicActorScroller requires only 1 [Actor] to be inside it. It cannot be more than 1.

	NumItemsToDraw = 3,
	SecondsPerItem = 3,
	TransformFunction = function(self, offset, itemIndex, numItems)
	LoadFunction = function()
	Subdivisions = 4,
	UseMask = false,
	MaskWidth = 30,
	MaskHeight = 50,
	LoopScroller = false,
	WrapScroller = false,


The attributes for DynamicActorScroller are the same as ActorScroller, except for an addition.

Name Type Action
LoadFunction function New to DynamicActorScroller, determines the ammount of items to be generated. provides two arguments which are nil.
NumItemsToDraw number How many items will be drawn at once on the ActorScroller.
SecondsPerItem number How long will the scroller take before moving to the next item.
TransformFunction function The function that positions every item in the ActorScroller. For more information, check Transforming the Scroller.
Subdivisions number How many subdivisions should there be between each item? This allows for smoother movement for scrollers that contain any mathematical curve.
UseMask bool Toggles a mask on the top and bottom of the ActorScroller.
MaskHeight number Height of the mask present on the top and bottom of the ActorScroller. Requires UseMask to be true.
MaskWidth number Width of the mask present on the top and bottom of the ActorScroller. Requires UseMask to be true.
LoopScroller bool Loops the selection of the scroller to wrap around.
WrapScroller bool Wraps the items of the scroller to attempt a seamless transition back.


As mentioned previously, this actor class only allows 1 actor in it, which will be processed to be filled on the fly. If more are provided, it will complain about it, and stop the game due to a failed assert.

Adding actors can be done with the same methods presented on Adding Actors on ActorScroller.

Upon adding the actor, a new attribute is added to the list, which is LoadFunction. This attribute is responsible to manage and update the actors based on the relative position of the current choice.

Behavior changes

With this actor type, the TransformFunction has a different behavior.

  • itemIndex won’t update anymore, as LoadFunction is now the one doing the work.

Full code example

local af = Def.ActorFrame{

local numItems = 10

af[#af+1] = Def.DynamicActorScroller{
	NumItemsToDraw = 5,
	SecondsPerItem = 0.1,
	LoopScroller = true,
		-- For more information about this Input Controller, check "Custom Input".
		self.controller = LoadModule("Lua.InputSystem.lua")(self)
	LoadFunction = function(self, itemIndex)
		-- This will tell the scroller how many items will be generated for the scroller. It just needs a number.
		-- "Call the expression with line = nil to find out the number of lines."

		-- Self is the actor represented for the actor set.
		-- itemIndex is the item relative to the current selection from the user.
		if self then
			self:GetChild("Text"):settext( "I am line ".. itemIndex )
		return numItems
	TransformFunction=function(self, offset, itemIndex, numItems)
		self:y( offset * 40 )
	-- By the rules, this is only adding a single item, which is an ActorFrame holding a BitmapText.
	-- The actor in this case will be provided with a ItemIndex attribute attached. This can be accessed
	-- using self. This is only given initially and doesn't update. Use the LoadFunction to get a new
	-- version of the value.
			Font="Common Normal",
	-- Let's add input to this scroller.
		self:SetDestinationItem( self:GetCurrentItem() - 1 )
		self:SetDestinationItem( self:GetCurrentItem() + 1 )

return af