Skip to Content

Tools & Guidelines
Embedding ccPlayer Inside Another SWF

Previous | Next | ccPlayer Help Contents | ccPlayer Home

It is now possible to embed the AS3 version of ccPlayer inside another SWF. There are two methods used to set ccPlayer's display and media playback. Both methods are passed many of the parameters that are set via the Flashvars parameters when ccPlayer is embedded on a web page, such as ccMediaName, ccMediaWidth and ccMediaHeight. Any additional parameters can be set as ccPlayer properties.

Additional methods are included which will allow for such things as pausing the media playback, triggering the fullscreen display, and getting the current media time. To create a player that will play consecutive media files, an event is dispatched whenever the current media finishes playing in order to start the next media item.

Initializing the ccPlayer SWF

Once the ccPlayerAS3.swf is loaded, the initccPlayerDisplay() method must be called to initialize the size of ccPlayer's media display and indicate which controls to use. Afterwards, the setNewMediaPlayback() method is used to set up the next media to be played. This method can be used in conjunction with the end-of-playback event to play consecutive media files. Any parameters that need to be set, which aren't included in the setNewMediaPlayback()initccPlayerDisplay() parameters, should be set prior to calling this method. At any time the size of the player display and the controls can be changed by recalling the method.

Sample file

A sample file (embedding_ccPlayer.fla), which contains sample code for loading and controlling the ccPlayerAS3.swf, is provided in ccPlayerAS3's download package. A demonstration of ccPlayer embedded in another SWF can be found on the ccPlayer Examples page.

Fullscreen view

When ccPlayer's fullscreen view mode is selected, ccPlayer positions itself in the upper left corner of the screen and expands its black background to fill the entire screen. Any objects in layers underneath the ccPlayer object will be covered and any objects positioned on layers on top of ccPlayer will remain visible.


  • initccPlayerDisplay( width:Number, height:Number, controls:String, base-color:String)
    Required. Used to initialize the ccPlayer display.
    • width (required) - width of the media display area prior to launching the media
    • height (required) - height of the media display area prior to launching the media
    • controls (optional) - used to identify which controls to use. Options are:
      • default - default controls. This is what is used if the controls parameter is not included.
      • url - identifies the url of the external swf which contains the customized controls
      • nocontrols - no controls are to be used with playback
    • base-color (optional) - used to indicate the color used as the background for the sliding windows (instructions, search, language), background of the tool tips for the buttons which open the sliding windows, and the fill color of the progress bar
  • setNewMediaPlayback( media-file:String, poster-image:String, audio-image:String, autostart:Boolean, block-controls:Boolean, caption-type:String, caption-file:String, caption-language:String)
    Used to identify the next media to be played along with some of its options, including captions.
    • media-file (required) - url of the media file to play
    • poster-image (optional) - url of the external image to use as the poster image
    • audio-image (optional) - url of the external image to be displayed when an MP3 audio file is being played
    • autostart (optional) - indicates whether the media autostarts when loaded (true) or pauses (false) and waits to be started (default is false)
    • block-controls (optional) - indicates whether the controls should be blocked (true) while the media is playing or not (false) (default is false)
    • caption-type (optional) - type of source containing the caption information
      • external – external timed-text file
      • embedded – embedded in video
    • caption-file (optional) - url for a DFXP or QTtext caption file
    • caption-language (optional) - identifies which language <div> to select in a DFXP file
    *If the media is being streamed from a Flash media server, set the ccMediaStream prior to calling setNewMediaPlayback.
  • pauseMedia()
    Pauses the current media playback.
  • playMedia()
    Restarts the current media playback.
  • showCaptionArea()
    Shows the caption display.
  • hideCaptionArea()
    Hides the caption display.
  • raiseMediaVolume()
    Raises the media volume.
  • lowerMediaVolume()
    Lowers the media volume.
  • displayFullscreen()
    Switches the view from normal to fullscreen view.
  • displayNormalScreen()
    Switches the view from fullscreen to normal view.
  • jumpToTimeSeconds( time:Number)
    Jumps to point in media indicated by the time provided.
    • time (required) - number of seconds where media playback should jump to
    *Currently, the media at the point of the jump to time needs to be loaded. If it is not, the jump to time may produce an error.
  • disableShortcutKeys()
    Used to turn off the recognition of the shortcut keys in ccPlayer. This is provided to stop ccPlayer from reacting to keystrokes when the user has navigated to special areas that also react to keystrokes, such as an input text field.
  • enableShortcutKeys()
    Used to re-enable the recognition of the shortcut keys in ccPlayer.
  • activateRollupCaptionDisplay(number-lines:int)
    Used to switch the caption display from pop-on to roll-up.
    • number-lines (optional) - number of lines used to display roll-up captions, default = 2
  • activatePoponCaptionDisplay()
    Used to switch the caption display from roll-up to pop-on.
  • moveForward()
    Used to move playback forward 5 seconds.
  • moveReverse()
    Used to move playback back 5 seconds.


  • fullscreenActive
    (read only)
    Indicates whether the screen is currently displaying fullscreen view (true) or normal view (false).
  • mediaTime
    (read only)
    Indicates the current media playback time, in seconds.
  • mediaTimeLeft
    (read only)
    Indicates the current media playback time left, in seconds.
  • captionAreaOpen
    (read only)
    Indicates whether the caption display is currently visible (true) or hidden (false).
  • keyRecSuppressed
    (read only)
    Indicates whether keypress recognition is being suppressed (true) or recognized (false).


    Event that is dispatched when the end of the media playback is reached. To react to the event, set up an event listener:

    ccplayer_instance_name.addEventListener(“MEDIA_END”, set_next_step);

Previous | Next | ccPlayer Help Contents | ccPlayer Home

    Last updated: September 28, 2011