5 Replies Latest reply on Feb 10, 2009 12:04 PM by Peter Lorent

    Scaling Flex Components

    jeffreypritchard Level 1
      I'm a Flash developer, and I have a lot of graphical content stored in my Flash project libraries that I intend to integrate into my Flex project. I've downloaded the extension that allows me to export a swc as a Flex component. That all works fine, but I can't seem to scale the objects properly (specifically using the scaleX and scaleY).

      From what I can gather the reason why has to do with the way Flex handles content in it's individual containers, but I still can't seem to grasp how I can get my graphics to scale to the size I need them.

      There are probably over a hundred MovieClip objects (linked to AS3 classes for controlling their appearance and behavior) in my .fla libraries that I need to use, but this is a major obstacle right now. I realize it is going to be tedious to convert them all over to Flex components, but the graphics are required for the app.

      I know I can't be the only one to try to do this, but I'm at a loss for how to get this accomplished. I haven't been using Flex that long, so if this is a stupid question, I apologize.

      Any guidance on where I can find out what to do would be appreciated.
        • 1. Re: Scaling Flex Components
          Peter Lorent Level 2
          Adding the attached override to the class that is connected to the Flash symbol seems to resolve this.

          • 2. Re: Scaling Flex Components
            jeffreypritchard Level 1
            Hi Luigi,

            I've been away from the Flex Component Kit work for a while, but now I'm back into it, and I've still got an issue with the scaling of components coming from Flash (CS3). Ideally I'd like to be able to scale my components dynamically, and I understand that overriding the setActualSize will work, but is there a better way to scale the content based on the container the component is in (HBox, VBox, etc), perhaps some way to do percentage scaling (scaleX, scaleY).

            By using setActualSize(), it seems like I would have to manage the listeners for the stage resizing, which seems like fly swatting with a hammer if you know what I mean. My goal is just to have my components resize, without distortion (maintaining the aspect ratio of the original) .

            Many thanks in advance.

            • 3. Re: Scaling Flex Components
              Peter Lorent Level 2
              As far as I know either a BoundingBox (added in Flash) or setActualSize() enable scaling (or any other type of animation for that matter).
              • 4. Re: Scaling Flex Components
                jeffreypritchard Level 1
                Hi Luigi,

                I've added a symbol named boundingBox to the symbol being converted, but I'm not sure how that affects scaling. I know it sets the bounds of the component so Flex knows where the components boundaries are, but other than that it doesn't seem to affect anything.

                All I really want to do is emulate the StageScaleMode.SHOW_ALL that is in flash (scale up and down with parent container without distortion).

                Am I missing something ? Thanks again for your time. I really don't mean to be a pest.
                • 5. Re: Scaling Flex Components
                  Peter Lorent Level 2
                  Then - as far as I know - you need to use setActualSize() in the class that is connected to the Flash symbol, as posted.
                  No time now, but I'll fiddle with it a bit and if I find something, will post here.