Skip to content

Class: PageViewComponent ​

Swipe-between-pages (Cocos's PageView) on top of a ScrollView on the same entity: the pages are the ScrollView content's children. A release snaps to a page — the next one when the drag went past scrollThreshold of a page or flicked faster than flickSpeed, else back. A page smaller than the view is centred in it, so a carousel with spacing works too.

Writing currentPage scrolls there. indicator is an entity whose children are the dots, in page order: the current one gets activeColor, the rest color (their Sprite tint). EntityEvent.PageChanged on the host (payload: the page index) once it settles on a new page.

Extends ​

Constructors ​

Constructor ​

ts
new PageViewComponent(): PageViewComponent;

Returns ​

PageViewComponent

Inherited from ​

Component.constructor

Properties ​

PropertyModifierTypeDefault valueInherited from
activeColorpublicnumberundefined-
colorpublicnumberundefined-
currentPagepublicnumberundefined-
dirtypublicbooleantrueComponent.dirty
enabledpublicbooleantrueComponent.enabled
flickSpeedpublicnumberundefined-
indicatorpublicnumber | nullundefined-
scrollThresholdpublicnumberundefined-
turnDurationpublicnumberundefined-

Accessors ​

pageCount ​

Get Signature ​

ts
get pageCount(): number;
Returns ​

number

Methods ​

NextPage() ​

ts
NextPage(): void;

Returns ​

void


PreviousPage() ​

ts
PreviousPage(): void;

Returns ​

void


SetIndicator() ​

ts
SetIndicator(target): void;

Parameters ​

ParameterType
targetnumber | Entity | null

Returns ​

void

© 2026 PlayAdGentic