3 Replies Latest reply on Jul 27, 2008 3:58 AM by fakitol

    Custom Component  Alter appearance in design mode via properties

    Halsafar
      I have a custom component (mxml) with an (AS) file to handle its code. This is all fine, works. The problem here is the component is heavily reused and in some cases needs to have its appearance changed. I would like to be able to do this in design mode. So when I add the component to a canvas in design mode, I should be able to click the component, go toggle one of its properties and actually see the change. Like many of the other flex components do.

      I cannot figure out how, I am curious if this is even possible. It would require some kind of design mode processing events...

      Thanks,
      Stephen
        • 1. Re: Custom Component  Alter appearance in design mode via properties
          Halsafar Level 1
          I know how to add properties to the custom component and be able to see them in design mode under the property listing (A-Z). I can toggle them false, true for a boolean example. However changing them does nothing. Can design mode process events or something? How does other flex components change their appearance in design mode based on changing a property?
          • 2. Re: Custom Component  Alter appearance in design mode via properties
            Level 7

            "Halsafar" <webforumsuser@macromedia.com> wrote in message
            news:g6dctg$65o$1@forums.macromedia.com...
            >I know how to add properties to the custom component and be able to see
            >them in
            > design mode under the property listing (A-Z). I can toggle them false,
            > true
            > for a boolean example. However changing them does nothing. Can design
            > mode
            > process events or something? How does other flex components change their
            > appearance in design mode based on changing a property?

            Is this what you want?

            http://blogs.digitalprimates.net/codeSlinger/index.cfm/2007/4/9/Ah-design-view


            • 3. Re: Custom Component  Alter appearance in design mode via properties
              fakitol
              Your component must be compiled to swf and added to your project as a swc library.
              Use "New --> Flex Library Project" and just copy-paste your component in your new library project, then build it(if it did not do that automatically). Now in your library project build path you have a swc file. In your other project you should go to that project properties, then "Buil Path" then "Library Path", and you'll see there "Add SWC..." button, then you add your swc from library project. From now your component must appear in "Custom" category in "Components" explorer and theoretically(sometimes even practically:)) it must properly change in Design View.
              This method works rather nice especially when the custom component has proper implementation, like any other UI component from the flex framework(see "Implementing component" in flex help).

              P.S. There are problems with Builder's Design Mode when using something custom like your own component or your own theme, i hope there won't be such problems in Flex 4 Gumbo..