FORUMS: list search recent posts

Preroll ads

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Pau Perez
Preroll ads
on Jun 2, 2008 at 7:49:20 am

I made a flash site with its different sections, the first of which has a movie clip which is a "VideoPlaylist". So inside this movie clip I have the player and the videos sequenced one after the other in a TileList component.

I would like to put preroll ads before every video (or some of them). How should I do it without having these ads listed in the tileList? I don't know action script, just the navigation basics necessary for the sections. I did the videoplaylist following this tutorial:

All the code for the tileList is inside an external "*.as" file. I attach it here for you to see. The list of videos to be played are in an xml playlist. It would be great if I could put the preroll ads there but I don't know how to do so without diplaying them in the later loaded videolist.

Thank you!


package {
import flash.display.MovieClip;
import fl.controls.listClasses.CellRenderer;
import fl.controls.ScrollBarDirection;

public class VideoPlaylistSeq extends MovieClip {
private var xmlLoader:URLLoader;

public function VideoPlaylistSeq():void {
// Load the playlist file, then initialize the media player.
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
xmlLoader.load(new URLRequest("playlist.xml"));
// Format the tileList, specify its cellRenderer class.
tileList.setSize(254, 318);
tileList.columnWidth = 254;
tileList.rowHeight = 53;
tileList.direction = ScrollBarDirection.VERTICAL;
tileList.setStyle("cellRenderer", Thumb);

public function initMediaPlayer(event:Event):void {
var myXML:XML = new XML(;
var item:XML;
for each(item in myXML.vid) { // populate playlist.
// Get thumbnail value and assign to cellrenderer.
var thumb:String;
if(item.hasOwnProperty("@thumb")>0) thumb = item.@thumb;
// Send data to tileList.
// Select the first video.
tileList.selectedIndex = 0;
// Listen for item selection.
tileList.addEventListener(Event.CHANGE, listListener);
// And automatically load it into videoMask.myVid.
videoMask.myVid.source =;
// Pause video until selected or played.
// Listen for end of current video, then play the next
videoMask.myVid.addEventListener(VideoEvent.COMPLETE, vidComplete);

// Detect when new video is selected, and play it
function listListener(event:Event):void {;

// listen for complete event; play next video
function vidComplete(eventObject:VideoEvent):void {
if(tileList.selectedIndex < tileList.length-1){
tileList.selectedIndex = tileList.selectedIndex+1;

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved