Skip navigation
lc_cpl
Currently Being Moderated

Scale project with embedded SWF and videos

Apr 24, 2013 1:10 AM

Tags: #cs5 #flash #as3 #swf #scale #load

Hi,

 

I am currently creating an interactive brochure in flash (cs5) which includes company videos and some InDesign interactive swf's. It will only really be distributed on DVD for now and so i created the stage at 1024x576 which will cover lowest most significant resolution size in use (around 10%) and with our target audience being non technical people potentially with old machines (and low resolutions), so i don't have too much of an option with setting it to a large resolution size. It all works fairly well in terms of navigation etc but the main problem i have is it scaling up on larger resolution screens.

 

My menu items and logo's etc... are all built as vectors in illustrator and flash and so they are no problem, but eventhough my indesign documents are currently made to 1920x1080, i have to scale them down when i export (to around 920 in width) to fit the space i have reserved on the stage for the loaded in swf. This is fine until you publish the project, run it then scale the window up to full screen. The loaded swf becomes more pixelated (expected to a degree) but my menu items remain sharp and look great (also expected). My question is; can i export my swf out of InDesign at full size (1920x1080) and have it only display at the % size allowed within the project (regardless of scale)? I assume for this i would need some kind of 'load area' or 'placeholder' rather than directly importing to the stage? The result therefore would be that it actually loads in the full resolution swf, but displays at the correct size within the project whilst retaining quailty all the way up to 1920x1080.

 

Otherwise, the alternative is how can i recreate the page turn animation in flash that i am using in indesign? (is there any prebuilt presets at all?)

 

I also have a side issue to this and hope its not a limitation of flash, but i have a few flv files which play in and they are exported at 1920x1080 and scale with the window which is ok. The issue here is at the projects native resoution (1024x576), the larger videos have been scaled down and as a result appear jagged/low quality, yet played at full size they are fine. Is this flash's limitation of not being able to scale video very well or is there a way i can fix it?

 

I am not very experienced with AS3 and am learning as i go and for reference, this is what i am using for loading in my swf's:

 

var Xpos:Number = 35;

var Ypos:Number = 10;

var swf:MovieClip;

var loader:Loader = new Loader();

 

var defaultSWF:URLRequest = new URLRequest("media/brochure_insert.swf");

 

loader.load(defaultSWF);

loader.x = Xpos;

loader.y = Ypos;

addChild(loader);

 

Then i just have a 'back' button which has 'removeChild(loader)' attached to it as the user leaves the frame.

 

Many Thanks,

Lawrence

 
Replies
  • Currently Being Moderated
    Apr 24, 2013 1:22 AM   in reply to lc_cpl

    It will only really be distributed on DVD

    You might have the wrong tool for your use case.

     

    1024x576 is nothing what a user will later experience with the 720*576 (16:9) end product. Believe me you will seriously be disappointed when seeing your endproduct after seeing the master. Fonts readibility , TV-Safearea all that has to be pre-optimized especially for a TV-Screen. Flash is really not fit for that task.

     

    Seriously consider to switch to After Effects if you don`t want to end up with a product that will be lacking in quality by mixing precompressed (FLV) videos, precompressed images and whatnot.

     

    If you are only doing a Prototype Flash is ok, but at least use a template like this to get used to the restrictions of a TV-Format

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2013 1:58 AM   in reply to lc_cpl

    No harm done ;-)

    The problem with your post is that it is not really strucutured "support-friendly", I have really trouble to get to the bottom of what you need help with.

    For example hidden in the second paragraph there is this question:

    My question is; can i export my swf out of InDesign at full size (1920x1080) and have it only display at the % size allowed within the project (regardless of scale)?

    These are really 3 Questions knotted artfully but not very readable.

    then you are talking about other questions and side issues and presenting code at the end that is there for no real purpose.

     

    Short version: try to focus

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2013 2:27 AM   in reply to lc_cpl

    Its never a good idea to import videos in your library, the more you blow up your library with large files the greater the risk your app will crash during development.

     

    Use this code to load a flv externally:

     

    var vid:Video = new Video(320, 240);

    addChild(vid);

     

    var nc:NetConnection = new NetConnection();

    nc.connect(null);

     

    var ns:NetStream = new NetStream(nc);

    vid.attachNetStream(ns);

     

    var listener:Object = new Object();

    listener.onMetaData = function(evt:Object):void {};

    ns.client = listener;

     

    ns.play("externalVideo.flv");

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2013 4:09 AM   in reply to lc_cpl

    you can get the resolution of any user running your program with

    system.capabilities.resolutionX/resolutionY

    or

    using

    stage.stage_width/stage.stage_height to get your stage resolution

     

    distortion can be avoided by using scaling function that calculates your video aspect ration against the stage ratio

     

    when launching your app in fullscreenmode from disk, be aware that there is(was) a bug on Mac where the fullscreen mode might not work as expected(the projector ends up behind the dock), this was at least a problem I had two years ago when making a project for both target platforms.

     

    I worked around it by delaying the fullscreenMode on Mac, like so:

     

    //setting the OS-specific properties

    var os:String=Capabilities.os;

    var file_ext:String=os.substr(0,3);

    trace(file_ext);

    if (file_ext=="Win") {

        file_ext="exe";

        goScaledFullScreen();

    } else if (file_ext == "Mac") {

        file_ext="app";

        fullScreenTimer.start();

    }

     

    //catching MAC Fullscreen Bug

    var fullScreenTimer:Timer=new Timer(1000,1);

     

    fullScreenTimer.addEventListener(TimerEvent.TIMER, goScaledFullScreen);

     

    function goScaledFullScreen(e:TimerEvent=null):void {

        goScaledFullScreen();

    }

     

    fscommand("trapallkeys","true");

     

    function goScaledFullScreen() {

        var screenRectangle:Rectangle=new Rectangle(0,0,stage.stageWidth,stage.stageHeight);

        stage.fullScreenSourceRect=screenRectangle;

        stage.displayState=StageDisplayState.FULL_SCREEN;

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2013 4:45 AM   in reply to lc_cpl

    I expected by loading in a larger resolution video but displaying it at a smaller size, the quality shouldn't be affected or am i wrong with that statement?

    Flash doesn`t recompress your video, no, but it certainly will loose some kind of information.

    Make sure you are positioning everything on your stage Pixel Perfect to avoid flash running into problems with decimal points

     

    you could provide different resolutions of your video:

    Hires (1080p)

    Midres(720p)

    Lowres(576p)

    and load the right video depending on Capabilities.resloutionY

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2013 6:51 AM   in reply to lc_cpl

    Look here how to detect the end of videostream

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 24, 2013 7:48 AM   in reply to lc_cpl

    show your code and highlight if you get any errors

     

    here is also alittle function that allows proper handling of DisplayObjects of various sizes and aspect ratios that are loaded dynamically:

     

    function centerMaximized(dO:DisplayObject,bordersize:int = 0):void {

        var scalefactorW:Number=(stage.stageWidth-bordersize)/dO.width;

        var scalefactorH:Number=(stage.stageHeight-bordersize)/dO.height;

        if (scalefactorW<scalefactorH) {

            dO.scaleX=dO.scaleY=scalefactorW;

        } else {

            dO.scaleX=dO.scaleY=scalefactorH;

        }

        dO.x = (stage.stageWidth-dO.width)*.5;

        dO.y = (stage.stageHeight-dO.height)*.5;

    }

     

    //usage:centerMaximized(video)

    //bordersize is a parameter you pass in case you want a border around your Object

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points