Stage resizing

Hi everyone. I'm trying to create a photo gallery where an
image gets loaded from an xml file and I want the stage to resize
to the size of the image because the images are all going to be
different sizes. I've looked into the Stage class, but I couldn't
find anything that I could use to accomplish what I'm trying to do.
The Stage.onResize function only triggers after the Stage has been
resized. The Stage.width and Stage.height properties are read-only,
so I can't use those to adjust the size of the Stage. Is there
anyway to change the size of the Stage dynamically?

Unfortunately I believe the answer is 'no'.
(People with more info please correct me if this is wrong).
Since flash is embedded in an html page with a fixed width
and height, it's not possible to modify those parameters at
runtime.

Similar Messages

  • Stage Resizing on "Clicked" External SWFs

    Hello everyone!
    Thanks for checking this out.
    This has been bugging me for almost a week now. I hope I may find some assistance here. I've Googled for this and everytime I encounter an article with the solution and people saying it worked great for them, I thought it's going to help me too, but didn't. I'm pretty sure I did exactly what was instructed but mine is just weird.
    I hope you can try to look at my files and see what's wrong, anyway this is just a simulation of my real project (which has the same problem) at a very small scale so it should be very easy to look at. I believe it's so easy to solve but I just couldn't nail it. Here's a brief description:
    There's this main.swf that loads two external swfs in a UILoader upon click of the corresponding button. By the way, the code inside the external swfs listens for a stage resize... So, when user clicks on button 1 (named "LOAD 1"), it loads "content1.swf". User decides to resize the window, and layout resizes accordingly (in this case, they all center horizontally). User clicks on button 2 (named "LOAD 2"), it loads "content2.swf". Everything looks fine, apparently. But when user tries to resize the window again, an error pops up in the Output panel...
    Honestly, I've built a new one here at my desktop using var loader:Loader = new Loader(); concept instead of the UILoader Flash component but still no luck. Please, hear me out. I don't think I want to give up.
    Thanks!

    Try this:
    Rename setComp() and resizeComp() in content1 to setComp1() and resizeComp1()
    Rename setComp() and resizeComp() in content2 to setComp2() and resizeComp2()
    Now try resizing and you'll see the error being thrown with the new function names.
    I think your problem deals with unloading your content. You should maybe try to properly unload content1 before loading content2 and vs. versa and see if that fixes your problem. I suspect that the resizeComp2 is still trying to resize an object that doesn't exist on the stage anymore, but the function is still loaded into memory and running. Unloading your swfs might clear this up.

  • FLVPlayback skin position on stage resize

    Hi, Got weird problem. on stage resize the skin's hit area of
    FLVPlayback instance floats away from the supposed position. When
    setting 100% scale to the FLVPlayback instance, it works correctly.
    This happens with skinAutoHide = true.

    Read this artical, it helped me with the same problem. Put
    the skin in the same directory as the webpage file that calls your
    main movie.
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=608abffd

  • Mouse clicks blocked improperly when stage resizes

    Hi everyone,
    Been working on this for a while with no success. would really appreciate your help.
    We have the following issue: 1 main flex application is loading another flex application swf using a swfloader placing the child app in the same security domain, but in separate application domains from the parent. There is an '...allowDomain(*)' between the apps and the stage scaling is set to no scaling.
    The problem is that when the stage is resized (window size increases or it goes to fullscreen) the child app 'grows' a large invisible area that blocks mouse clicks from reaching the parent app. This area far exceeds the child app's width & height and can be seen only when doing 'right-click' --> 'show redraw regions'. When scaling the window slowly back to the original stage size that the flash player started out with, those areas grow smaller and eventually disappear. If i load the child app when the main app stage size (window size) is already very big (or in fullscreen), this issue does NOT appear.
    Thanks in advance,
    Uri

    Sounds like a bug.  If you have a simple test case, please file a bug.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • How to control stage resizing

    My main file displays a large number of dynamically generated graphics. I have a listener to remove and then re-position the graphics if the browser is re-sized:
    stage.addEventListener(Event.RESIZE, stageResized)
    //When stage is resized, remove all children from the main component.
    //When empty, refresh the stage content
    public function stageResized(e:Event):void{
       while(mainUIComponent.numChildren>0){
            mainUIComponent.removeChildAt(0)
            addContentToStage()
    My problem is that the function works perfectly if I use the Browser Maximize/ Minimize buttons, but not if the window is re-sized manually by dragging the browser window at the bottom-right side. If I drag the window to resize, many graphics are left unerased on the stage, but all the new graphics are drawn leaving a terrible mess. If I go back to select the Maximize/ Minimize again, the screen is cleaned properly once more.
    Can anyone recommend an approach to clear out all the old graphics on a manual drag?

    Maybe add your event listeners to the Application object, and ensure width and height are 100%?
    If this post answers your question or helps, please mark it as such.

  • Presumably simple - adjusting MovieClip on stage resize..

    Hi there!
    I've been looking at a number sites lately and I've noticed that when you scale the browser window, what I presume must be a MovieClip, containing thumbnails, is adjusted, according to the size.
    Two examples are these:
    http://www.daniagraibe.com/
    http://www.aorta.se/
    When you go on these sites, thumbnails will eventually load - when you resize your browser window, more of less thumbnails will be on each line - according to how wide the browser (or stage, is).
    I presume this must require a stagelistener of some kind?
    If anybody has any clue how, using ActionScript 3, and instance names, this could be achieved, I'd really appreciate your help/advice!
    Thanks in advance for anything you can provide!

    Thank you for your reply - really appreciate it!
    Would it really be this complicated though?
    In the case of daniagraibe.com, it seems a little complicated for all those MovieClips to be repositioned, individually?
    Or would it perhaps have internal thumbnails and work by:
    calculating stage.stageWidth
    seeing if it's > a number
    If it is > a number, reposition thumbs
    If < number, don't?
    Thanks again for your help, if you're not sure on this, however.

  • Handle stage RESIZE.Event

    I've a flash site 100x100% in browser window.
    When I open new tab in browser window Event.RESIZE doesn't
    dispatched.
    Have any idea how to handle this event except EnterFrame or
    Timer listeners?

    stage.scaleMode = StageScaleMode.NO_SCALE;
    var count = 0;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    function resizeHandler(evt:Event):void {
    _txt.text = count++;
    use this code

  • Resizing the text as stage resizes

    I need to re size the text, as the stage re sizes. i.e scale the text depending on the stage width,height.
    Tried to work on scaleX, scaleY properties. But didn't help.
    Any references will be of great help.
    --Nitin Pokalwar                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Will it be possible to provide some sample code, so that requirement is a bit more clear..
    You may try..
    def text : Text = Text {
        content: "T"
        font: Font { size: 20 }
        textOrigin: TextOrigin.TOP
        transforms: Scale {
            x: bind (text.scene.width/text.layoutBounds.width)
            y: bind (text.scene.height/text.layoutBounds.height)
    }

  • Keep MC buttons scale static during stage resize?

    I've published my micro-site using the % method so as to match each viewer's browser settings...I've test and the distortion is minimal for most elements. I have some MC buttons that I created in Photoshop that look great at their original size in Flash. But when the stage scales to match viewer's resolution, they look pretty poor. I've already tried to redraw them in Flash and I can't get them to look anywhere near as good. So my question is, is there any way to "lock" the scale of the MC buttons so that they don't scale along with the stage? Thanks!

    Sounds good, will that work for buttons that are containted within a loaded external .swf too or do I have to add the listener to the main .swf and all of the external .swfs I'm loading? thanks!

  • Possible to set min/max size to a resizable Stage? If so, how?

    Is it possible to set a minimum and maximum size to a resizable Stage? If so, how would this be done? Do I use some kind of onResize event handler or is there some other way?
    Here is a sample code where I have a 500 x 500 px image in a 300 x 300 px scrollable scene that is in a resizable stage. Right now, I am able to resize the stage to any size, but I would like to limit the resizable minimum width and height to 100 x 100 px and limit the resizable maximum width and height to 600 x 600 px.
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.control.ScrollView;
    import javafx.scene.control.ScrollBarPolicy;
    import javafx.scene.image.ImageView;
    import javafx.scene.image.Image;
    var scene: Scene;
    Stage {
        resizable: true
        scene: scene = Scene {
            width: 300
            height: 300
            content: ScrollView {
                hbarPolicy: ScrollBarPolicy.ALWAYS
                vbarPolicy: ScrollBarPolicy.ALWAYS
                width: bind scene.width
                height: bind scene.height
                node: ImageView {
                    image: Image { url: "{__DIR__}roses.jpg"}
    }

    Hi, I don't understand how WidgetFX is going to allow me to set min/max size to a resizable Stage. After all, it is a desktop widget platform and I'm not trying to build a desktop widget. None of the demos I've tried use a decorated Stage with platform decorations that can be used to drag and resize the Stage.
    I'm just trying to limit the min/max size of a resizable Stage. If you think WidgetFX will address my problem, I think a better solution is the JavaFX Stage Controller class I found available at http://code.google.com/p/memefx/. However, the JavaFX Stage Controller class still doesn't address the problem I have because it doesn't stop the user from dragging the Stage beyond the size restricted by the min/max height. It only reverts the Stage to the max size after the user already dragged and resized the Stage beyond the max resizable width/height.

  • Keeping things aligned / in place when stage / browser resized

    Hi,
    I'm trying to work out how to keep objects aligned when the user resizes the browser window.
    I want the contents of the window to remain in view similar to how photoshop wourks when the window is resized. I also want any child components to remain "in place" relative to the position within the window.
    do I have to listen for the stage resizing and recalculate the position of the child components?
    Thanks
    Tim

    hi
    use the layout features of flex to manage sizing/positioning of objects: http://www.adobe.com/devnet/flex/videotraining/exercises/ex1_05.html

  • Why is getLineMetrics inaccurate when using device fonts* or immediately after resizing a TextField?

    1.  We need getLineMetrics to return correct values immediately after changing a TextField's width/height or any property that would affect the layout metrics, withouth having to alter other properties like setting the text to itself (p1.text = p1.text).  Currently, if you change the width of a text field to match the stage width for example, getLineMetrics will not return correct values until the next frame.... UNLESS you set the text property.
    2.  We also need some kind of "stage scaled" event in addition to the "stage resize" event (which only fires when stage scale mode is no_scale), because stage scaling affects the rendered size of device fonts so dramatically that we must call getLineMetrics again.  This is not the case for fonts antialiased for readability, since their size is relatively stable with scaling, as demonstrated by drawing a box around the first line once and then scaling the stage.
    So those are the problems.  The asterisk in the title of this post is there because it seem that TextField.getLineMetrics is accurate with device fonts, but I cannot take advantage of that accuracy without a way to detect when the player is scaled.  I can only confirm its accuracy at a 1:1 scale, since there is no way to recalculate the size of the line rectangle once the player is scaled, aside from setting a timer of some sort which is a real hack not to mention horribly inefficient with no way to detect when the stage has actually be scaled.
    I use device fonts because embedded fonts look terrible and blurred compared to device font rendering.  The "use device font" setting matches the appearance of text in web browsers exactly.  The only way to get embedded/advanced antialiased text in flash to approximate that of the device font look is to primarily set gridFitType to PIXEL instead of SUBPIXEL, and secondly set autokerning to true to fix problems caused by the PIXEL grid fit type.  That ensure strokes are fitted solidly to the nearest pixel, however it still lacks the "ClearType" rendering that device fonts use, which has notable color offset to improve appearance on LCD monitors, rather than the purely grayscale text that flash uses in its subpixel rendering.  Frankly, failure to use device fonts because of API issues, is the only reason why Flash sometimes doesn't look as good as HTML text and why people say text in Flash "looks blurry".  I'm tired of hearing it.  If the player simply dispatched an event when scaled and updated the metrics immediately when any property of the text field that would affect the metrics is changed, then we could all happily use device fonts and Flash text would look great.  As is stands, because of the two problems I mentioned in the opening paragraph, we're stuck dealing with these problems.
    If you create two text fields named "p1" and "p2" for paragraph 1 and 2, populate them with an identical line of text and set one to "use device fonts" and the other to "antialias for readability", then use this code to draw boxes around the first line of text in each of them:
    import flash.text.TextField;import flash.text.TextLineMetrics;graphics.clear();drawBoxAroundLine( p1, 0 );drawBoxAroundLine( p2, 0 );function drawBoxAroundLine( tf:TextField, line_index:int ):void{          var gutter:Number = 2;          var tlm:TextLineMetrics = tf.getLineMetrics( line_index );          graphics.lineStyle( 0, 0x0000ff );          graphics.drawRect( tf.x + gutter, tf.y + gutter, tlm.width, tlm.height );}
    The box surrounding the line of text in the "use device fonts" box is way off at first.  Scaling the player demonstrates that the text width of the device font field fluctuates wildly, while the "antialias for readability" field scales with the originally drawn rectangle perfectly.  That much is fine, but again to clarify the problems I mentioned at the top of this post:
    Since the text width fluctuates wildly upon player resize, assuming that getLineMetrics actually works on device fonts (and that's an assumption at this point), you'd have to detect the player resize and redraw the text.  Unfortunately, Flash does not fire the player resize event unless the stage scale mode is set to NO_SCALE.  That's problem #1.  And if that's by design, then they should definitely add a SCALE event, because changes in player scale dramatically affect device font layout, which requires recalculation of text metrics.  It's a real issue for fluid layouts.
    The second problem is that even when handling the resize event, and for example setting the text field width's to match the Stage.stageWidth property, when the text line wraps, it's not updated until the next frame.  In other words, at the exact resize event that causes a word to wrap, calling getLineMetrics in this handler reports the previous line length before the last word on the line wrapped.  So it's delayed a frame.  The only way to get the correct metrics immediately is basically to set the text property to itself like "p1.text = p1.text".  That seems to force an update of the metrics.  Otherwise, it's delayed, and useles.  I wrote about this in an answer over a year ago, showing how sensitive the text field property order is: http://stackoverflow.com/a/9558597/88409

    As I've noted several times, setting the text property to its own current value should not be necessary to update the metrics, and in some subclasses of text field, setting a property to its own value is ignored as the property is not actually changing and processing such a change would cause unnecessary work which could impact application performance.  Metrics should be current upon calling getLineMetrics.  They are not.  That's the problem.
    From a programming perspective, having to set the text property (really "htmlText" to preserve formatting) to itself to update metrics is almost unmanagable, and doesn't even make sense considering "htmlText" is just one of a dozen properties and methods on a TextField that could invalidate the layout metrics (alignment, setTextFormat, width, height, antiAliasMode, type, etc.), and I would have to override every one of those properties so that I could set htmlText = htmlText.  Using such a subclass isn't even possible if I want to use the Flash IDE to add text fields to the stage.  I would have to iterate over the display list and replace all existing fields with my subclass, which also isn't a good workaround because there's no way to update any and all variable references that may have been made to those instances.
    Frome what I've read, the invalide+render event system is unreliable.  My layout framework is similar to that of Windows Forms, and performs layout immediately, with dozens of docking modes and uses suspend and resume layout calls for efficiently resizing multiple child objects in a component.  Certain calculations cannot be aggregated for a render event, because some containers are semi-reflexive, meaning they can expand to fit the child contents while also contraining the child size, depending on whether the contain was resized or the child component was resized, so as a matter of correctness the resizing calcultation must occur immediately when the child resizes, otherwise a top-down pass on the display hierarchy for resizing will not be sufficient.
    As far as waiting until the next frame, no that is not possible, as it will cause one frame to be completely wrong.  If I was dragging the browser window to resize it, it would look terrible as virtually every single frame during the resizing operation would be incorrect.  Also, in the case where a user clicks the maximize or restore button of the web browser, the resizing event will occur exactly once, so if the metrics are not correct when that occurs, there is no recalculation occuring on the next frame, it will just be wrong and sit there looking wrong indefinitely.
    In case it's not obvious by now, this is a web application.  It uses the NO_SCALE stage scaling option, so notification of the event is not actually an issue for me personally.  I was just pointing out that for anyone not using the NO_SCALE option, there is no event in Flash to detect player scale.  What you're suggesting is using a JavaScript event and using the ExternalInterface bridge to send a message, which there is no guarantee whether it will be processed in a timely matter by the player and introduces possible platform inconsistancies, depending on whether the browser has actually resized the Flash interface at that point or what state Flash is in when it tries to recalculate the size of the text.  The browser may send that event to flash before the player is actually resized, so it will be processing incorrect sizes and then resized after the fact.  That's not a good solution.  Flash needs a scale event in addition to a resize event.  I'm really surprised it doesn't have one.  At the very least, the existing resize event should be dispatched reguardless of the stage scale mode, rather than occuring exclusively in the NO_SCALE mode.
    Bottom line is that getLineMetrics needs to return correct values every time it is called, without having to set the "text" property immediately before calling it.  If such a requirement exists, which seems to be the case, then that needs documented in the getLineMetrics method.

  • How can I get an SVG to Fill up 100% Width and Height of Stage?

    I'm currently trying to use an SVG image as a background to a symbol. However, when I try to get the image to fill up the whole background, it still forces the original image's aspect ratio when the stage resizes. Is their a way within edge to have the svg image behave like a raster image and have it completely fill up the stage, ignoring the aspect ratio of the image?

    Hey Cannonade,
    Are you trying this in Chrome/Safari? Webkit-based browsers will always force the SVG to scale in porpotion. Kind of lame I know, unfortunately I'm unaware of a workaround.
    Sarah

  • How to proper resize images and videos at runtime without losing quality?

    Hi guys. I need a bit of help here.
    I've built a flash site in which i want to resize a movie to the stage. I do it by keeping the proportion, thus i only resize the width and then i resize the height acordingly to the new width but keeping the proportion.
    The problem is that my film still looks "pixeled".
    I found a website on which the stage resizes dinamically with the movie and the background images without either of them losing quality. Till now i knew that resizing images or videos in flash at authoring or runtime produces pixeled results.
    This is the website: http://kampanjeweb.apt.no/jotun/romforrom/. Can someone tell me how do they do it without losing quality? just make the browser windowed and resize the margins to see the effect.
    Thanks.

    Hello, Venian.
    About the video, you could try setting the flash.media.Video's smoothing property to TRUE. This should keep a quality, but you can do nothing if the video has a poor quality. You need a great video.
    About the images, you you need to redraw the image each time you resize it. To achieve it, use a combination of Bitmap, BitmapData and Matrix classes. Any doubt, just call again. Here is a simple example:
    var scale:Number = .5;
    var highQualitySourceImage:Bitmap = ...your image...;
    var scaleMatrix:Matrix = new Matrix();
         scaleMatrix.scale(scale, scale);
    var bitmapData:BitmapData = new BitmapData( scale*highQualitySourceImage.width, scale*highQualitySourceImage.height);
         bitmapData.draw(highQualitySourceImage, scaleMatrix);
    var finalBitmap:Bitmap = new Bitmap(bitmapData);
    addChild( finalBitmap );
    Cheers,
    CaioToOn!

  • Edge project resizes to 0 height on open

    Hello,
    I am having a problem with my project stage resizing to 0 when I open the working file. I can set the height and save it but once I open it agian it sets it to zero and I can't preview it as my overflow is set to hidden. Any help would be much appreciated.
    Thanks

    There is no settings outside of this edge file that were changed or being changed. I ended up just copying and pasting the project into a new document and everything is fine now.
    I beleive it was a problem with the file as my program crashed while I was working on it and when I reopened the file I started to have that problem.
    Thanks

Maybe you are looking for

  • Get Spotlight to search everywhere

    Hi everyone, I consider myself a pro user, certified Apple tech, sys admin, blabla. Sometimes I need to configure plists manually or edit some hidden/system files. I know how to search for these using a Finder search window and the kind dropdown menu

  • Vendor deletion/Block update from ECC to SNC

    Hi When vendor is blocked or deletion flag is set, and after that when vendor is CIFe'd to SNC, is the status in SNC get updated. We have an issue that after CIF status of vendor still PO are able to be confirmed on SNC side? Is somebody having cllue

  • How do I disable the tray icon for firefox (version 5)

    I want to get rid of the tray icon for firefox 5.

  • Photo does not show up in caller ID

    I took a photo with my iPhone 3 and added it to a contact. When my contact called me, the photo did not appear. I did this with another contact and the photo ID works fine. Any ideas? Thanks!

  • Nano says i have ussed 850 megs of space but there is no music on my ipod

    Help! My pc says i have used approx. 850 mgs of space, but there is nothing on my nano. when i turn it on all i get is a menu screen. This is what I tried... # Open the Control Panel. # Double click on Administrative Tools. Note: If you don't see Adm