next up previous contents
Next: getMainWnd Up: Methods Previous: trace   Contents


createControl

Description

Creates an embedded ActiveX control in the projector.

available: SWFKit and SWFKit Pro


Syntax

createControl(progid, left, top, right, bottom[, param[, licensekey]])


Parameters

progid
A string specifies the ProgID of the ActiveX to be created.
left, top, right, bottom
Integer. Specifies the control's size and position in the projector.
param
Optional. String. Initializes the properties of the ActiveX control. It contains several "name=value" pairs conjoined by character `&'
licensekey
Optional. String. Specifies the license key of the ActiveX control.


Returns

An object contains two properties
  1. The window property
    The window property is a Window object that represents the window of the created ActiveX control. You can use this property to set the placement of the ActiveX control, show or hide it, ect.
  2. The activex property
    The activex property is an ActiveXObject object. You can use this property to access the properties, methods and events of the ActiveX control.


Remarks

If the method creates a windowless control, the window property of the returned object will be undefined. The Windows Media Player control will always be windowless activated, if you want to close it, you cannot use the close method of the window object but should do in this way
//Embed a Microsoft Media Player in the projector:
var mplayer = createControl(
    "MediaPlayer.MediaPlayer.1", 0, 0, 200, 200);

...

//destroy it
delete mplayer;
mplayer = null;

SWFKit doesn't support windowless activating for any other controls. It doesn't draw it, so you will get nothing in the main window if you create a control activated in windowless mode.
//Activate a Flash Player in windowless mode.
//For SWFKit doesn't draw the windowless control
//The control won't be visible in the main window
//`fp.window' returns undefined
var fp = createControl(`ShockwaveFlash.ShockwaveFlash',
    0, 0, 320, 240,
    `wmode=transparent&movie=c:\\test.swf&bgcolor=0xFF0000');
fp.activex.play();
trace(fp.window.handle);


Example

//Embed a Microsoft Media Player:
var mplayer = createControl(
    "MediaPlayer.MediaPlayer.1", 0, 0, 200, 200);
//Open an avi file
mplayer.activex.Open("c:\\demo.avi");

//Embed a Microsoft Media Player:
var mplayer = createControl("MediaPlayer.MediaPlayer.1",
    0, 0, 200, 200, "filename=c:\\demo.avi");

//Embed a Flash Player:
var fp = createControl(`ShockwaveFlash.ShockwaveFlash',
    0, 0, 320, 240,
    `wmode=window&movie=c:\\test.swf&bgcolor=0xFF0000');
fp.activex.play();
trace(fp.window.handle);



next up previous contents
Next: getMainWnd Up: Methods Previous: trace   Contents
Copyright ©2000-2010 Shanghai TopCMM Software Technologies. All Rights Reserved.