1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| // >> Class MovieLoader
/// Loads preview image
public function loadPreview( imageURL:String, retry:Boolean = true )
{
this.p_preview_loader = new Loader();
this.p_preview_loader.contentLoaderInfo.addEventListener( Event.COMPLETE, this.drawStartPage );
this.p_preview_loader.load( new URLRequest(imageURL) );
}
/// Displays a page when the loader is starting
public function drawStartPage( event:Event = null)
{
// Add start page
var page:StartPage = new StartPage( this.p_video_options.name,
this.p_video_options.chapterName,
this.p_style.pageBgColor, this.p_style.textColor,
this.p_style.buttonColor,
this.p_style.pageAlpha, this.p_style.buttonAlpha);
page.drawPreview( this.p_preview_loader,
this.stage.width);
this.changePage(page);
}
// ------------------------------------------------- //
// >> Class StartPage
/// Draws the preview image
public function drawPreview(preview:DisplayObject, stageWidth:uint)
{
this.Page.Image.addChild( preview ); // Image is a kinf of locator for the preview container
// Resize preview
var xmax:uint = stageWidth - (this.Page.Image.x * 2);
var ymax:uint = 220;
if( preview.width > xmax || preview.height > ymax )
{
if( preview.width > preview.height )
{
preview.height = xmax * preview.height / preview.width;
preview.width = xmax;
}
else
{
preview.width = ymax * preview.width / preview.height;
preview.height = ymax;
}
}
// Change preview position
preview.x = (xmax - preview.width)/2;
preview.y = (ymax - preview.height)/2;
this.computeTextPosition(preview);
} |