Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import HTools.FPS.PerformanceMonitor;
- import flash.events.*;
- import flash.display.*;
- const filePath:String="";
- const fileName:String="";
- //[Embed(source="",mimeType="application/octet-stream")]
- //var cl:Class;
- var l:Loader=new Loader();
- addChildAt(l,0);
- l.load(new URLRequest(filePath+fileName));
- //l.loadBytes(new cl());
- l.contentLoaderInfo.addEventListener(Event.COMPLETE,start);
- stage.align=StageAlign.TOP_LEFT;
- stage.scaleMode=StageScaleMode.NO_SCALE;
- function start(e:Event) {
- stage.frameRate=l.contentLoaderInfo.frameRate;
- //trace(l.contentLoaderInfo.width,l.contentLoaderInfo.height,l.contentLoaderInfo.frameRate);
- //l.content.play();
- //log.checkTimeline=l.content;
- stage.color=colorForMovie(l.contentLoaderInfo.bytes);
- stage.addEventListener(Event.RESIZE,size);
- size();
- }
- function size(e:Event=null):void {
- var arMovie:Number=l.contentLoaderInfo.width/l.contentLoaderInfo.height;
- var arStage:Number=stage.stageWidth/stage.stageHeight;
- var scale:Number;
- if(arMovie<arStage) {
- scale=stage.stageHeight/l.contentLoaderInfo.height;
- } else {
- scale=stage.stageWidth/l.contentLoaderInfo.width;
- }
- l.scaleX=scale;
- l.scaleY=scale;
- log.scaleY=log.scaleX=scale;
- var scaledWidth:Number=l.contentLoaderInfo.width*scale;
- var scaledHeight:Number=l.contentLoaderInfo.height*scale;
- l.x=(stage.stageWidth-scaledWidth)/2;
- l.y=(stage.stageHeight-scaledHeight)/2;
- }
- var log=new PerformanceMonitor();
- addChild(log);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement