MovieDef::CreateInstance

MovieDef::CreateInstance
virtual Movie* CreateInstance(const MemoryParams& memParams, bool initFirstFrame, ActionControl* actionControl, Render::ThreadCommandQueue* queue = 0) = 0;
virtual Movie* CreateInstance(MemoryContext* memContext, bool initFirstFrame, ActionControl* actionControl, Render::ThreadCommandQueue* queue = 0) = 0;
SF_INLINE Movie* CreateInstance(bool initFirstFrame = false, UPInt memoryArena = 0, ActionControl* actionControl = NULL, Render::ThreadCommandQueue* queue = 0);
Description

CreateInstance creates a movie view instance that is used for playback. Each movie instance has its own timeline, animation and ActionScript state. There can be multiple independent movie views displaying content from the same MovieDef. Also, multiple movie views can be allocated on the same heap, sharing internal objects such as garbage collector. 

The returned created movie is AddRef-ed, so it can be stored in a smart pointer and released when no longer necessary. Null pointer will be returned in case of failure (low memory, etc.). 

CreateInstance creates a heap to hold the timeline and ActionScript runtime state. The parameter "memoryArena" identifies the memory arena used for this purpose.The parameter "memParams" specifies memory parameters describing heaps and garbage collector behavior. Set initFirstFrame as 'true' to initialize objects of frame 1, and populate the display list. If false, the display list will be empty until the first Movie::Advance call. 

E.g.,

Ptr<Movie> pmovie = *pdef->CreateInstance(memParams, true);
Parameters
Parameters 
Description 
const MemoryParams& memParams 
Specifies the memory configuration parameters. See MemoryParams.
Specifies memory parameters describing heaps and garbage collector behavior. memParams.Desc.Arena might be used to specify memory arena index. 
bool initFirstFrame 
Specifies whether frame 1 tags of the SWF file are executed (1) or not (0) during the CreateInstance call. A default value of true allows you to skip explicitly calling Movie::Advance before performing Movie::Invoke calls on the created movie. A Boolean value of false allows variables to be assigned to a root movie clip with Movie::SetVariable before frame 1 execution.
Set this to 'true' to initialize objects of frame 1, populating the display list. If false, the display list will be empty until the first Advance call. 
ActionControl* actionControl 
ActionScript verbose output (mostly for debugging). 
Render::ThreadCommandQueue* queue = 0 
ThreadCommandQueue, an optional parameter to Movie::CreateInstance. It's only required if you use bitmapdata on the first frame.
Render thread queue; required for BitmapData commands. Can be provided later, except if initFirstFrame is true, and BitmapData commands execute on frame 0. 
MemoryContext* memContext 
The MemoryContext that encapsulates the common movie view heap, as well as other shared objects, such as the garbage collector. 
UPInt memoryArena = 0 
Index of the memory arena used for memory allocations. 
Return Value

Created movie view instance.