# CCNodeMultiplexer Class Reference

Inherits from | CCNode : CCResponder : NSObject
Declared in | CCNodeColor.h

## Overview

CCNodeMultiplexer is a CCNode with the ability to multiplex its children.

Features:

- It supports one or more children
- Only one child will be active a time

## Tasks

### Creating a CCNodeMultiplexer Object

- `+ nodeWithArray:`
- `+ nodeWithNodes:`

### Initializing a CCNodeMultiplexer Object

- `– initWithArray:`

### CCNodeMultiplexer Management

- `– switchTo:`

## Class Methods

### nodeWithArray:

Creates a CCNodeMultiplexer with an array of nodes.

`+ (id)nodeWithArray:(NSArray *)arrayOfNodes`

#### Parameters

arrayOfNodes

  Array of nodes.

#### Return Value

The CCNodeMultiplexer object.

#### Declared In

`CCNodeColor.h`

### nodeWithNodes:

Creates a CCMultiplexLayer with one or more nodes using a variable argument list. Example: @code mux = [CCNodeMultiplexer nodeWithNodes:nodeA, nodeB, nodeC, nil];

`+ (id)nodeWithNodes:(CCNode *)node, ...`

#### Parameters

node

  List of nodes.

...

  Nil terminator.

#### Return Value

The CCNodeMultiplexer object.

#### Declared In

`CCNodeColor.h`

## Instance Methods

### initWithArray:

Initializes a CCNodeMultiplexer with an array of nodes.

`- (id)initWithArray:(NSArray *)arrayOfNodes`

#### Parameters

arrayOfNodes

  Array of nodes.

#### Return Value

An initialized CCNodeMultiplexer Object.

#### Declared In

`CCNodeColor.h`

### switchTo:

Switches to a certain node indexed by n.

`- (void)switchTo:(unsigned int)n`

#### Parameters

n

  Index of node to switch to.

#### Discussion

The current (old) node will be removed from its parent with ‘cleanup:YES’.

#### Declared In

`CCNodeColor.h`