Scaling of components

I have a panel (with components) which needs to be printed,given on the a4 size the component(panel) does'nt fit. Is there any api that scale the panel and its inner components according to the size of the page.
Thanks a ton in advance

Hi Bob,
Can you try adding this to the project's compiler argument? This should fix the scaling issue that you're seeing.
-includes=mx.managers.systemClasses.MarshallingSupport
Joe

Similar Messages

  • Scaling, Rotating Components

    Was just working on a personal project in which I needed to scale a component, and this lead me to finding some bugs in code I'd posted here to rotate components. So I just thought I'd post the new PERFECT (for now) superclass to both of these problems, which you can find [here in TUS|http://tus.svn.sourceforge.net/viewvc/tus/tjacobs/ui/mod/] Enjoy!
    package tjacobs.ui.mod;
    import java.awt.Component;
    import java.awt.Cursor;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ComponentAdapter;
    import java.awt.event.ComponentEvent;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.AffineTransform;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLayeredPane;
    import javax.swing.SwingUtilities;
    public abstract class ModPanel extends JLayeredPane {
         private static final long serialVersionUID = 1L;
         protected Component glass;
         private Component lastComponent;
         @SuppressWarnings("serial")
         public ModPanel() {
              final JComponent mouseCatcher = new JComponent() {
                   public void setCursor(Cursor c) {
                   public Cursor getCursor() {
                        if (lastComponent != null) return lastComponent.getCursor();
                        return super.getCursor();
              glass = mouseCatcher;
              this.add(mouseCatcher);
              mouseCatcher.setLocation(new Point(0,0));
              this.setLayer(mouseCatcher, JLayeredPane.POPUP_LAYER + 100);
              addComponentListener(new ComponentAdapter() {
                   public void componentResized(ComponentEvent ev) {
                        mouseCatcher.setSize(getSize());
              MyMouseListener listener = new MyMouseListener();
              mouseCatcher.addMouseListener(listener);
              mouseCatcher.addMouseMotionListener(listener);
              mouseCatcher.setFocusable(false);
         abstract protected Point modifyPoint(MouseEvent me);
         public void paint(Graphics g) {
              Graphics2D g2 = modifyGraphics(g);
              super.paint((Graphics) g2);
         public Graphics getGraphics() {
              return modifyGraphics(super.getGraphics());
         protected abstract Graphics2D modifyGraphics(Graphics g);
         private class MyMouseListener implements MouseListener, MouseMotionListener {
              @Override
              public void mouseClicked(MouseEvent arg0) {
                   handle(arg0);
                   arg0.consume();
              @Override
              public void mouseEntered(MouseEvent arg0) {
                   //arg0.consume();
              @Override
              public void mouseExited(MouseEvent arg0) {
                   //arg0.consume();
              @Override
              public void mousePressed(MouseEvent arg0) {
                   handle(arg0);
                   arg0.consume();
              @Override
              public void mouseReleased(MouseEvent arg0) {
                   handle(arg0);
                   arg0.consume();
              private void handle(MouseEvent me) {
                   Point loc = me.getPoint();
                   loc = modifyPoint(me);
                   remove(glass);
                   Component c = null;
                   if (me.getID() == MouseEvent.MOUSE_RELEASED && lastComponent != null) {
                        c = lastComponent;
                   } else {
                        c = SwingUtilities.getDeepestComponentAt(ModPanel.this, loc.x, loc.y);
                   add(glass);
                   if (c != null) {
                        MouseEvent ev = createNewMouseEvent(me, me.getID(), c, loc);
                        c.dispatchEvent(ev);
              private void handleMove(MouseEvent me) {
                   Point loc = me.getPoint();
                   Point loc2 = modifyPoint(me);
                   remove(glass);
                   Component c = null;
                   if (me.getID() == MouseEvent.MOUSE_DRAGGED) c = lastComponent;
                   else {
                        c = SwingUtilities.getDeepestComponentAt(ModPanel.this, loc2.x, loc2.y);
                   if (c instanceof ZoomPanel) c= null;
                   add(glass);
                   if (c == glass || c== ModPanel.this) c = null;
                   if (lastComponent != c && me.getID() != MouseEvent.MOUSE_DRAGGED) {
                        if (lastComponent != null) {
                             MouseEvent me1 = createNewMouseEvent(me, MouseEvent.MOUSE_EXITED, lastComponent, loc);
                             lastComponent.dispatchEvent(me1);
                        lastComponent = c;
                        if (c != null) {
                             MouseEvent me1 = createNewMouseEvent(me, MouseEvent.MOUSE_ENTERED, c, loc2);
                             c.dispatchEvent(me1);
                   if (c != null && c != ModPanel.this) {
                        MouseEvent me1 = createNewMouseEvent(me, me.getID(), c, loc2);
                        c.dispatchEvent(me1);
              private MouseEvent createNewMouseEvent(MouseEvent me, int type, Component newComp, Point newPoint) {
                   Point pt = SwingUtilities.convertPoint(ModPanel.this, newPoint, newComp);
                   MouseEvent me2 = new MouseEvent(newComp, type, me.getWhen(), me.getModifiers() | me.getModifiersEx(), pt.x, pt.y, me.getClickCount(), me.isPopupTrigger(), me.getButton());
                   return me2;
              @Override
              public void mouseDragged(MouseEvent arg0) {
                   handleMove(arg0);
                    arg0.consume();
              @Override
              public void mouseMoved(MouseEvent arg0) {
                   handleMove(arg0);
                   arg0.consume();
    }Edited by: tjacobs01 on Jan 16, 2010 6:40 PM

    Thanks for the great code. It is not perfect yet though, but that is easy to fix. You pass the modified mouse coordinates to 'getDeepestComponentAt'. This does not work. I am scaling down a slider to 50% and it only received events for the top-left rectangle. If you pass in the original coordinates, the mouse events will get through to the underlying component.
    Regards,
    Johan
    Edited by: jstuyts on Feb 11, 2010 3:42 PM. Removed code block so the method name is inline in the text.

  • Scaling UI Components

    Hi,
    I wonder if anyone has tried doing this. I have several coordinates  here as here:
    <region name="triangle">
    <perimeter>
    <x>8</x><y>10</y>
    <x>2</x><y>10</y>
    <x>2</x><y>5</y>
    <x>8</x><y>5</y>
    </perimeter>
    </region>
    <region name="rect">
    <perimeter>
    <x>30</x><y>1</y>
    <x>20</x><y>1</y>
    <x>20</x><y>2</y>
    <x>30</x><y>2</y>
    </perimeter>
    </region>
    I am trying to use some simple way of finding out what the width and  height of the objects that I draw on the canvas. I call up the main app using this:
    drawThematicMap.setCanvas(100,100,300,500);            
       drawThematicMap.draw(regions);
    This is what is in the drawThematicMap class:
        public var canvas:Canvas;
            public function setCanvas(x:Number,y:Number,width:Number,height:Number):void{
                canvas.setActualSize(width,height);
                canvas.x = x;
                canvas.y = y;  
            public function draw(arr:Array):void{
             regions = arr;    
             var shape:UIComponent;
                     var gr:Graphics;
                     var coords:Array;
                 for (var s:String in regions) {
                    trace("\n" + s);
                    shape = new UIComponent();  
                    gr = shape.graphics;
                    gr.lineStyle(3);//Define line style                   
                    coords = regions[s];
                    gr.moveTo(coords[0],coords[1]);
                 for (var i:int = 2; i < coords.length; i += 2) gr.lineTo(coords[i],coords[i + 1]);                  
                     gr.lineTo(coords[0],coords[1]);  
                     gr.endFill(); //Put this in if there is a color
                     canvas.addChild(shape);  
    I am trying to  use the information so I can possibly use it for rescaling the image so I  don't have to calculate all my coordinates one by one.
    Is there a simple way to do this?
    Thanks for your help.
    Alice

    Hi,
      I looked at http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/geom/Transform.html#pixelBounds, and looks like that it may work if my shape is "rectangle". What happens if it is not a rectangle, like a triangle, for example?
      I am trying to find out the "max width and height of the numbered shapes that I may be reading from an external file, so I could use that data to decide how much I need to "scale" to the desired "canvas size." Is this possible?
      As a side note, I do have import flash.geom.*; at the beginning of my class.
    Thanks for your help.
    Alice

  • Scaling HTML Preview

    Hy,
    For the programm I'm building right now I need a scaleable preview for simple HTML (mostly Text). I got this to work with a HTMLEditorKit & some hacks (such as creating a View that works without a parent view). It scaled just fine using an AffineTransform applied to the Graphics object and had no problems (after some heavy debugging).
    The real problems started when I needed to preview a <form> in this preview. The HTMLEditorKit (or more precisely the Views) use Swing components to draw the form-elements (which is reasonable, of course). Sadly Swing Components seem to work really bad with scaling. As soon as I have a Checkbox in my Preview and do Scaling at the same time it just throws the following exception.
    java.lang.IllegalStateException: constrain(xywh) is not supported for complex transform.
         at sun.java2d.SunGraphics2D.constrain(SunGraphics2D.java:287)
         at sun.awt.SunGraphicsCallback.constrainGraphics(SunGraphicsCallback.java:25)
         at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:51)
         at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
         at java.awt.Container.paint(Container.java:1123)
    The only instance of scaled Swing components I've found was Jazz (at http://www.cs.umd.edu/hcil/jazz/ ). It would be a solution, but it seems like overkill. I don't have to be able to actually use the components. They only have to display.
    regards
    Joachim Sauer

    If you are talking about "drilling", like clicking on Assets as a line item and having the report show additional lines, I have not seen that. The only expansion that I have found is when you build it into the report design. This expansion is only displayed one way on the report and is not interactive.

  • Stage.scaleMode = StageScaleMode.EXACT_FIT

    Hey all... first time posting here, long time lurker.  I have a problem with a personal project (home automation) that I have yet to figure out a solution.  In essence, I cannot get stageScaleMode EXACT_FIT to work as I would hope.  There is just something about the way the stage is handled in Flex that I'm missing.  I have searched for a solution to this issue for hours and hours around the web, with very little help being provided.  This project has just been in my free time and I have actually gotten so frustrated a number of times at this problem, that it has caused me to give up work on it for a while, however I'm motivated once again to try.
    In a nutshell, I have developed a Flex application with a set width and height.  What I need is for the application to zoom (scale or whatever) to fit whatever container it is in, allowing distortion to occur, and scaling all components, fonts, images, etc accordingly.
    I have tried a number of methods and the only method I have found that works the way I want is to use the Flash debug player, load a wrapper SWF (stub essentially) I created in Flash, which in turns loads the built Flex SWF.  Doing that, I can resize the flash player window or even go full screen and the flex app scales to always fit the container... buttons, fonts, everything scales.  Essentially, the application looks exactly the same at 640x480 and at 1024x768 (albeit smoother fonts, etc).  Understand that this is different that how one would probably develop a Flex app, where the actual UI components expand/contract... I want them to stay the same size, same number of rows, etc... just get bigger... fonts and all.
    Loading just the Flex SWF in the debug player without the wrapper, however, doesn't work.  I can get it to stick to the defined width and height or sometimes get it to scale to an (unknown) stage size, where all that is visible is essentially the top left quarter of the app and resizing the window does cause the app to scale, however only pretty much that 1/4 of the app is visible in the window.  Loading the app directly in a browser (through a page) or even through the stub wrapper SWF provides the same screwy results.  It's almost as if the Flex app has no idea what the size of the actual container it is in, unless it is in the debug player.  Publishing it as an AIR app does the same thing.
    Using the Flash debug player, along with the wrapper, actually gets the job somewhat done for my little project's purposes, however I am really at the point where I need to move this is into either a full on AIR install or be able to run this in the browser (either case scaled correctly), so that I may do other things (launch new windows, possibly interact with the desktop, etc).
    I apologize I'm not a Flex/Flash developer for my day job, so I'm not using the correct terminology (however I am a programmer), but I hope my description of what is occurring will suffice.  I've seen others online with a similar problem and have heard mentions of using some form of scalex/scaley to accomplish a solution, but couldn't find any actual examples of working code.
    Any help would sincerly be appreciated.  I would like to finally get past this, so I can go back to having fun working on the actual parts of the application (and not just getting it to fit the dang screen)... haha.
    Thanks.

    Thanks for that pointer.  I tried playing with finding the (what I would call) "natural" size of the app, as you describe.  When laying out the UI, I always set the viewer to 800x600.  I removed the app's width/height, added some trace statements and here was the output (stageWidth is stage.stageWidth & "width" is stage.width):
    stageWidth = 500
    stageHeight = 375
    width = 548
    height = 596
    If I set the app's width/height to 548x596, this somewhat worked, however it caused proportions on individual components to be off (of course they would scale with these off proportions).
    So that got me thinking.  The app has a viewStack as it's main "base", which was defined having width/height = 100%.  I changed that to an absolute width/height of 800x600.  Without setting an app width/height and running, I then got:
    stageWidth = 500
    stageHeight = 375
    width = 800
    height = 600
    So, naturally then I changed the apps width/height to 800x600 and wholla!  Works/scales (all by itself with no wrapper) in both the debug player and the browser just fine and looks the way I intended.  Neato!  Trace gives me:
    stageWidth = 800
    stageHeight = 600
    width = 800
    height = 600
    Now, getting the same job done in AIR is a different story.  I immediately went to my AIR project and tried, but it still suffers from the same (~1/4 corner of the app) showing up, albeit it tries to scale up with the window resize.  My guess is there is something different with the timing/order of the stage/display elements here, as the code itself (other than it's a windowedApplication") is exactly the same.  Without any app width/height (but setting the viewStack width/height to 800x600), the trace gives me:
    stageWidth = 500
    stageHeight = 375
    width = 800.5
    height = 600
    Now, here is what is strange with the AIR app and what may lead someone that knows this better to tell me how to fix it.  I am setting the stage.scaleMode using the reference from that base viewstack I described earlier.  When I run the AIR App and resize the window smaller, what looks to be the actual app scales down to the point where it actually is smaller than the window it is contained in (albeit still only showing about 1/4 corner of the actual application).  There are borders (padding/blank space) on the right/bottom (I also set stageAlign top left).  Scaling the window larger and larger, just scales that corner that is visible larger and larger (similar to what the browser version was doing), but actually fulls the window with this 1/4 corner of the app.  I know I am missing a "gotcha" about AIR somewhere here.

  • Scaling jpanel and its components

    Hi all,
    I have a JPanel of size 600x600,which contains few buttons and textboxes.If i am reducing the panel size to 300x300, i want the components in the panel to get reduced in size and position relatively,so that all the components are visible.Is it possible to scale panel ,like scaling a image.
    Please help me.
    Thanks in advance
    Ravisenan

    Yes, it is possible.
    Go through the link
    A Visual Guide to Layout Managers
    http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html

  • Scaling / Resizing Catalyst Components in Builder

    Hi,
    I'm looking at setting up the proper workflow for a large project. We envision multiple developers and multiple designers on the project.
    The major sticking point now is scaling and resizing the components generated by Catalyst once they're in Builder. One would think that once you've skinned, for example, a scrollbar in Catalyst that you could then resize it in Builder to match different layouts.
    However, as I suspect you already know, the sizes do not change at all in Builder.
    We can get into the source code in builder and add in a bunch of width/height = 100% attributes, but these break down at the point that there are Paths defined in the code. The Path elements would need to be re-coded to scale.
    So, I really have two questions:
    1) What exactly does "Convert to Optimized Graphic" do? Will this recreate all Paths to standard shapes that will scale?
    2) Is there a better system coming in the next Beta? If so, can you describe it a bit?
    Thanks a lot,
    Kirk

    This morning I sat down to use catalyst for the first time. I am preparing for a talk at Flash on The Beach in Brighton this year and I was hoping to be able to show how a view build in Catalyst could be injected into an app using Robotlegs.
    I watched http://tv.adobe.com/watch/adc-presents/create-spark-component-skins-using-flash-catalyst and thought that looked cool.
    I also watched http://tv.adobe.com/watch/flash-catalyst-cs5-feature-tour/sending-your-project-to-a-develo per, and saw the component library output looked awesome.
    So I started to build an interface, first by creating a custom button component (much like the first video) and then distributing those buttons in a completely custom button holder component. It is this button holder that would be injected, and in the holder each button would have an id so that references to them could be obtained after injection into the application.
    From the videos above this looked eminently doable and quite a good workflow. Designer design and layout components that get built into a library, and developers use those components in an application without actually recoding the components.
    This sounded great, but imagine my dissapointment when I discovered
    1) A custom component can not be resized in the design view of Catalyst - you have to create another component class with a different size!
    2) A component/skin developed in Catalyst can not even resize when imported into Flash Builder unless you recode it.
    3) You can't name instances of components in the design view.
    So my plan was completely foiled. I mean, surely a button skin/component can not be considered a button skin/component unless it can be resized!
    I like Flex and I think Flex 4 is a big step forward, however I have never met a designer who liked it. Designers cannot effectively layout applications themselves using Flex. In fact where I work they are pushing to prevent ANY future flex development because of the problems with designers not being able to do this (we make and maintain some very highly skinned Flex 3 applications). I am the only front end Flex developer there and anytime I start to develop in Flex it is seen as very awkward and a problem.
    I hoped that Catalyst would solve some of these problems, but it unfortunately fails dismally because of the above problems that I mentioned.
    These three things would go a long way to improving developer design workflow for Flex and Catalyst. Any ideas for if/when this functionality might be included?

  • Mouse Coordinate issues caused by Scaling Components in a JScrollPane

    Hi All,
    I've been attempting to write a program that includes a simple modeler. However, I've been having some trouble with being able to select components when attempting to implement zoom functionality - when I "zoom" (which is done via scroll wheel) using the scale Graphics2D method, while it zooms correctly, the mouse location of components do not seem scale.
    I've tried one of the solutions found on the forums here (create a custom event queue that adjusts the mouse coordinates) and while it seemed to work initially, if I zoom in and adjust the current view position using the scrollbars, certain components contained in the JPane will become un-selectable and I haven't been able to work out why.
    I've attached a SSCCE that reproduces the problem below - it implements a JScrollPane with a JPane with a few selectable shapes set as the Viewport. The zoom is done using the mouse scroll wheel (with wheel up being zoom in and wheel down being zoom out)
    Any help in order to fix the selection/de-selection issues on zoom would be greatly appreciated! I've spent some time reading through the forums here but have unfortunately not been able to find a workable solution around it.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class Tester extends JScrollPane
        public Tester() {
            this.setViewportView(new Model());
        public static void main (String[] args) {
            JFrame main = new JFrame();
            main.add(new Tester());
            main.setSize(500,300);
            main.setResizable(false);
            main.setVisible(true);
    class Model extends JPanel implements MouseListener, MouseWheelListener
        private GfxClass selection = null;
        private static double zoomLevel = 1;
        // zoom methods
        public void setZoom(double zoom) {
            if( zoom < 0 && zoomLevel > 1.0)
                zoomLevel += zoom;
            if( zoom > 0 && zoomLevel < 5.0)
                zoomLevel += zoom;
        public static double getZoom() { return zoomLevel; }
        public void resetZoom() { zoomLevel = 1; }
        public Model() {
            super(null);
            addMouseListener(this);
            addMouseWheelListener(this);
            MyEventQueue meq = new MyEventQueue();
            Toolkit.getDefaultToolkit().getSystemEventQueue().push(meq);
            for(int i = 0; i <7; i++) {
                double angle = Math.toRadians(i * 360 / 7);
                GfxClass oc_tmp = new GfxClass((int)(200 + 150 * Math.cos(angle)), (int)(125 + 100 * Math.sin(angle)), "Element"+i);
                add(oc_tmp);
            repaint();
        public void paint (Graphics g) {
            Graphics2D g2 = (Graphics2D) g.create();
            AffineTransform oldTr=g2.getTransform();
            g2.scale(getZoom(),getZoom());
            super.paint(g2);
            g2.setTransform(oldTr);
            setBackground (Color.white);
            super.paintBorder(g2);
        private static class MyEventQueue extends EventQueue  {
            protected void dispatchEvent(AWTEvent event) {
                AWTEvent event2=event;
                if ( !(event instanceof MouseWheelEvent) && (event instanceof MouseEvent) ) {
                    if ( event.getSource() instanceof Component && event instanceof MouseEvent) {
                        MouseEvent me=(MouseEvent)event2;
                        Component c=(Component)event.getSource();
                        Component cursorComponent=SwingUtilities.getDeepestComponentAt(c, me.getX(), me.getY());
                        JPanel zContainer= getZoomedPanel(cursorComponent);
                        if (zContainer!=null) {
                            int x=me.getX();
                            Point p=SwingUtilities.convertPoint(zContainer,0,0,(Component)event.getSource());
                            int cX=me.getX()-p.x;
                            x=x-cX+(int)(cX/getZoom());
                            int y=me.getY();
                            int cY=me.getY()-p.y;
                            y=y-cY+(int)(cY/getZoom());
                            MouseEvent ze = new MouseEvent(me.getComponent(), me.getID(), me.getWhen(), me.getModifiers(), x, y, me.getClickCount(), me.isPopupTrigger());
                            event2=ze;
                super.dispatchEvent(event2);
        public static JPanel getZoomedPanel(Component c) {
            if (c == null)
                return null;
            else if (c instanceof Model)
                return (Model)c;
            else
                return getZoomedPanel(c.getParent());
        private void deselectAll() {
            if(selection != null)
                selection.setSelected(false);
            selection = null;
        public void mouseClicked(MouseEvent arg0)  {    }
        public void mouseEntered(MouseEvent arg0)  {    }
        public void mouseExited(MouseEvent arg0)   {    }
        public void mouseReleased(MouseEvent arg0) {    }   
        public void mousePressed(MouseEvent me) {
            Component c1 = findComponentAt(me.getX(),me.getY());
            if(c1 instanceof GfxClass)
                if(selection != null)
                    selection.setSelected(false);
                selection = (GfxClass)c1;
                selection.setSelected(true);
            else
                deselectAll();
            repaint();
            return;
        public void mouseWheelMoved(MouseWheelEvent e) { // controls zoom
                int notches = e.getWheelRotation();
                if (notches < 0)
                    setZoom(0.1);
                else
                    setZoom(-0.1);
                this.setSize(new Dimension((int)(500*getZoom()),(int)(300*getZoom())));           
                this.setPreferredSize(new Dimension((int)(500*getZoom()),(int)(300*getZoom())));     
                repaint();
    class GfxClass extends Component { // simple graphical component
        private boolean isSelected = false;
        private String name;
        public GfxClass(int xPos, int yPos, String name) {
            this.name = name;
            this.setLocation(xPos,yPos);
            this.setSize(100,35);
        public void setSelected(boolean b) {
            if( b == isSelected )
                return;
            isSelected = b;
            repaint();
        public boolean isSelected() {
            return isSelected;
        public void paint(Graphics g2) {
            Graphics2D g = (Graphics2D)g2;
            if( isSelected )
                g.setColor(Color.RED);
            else
                g.setColor(Color.BLUE);
            g.fill(new Ellipse2D.Double(0,0,100,35));
            g.setColor(Color.BLACK);
            g.drawString(name, getSize().width/2 - 25, getSize().height/2);
    }Edited by: Kys99 on Feb 22, 2010 9:09 AM
    Edited by: Kys99 on Feb 22, 2010 9:10 AM

    Delete your EventQueue class. Change one line of code in your mouse pressed method.
    public void mousePressed(MouseEvent me) {
        Component c1 = findComponentAt((int) (me.getX()/getZoom()),
                                       (int) (me.getY()/getZoom()));
    }

  • How to get correct coordinate & size of components in scaled swf

    I use canvas (I set it to fit whole screen size) to enclose a swfloader which loads a swf with width & height set to 100%. This swf has a movieclip. How can I get the correct coordinates of its position and its size after scaled in Flex?
    In the Flash CS4, the movielip has x=40, y=700. In Flex, the swf is scaled 100% but when I get the x value of this movieclip, it's still 40. I try to get the scale ratio of x-axis by refering to swf's scaleX. But its 1, weird enough.
    How can I get correct coordinates of movieclip?

    I do try the localToGlobal but it seems its 1:1 ratio, the codes I use:
    // swf is loaded by swfloader, there's a movieclip child named 'child_mc' in it, I want to locate its postion and size. It's top-left coordinates in flash cs4 is 4,740
    var swf_obj:MovieClip = MovieClip(swf.content);
    var mymc:MovieClip = swf_obj.child_mc;
    child_before:Point = new Point(mymc.x, mymc.y);
    child_after:Point = swf.localToGlobal(child_before);
    Alert.show(
         "before:"+child_before.x+","+child_before."y"+"\n"
         + "after:"+child_after.x+","+child_after."y"+"\n"
    the dump result is:
    before:4,740
    after:4,740
    dump screenshot is here: http://img198.imageshack.us/img198/2396/image2ew.png
    I use values of child_after to draw green box. The white box is child_mc's actual position after scaled to fit canvas size (in turn the screen size). You can see they are far from each other. Why?
    Do you mean I have to multiply the transform matrix myself to get the correct position?

  • Flex Mobile project scaling with Retina display iPad (3rd gen).

    Adobe et al,
    With the new iPad 3 we now have a ton more pixels to utilize. I'm familiar with and have already successfully tested the AIR 3.1+ commandline compiler option (-platformsdk) to get Retina display on the new iPad. In ActionScript mobile projects the content is rendered beautifully on the new iPad. But with Flex Mobile projects, something is happening that causes it to render incorrectly. It's retina display alright, but the size is way too small.
    Below is an image WITHOUT the -platformsdk build tag, that causes the app to be pixel doubled to fit on the new iPad:
    Notice that it's scaled proportionally, even though the text and components are slightly pixelated. Not a big deal, but noticeable on the device.
    This image is taken with the app rendering in Retina display (setting the -platformsdk pointing to iOS 5.1 SDK):
    As you can see, the text/components are rendered really clear, but the scale is way off. Obviously it's getting the width of 2048x1536 from the device, but it's way too small.
    How do I fix this? I've tried changing the applicationDPI, but it doesn't fix it. Setting a width/height of 1024x768 does nothing either. It seems we need to overrride a behavior that causes it to fit everything in so small.
    A little help?
    Thanks,
    iBrent

    Alright, kevinkorngut's answer was the right one. It appears that even though AIR 3.x can render high resolution apps, it still returns the incorrect DPI for the new iPad. In a Flex Mobile project you have to override the DPI using the method mentioned above.
    Here are the results I got:
    Using the runtimeDPIProvider property on the TabViewApplication tag (works for any of the three project types) I created a class that extends RuntimeDPIProvider. To detect which iPad I was on, I used the following code:
    override public function get runtimeDPI():Number
         var os:String = Capabilities.os;
         if(os.indexOf("iPad") != -1)
              if(Capabilities.screenResolutionX > 2000 || Capabilities.screenResolutionY > 2000)
                   return DPIClassification.DPI_320;
              } else {
                   return DPIClassification.DPI_160;
         } else {
              return Capabilities.screenDPI;
    I'm returning a DPI of 320 as this gives the best result that matches the proportions of the device. In other words, even though the iPad DPI is 264, setting the app to 320 gives the correct size at the new Retina display.
    In order for this to work, you must compile the app with the -platformsdk flag pointing to iOS 5.1 SDK, and currently that means you need a Mac running Lion with Xcode 4.3.1. Here's the adt command I used:
    adt -package -target ipa-test -storetype pkcs12 -keystore ~/Desktop/iOS_DevCert.p12 -provisioning-profile ~/Desktop/iOS_DevProfile.mobileprovision newiPadTest.ipa newiPadTest-app.xml newiPadTest.swf -platformsdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPh oneOS5.1.sdk
    Also, the -app.xml descriptor file must have the <requestedDisplayResolution>high</requestedDisplayResolution> within the <iPhone> tags.
    Thanks everyone for their replies!
    iBrent

  • Where do I find the UI Scaling option in Photoshop CC 2014?

    I have a Companion Cintiq running Win 8.1..I am a new PS user..After searching for an answer to the tiny and unreadable text and icons on my screen and not being able to enlarge them (no, the display fix inside Windows doesn't do it), I basically found there is no answer at all from Adobe on helping us actually see the software there selling us..So in reality, I'm supposed to suck it up and be happy with what I have?..Can anybody fill me in on an upcoming fix or if there is one and I just missed it?

    If you have the newer Cintiq companion 2 CC 2014 has a 2x UI preference which may work quite well the at 1/2 resolution the display 1440 height become 720  so the single column tools bar will just not fit on the display however it will fit in two column mode.  All icons, dialog, menu bars. Pallets etc will be scaled up ins size 2x each pixel is displayed using 4 pixels to double size what is displayed.   However the image area is not scaled to 1/2 resolution so when you view image actual pixels 100% zoom you see your image at your display high resolution.
    Older companions displays were only 1920x1080 pixels  have a higher the 96ppi   but not a resolution as high as the newer model.  If the UI is to small for you you need to force Windows scaling you can have windows scale the display 1.25x or 1.5x Photoshop UI should fit however the image Photoshop displays will also be scaled by windows.  1.25 and 1.5 X are not even factor of resolution so some round artifacts.  Scaling the display also defeat high resolution yor effect have a lower resolution display.
    2x UI is an even factor of resolution there is no rounding scaling  but requires a display with 2048 x 1536 for 2x makes the ui be 1024x768 and meets Photoshop required min display size.  The work will on 4K displays 3840x2160 becomes a UI the is 1K 1920x1080.
    It was your choice to buy the display you did Wacom did not hide its size and number of pixels.  OS and Application had always run on displays the had a ppi around 96ppi. So every was programed  to work on 96 ppi displays.   When you reduce pixel size to cram in more detail into the same area you need to add pixels to UI components to display the the size the displayed on 96ppi displays.   OS and Applications were not designed with a feature like the.  The problem became evident is 2001 when IBM marketed the 204ppi 4k display its t220.  That display was very expensive so it was not widely used only used for special needs.  Only now are high resolution display affordable so now the problem is beeing addressed. But is will take time  OS and Applications will need updating.

  • Application Scaling Issue

    Hi all,
              Application is getting scaled based on the width and height of div file. But components are not getting scaled. It was working in flex3. When i moved the project from Flex3 to Flex4 with same mxml code it is not working. Please anybody help me. I was struck with this for past two days.
    Regards,
    Jayagopal.

    I would try my hands on the applications scaleX and scaleY, I guess you already know the applciations standard height and width, if the app's height and width is more than the standard height/width calculate the scaling factor from the formula NewHeight/standardHeight = scaling factor(all this calculations has to be done in the JS), do this for width also.
    Next use java script external interfaces to call a method in flex passing down the scaleX and scaleY values to it which does this.scaleX = new value and same for scaleY.
    2nd option: group has resizeMode='scale' property, if the browser size increases(i.e. app height increases/decreses) then the content in the app scales. I would wrap the whole application in this tag and tweak.

  • Resizing Text Containers Based on Size of Adjacent Image Components

    I have a strange problem related to the size of a text component. Basically in my app I have a hbox 1000 pixels wide containing an image component on the left hand side which isn't scaled and it's content is dynamic meaning that upon clicking of certain objects it changes in size and width etc as a bigger or smaller image is loaded into it. In the same hbox to the right of this I have a text area which is also populated dynamically by differing text in this way.
    The image components width and height is not set and neither is the text areas because as I say I want them to be populated dynamically but I'm going to limit the image's width by setting it's max width to 600 but what I want is as the image resizes to take up a larger portion of the h box, i want the text area to take up the REMAINDER of the hbox whilst having it's text flow onto the next lines below it. At the moment the text just seems to be flowing outside of the hbox box cutting through it to the right so to speak without going to the next line when it reaches the edge of the hbox.
    I haven't got much experience working with dynamic text. Can anyone give me any tips on this or tell me how to solve it? Thanks for any suggestions.

    Usually setting the width of the TextArea to 100% makes it occupy whatever space the Image does not occupy. Does that not work?
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • How do you transform a 2d scaled data type to a waveform data type?

    I'm using a daqcard 6024e with labview 6.1 pds. I'm modifying an example VI called Cont Acq to Spreadsheet File.vi. I wanted to run an fft on the data coming from the AI Read VI but that data is a 2d scaled array. The Array to Spreadsheet String VI which I need requires the output from the AI Read VI to be a 2d scaled array.

    Make a FOR loop with a Get Waveform Components function in there, the "Y" component will be a 1D array. Wire the Waveform array through the FOR loop to the left side of the Get Waveform Components, let it index (it will by default). Wire the 1D array from the Y component out of the FOR loop and let it index also. The result is your 2D array of DBL.
    - Dan

  • 2D Axis Scaling Bug in Reports (DIAdem 2014)

    Hello,
    I've run across a rarther annoying bug in the 2D axis scaling for Reports.  Here's how to recreate it:
    Load a dataset that has x and y components.
    Create a new layout in the Report tab
    On Sheet1, add a Simple 2D Axis System.
    Select x and y from the dataset and drag it into the 2D axis system.
    Change the scaling mode from "Completely Automatic" to "Manual."
    Change the "Begin" number to something close to the default DIAdem has set.  Do not touch the "End" number.  Click OK.
    Add Sheet2 and repeat steps #3 thru #6 on Sheet2 with a different dataset.
    Both plots look good right now...
    Go to Sheet2 and double click on the chart to bring up the Curve and Axis Definition.
    Don't touch anything...just click "Cancel."
    After clicking Cancel, the scaling of the 2D axis completely changes.  I believe what happens is that DIAdem takes whatever the previous "End" number was and uses that instead of the "End" number you want.  Also, you don't actually have to go into the Curve and Axis Definition to create this bug.  Press cancel while editing anything like text (for example)...bye bye plot.
    Moreover, if I go back in and set the scaling mode back to Auto, click preview to refresh the plot, then switch the mode to Manual, everything looks good.  However, if I copy Sheet2, the plot on Sheet2_Copy1 is messed up the same way as if I hit Cancel but Sheet2 is OK.
    Worst of all, the undo function does not work on this unwanted scaling change.
    This is a bug that makes plots in the Report files almost unusable.  I hope this is re-producable on other systems so a patch can be issued.  Let me know what you find.
    The only workaround I've found is to click OK instead of Cancel, which isn't always preferred.
    Thanks,
    Jacob
    Solved!
    Go to Solution.

    Hello jrasco,
    You are right. This is a bug in DIAdem 2014. We fixed it for the DIAdem service pack.
    This is the link to the English DIAdem 2014 SP1
    Thank you
    Walter

Maybe you are looking for

  • Uzbl, help a newbie!

    Thanks for coming in~! Prepare for newbie questions! I want to make the switch from Chromium to Uzbl for a majority of my browsing. I have used Uzbl on a live Ubuntu environment and the loading is incredibly fast. Even the initial page and all follow

  • Exhausted trying to install iTunes 5

    I just purchased an iPod mini. Already had iTunes 4 installed on my laptop running WinXP SP2. Asked to update to iTunes 5. Vanishing Lady starts. I've read similar related posts for hours trying all suggested remedies. None of them working. I am so f

  • Is there a program you can use to back up data?

    I'm doing some archiving for a engineering firm. I'm backing up all the data on dvds, but most of the files have names that are more then 110 characters long, so Nero and Roxio won't put them on a disc for that reason. Any suggestions would be apprec

  • Gradients. Exporting. Problems, oh my!

    I am trying to make a Simple Background in either Photoshop or Illustrator, and use that same background in Premiere Pro, and just have Text Rotating over top of the B/G. The Problems I am having are the colors are not matching whats on my Screen (TV

  • Looking for external hard drive for Mac book air

    I'm looking for a external hard drive for my Mac book air