Skip navigation
Gaby35
Currently Being Moderated

stage resizing

Jun 22, 2012 11:17 AM

How do I resize the stage dimensions, without shifting it to the left? My stage is wider than the content area. All I want is to reduce the width of the stage, but keep the live area in the center (like resizing the canvas in Photoshop. Is it possible to do this?

 
Replies
  • Currently Being Moderated
    Jun 22, 2012 3:17 PM   in reply to Gaby35

    Are you talking about doing this during development or later, after you publish?

    You may need to do this in two stages, first, you resize the Flash doc.

    Main menu.. Modify/Document and set your stage size.

    Then center your content as needed... the "Align and Transform" panel may be helpful.

    Best wishes,

    Adninjastrator

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 23, 2012 5:15 AM   in reply to Gaby35

    If you want the content to scale down as you reduce the size then use this actionscript code:

     

    import flash.display.StageScaleMode;

    stage.scaleMode = StageScaleMode.NO_BORDER;

     

    If you want it to stay centered but not scale try:

     

    import flash.display.StageScaleMode;

    import flash.display.StageAlign;

     

    stage.scaleMode = StageScaleMode.NO_SCALE;

    // now remove anything that looks like: stage.align = StageAlign.TOP_LEFT;

     

    Apps like Flash Builder can auto-set StageAlign.TOP_LEFT for you thinking that's what you want (because usually it is). If you don't specify a StageAlign but you do specify StageScaleMode.NO_SCALE, when you reduce size it will equally take width and height from the top bottom left and right.

     

    Be warned, this means your left edge will no longer be 0px nor will your top be 0px. If you had a (default doc size) of 550x400 and you resize to 450x300 (remove 100px from width and height) then your left edge would be half the amount removed, or 50px. As will your top edge be half the amount removed, or, 50px. This makes placing things difficult sometimes.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 23, 2012 8:35 AM   in reply to Gaby35

    On frame one of a new layer click on the frame, open the actions panel and yes, that's where you put it.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 23, 2012 3:46 PM   in reply to Gaby35

    When you see // before anything it means a "comment". As in, it's not code. That's me telling you to look around your document and see if you see anything setting stage.align to something. By default your behavior should happen. It works like Photoshop canvas, except in Photoshop x=0, y=0 is not reset. In Flash, 0 always remains where it was originally. So if you add to the width, your left edge becomes a negative number, if you subtract, it becomes positive.

     

    e.g. add 500px to size, your left edge is now -250px

     

    e.g. subtract 500px to size, your left edge is now 250px.

     

    You mentioned Photoshop so just think about changes flash's size as if Photoshop NEVER updated the 0 pixel position on canvas resize. If you shink your photoshop canvas then you'd see -250 on the ruler. If you added to it you'd see 250 as your left edge. Hope that makes sense.

     

    What always helps is containing your entire animation inside a single movieclip. Therefore you can move that single clip and all its contents at once. Think of it like adding all your Photoshop layers under a single folder, then selecting the folder and moving it.. All layers would move inside the folder.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 24, 2012 5:16 PM   in reply to Gaby35

    It will always clip the canvas from upper left.

     

    If you're just loading this into a website then HTML can handle it as long as you have the ability to scale enabled. You'd go on frame 1 and use this code:

     

    import flash.display.StageScaleMode;

     

    stage.scaleMode = StageScaleMode.EXACT_FIT;

     

    Then go into your HTML and where it says the width="1500" just change it to width="1200" and the SWF will scale itself to that size. Things will get smaller though. It won't be like a "Canvas" in photoshop, it will be like an "Image Resize".

     

    To do it like canvas you'll have to produce your animation and import it into another file at the size you want.

     

    e.g.

     

    1. Export your animation to "animation.swf"

    2. Make a new document at your desired size (e.g. 1200px wide)

    3. Hit File->Import->Import to Library

    4. Choose animation.swf

    5. You will see a new movieclip in the library.

    6. Drag the movieclip on the stage and center it as desired.

     

    If you don't Import to Library then it will just import a bunch of frames to be sure to use Import to Library rather than just Import.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2012 9:56 AM   in reply to Gaby35

    Do yourself a favor and re-read my instructions. I will bold them because you did not read them.

     

    If you don't "Import to Library" then it will just import a bunch of frames so be sure to use Import to Library rather than just import.

     

    Last line of my last post.

     

    I also said this in step 3.

     

    You will receive one MovieClip symbol in your library that can be placed on your stage.

     

    Be sure to read through entire posts. We read yours.

     

    If you prefer to do it with code then export the animation.swf as mentioned. Now open a new AS3 document and use this code on a frame script (click in frame 1, open the Actions panel, type this):

     

    // imports

    import flash.display.Loader;

    import flash.net.URLRequest;

     

    // request loading SWF

    var anim:Loader = new Loader();

    addChild(anim);

    anim.load(new URLRequest("animation.swf"));

     

    // set a custom position to re-center, e.g. from 1500 to 1200 width

    // half of that 300px difference is 150px

    anim.x = -150;

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2012 12:17 PM   in reply to Gaby35

    It's definitely not a good idea to go around introducing yourself as having no idea how to code or use flash, then telling me what has been said is untrue.

     

    Clearly you need extra help. Here's a quick video proving the concept. I rarely do this but there's something about being called a liar that is unhelpful enough to warrant it.

     

    http://www.filehorde.com/o/ex.mp4

     

    I was dismayed enough to actually record this on a laptop with a trackpad to explain the terrible mouse movement.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2012 4:05 PM   in reply to Gaby35

    You asked in post #4 where to put the code, nor did you know what that basic code does. That tells anyone you're definitely not an avid user as these are the absolute Flash 101 basics.

     

    The code I posted would work and is called a stub. Again, if you've been using it for a decade and a half you should have no problem with it. I'd post a video on that but I don't need another lecture.

     

    Lastly, no, you can't do what you want. You can't choose a registration point and canvas crop in flash. That's the point of the video. It's the easiest no-code route, as that's what it seemed like you needed.

     

    Good luck.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 26, 2012 9:12 AM   in reply to Gaby35

    Any more abusive language in this thread and it will be locked. Repeated violations of the forums terms of use will result in your accounts being suspended.

     
    |
    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