5 Replies Latest reply on Nov 10, 2010 12:30 PM by mattcom

    I dont even know what to name this :P



      Hey all


      So, I have 2 components (though there may be more) that are not visible by default. I would like to make these components become visible with the click of a single button.... so i was thinking that this can be accomplished by making everything named "ComNotes_XXXXX" equal to visible, but to be honest I have no idea if this is even possible, or where to start looking at how this can be done.


      Any ideas would be greatly appreciated!





      d:userLabel="Layer 1">



      <components:ComNotes_masthead x="300" y="100" visible="false"/>







      d:userLabel="Layer 2">





      <components:ComNotes_footer x="300" y="100" visible="false"/>





        • 1. Re: I dont even know what to name this :P
          Shongrunden Adobe Employee

          Sounds like you will want to assign an id to each of these components that way you can reference them and switch their visible property to true, for example:


          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                      protected function button1_clickHandler(event:MouseEvent):void {
                          component1.visible = true;
                          component2.visible = true;

              <fx:DesignLayer  d:userLabel="Layer 1">
                  <components:ComNotes_masthead id="component1" x="300" y="100" visible="false"/>

              <fx:DesignLayer d:userLabel="Layer 2">
                  <components:ComNotes_footer id="component2" x="300" y="100" visible="false"/>
              <s:Button label="make visible" click="button1_clickHandler(event)" />
          1 person found this helpful
          • 2. Re: I dont even know what to name this :P
            drkstr_1 Level 4

            If I understand correctly what you're trying to do, you want to make 1-n components visible/invisible without having to reference each one individually? If that's the case, it sounds like the perfect job for binding.


            private var _showComNotes:Boolean;
            <components:ComNotes_foo visible="{_showComNotes}" />
            <components:ComNotes_bar visible="{_showComNotes}" />


            Set _showComNotes to true or false and the value will copy over to anything bound to it.

            • 3. Re: I dont even know what to name this :P
              dfsafdf434 Level 1

              Hey guys... thank you very much for the quick replies! I am obviously a little lost in this, but I am trying to learn.





              Thats def along the lines of what I am trying to accomplish. However, because the code I am working with is coming from my classmate whom is using Flash Catalyst, I would like to see if it is possible to work with this existing line without editing it in anyway. My reason for this is because FC doesn't allow code editing, the only control he has is over this is the component name (ComNotes_XXX), and because there could be multiple components on a single page, I would rather not have to go in and edit them all when I start working on things in Builder. ALTHOUGH... I could just do a simple search and replace... hmmmmm.


              Again... I don't even know if this is possible, I really appreciate everyone's assistance! :-) 



              <components:ComNotes_masthead x="300" y="100" visible="false"/>

              • 4. Re: I dont even know what to name this :P
                drkstr_1 Level 4

                You could have him create a state in Catalyst that sets all of the components visibility. You can control in Actionscript when to change to that state. Other than that, there really isn't much you can do without modifying the code.

                • 5. Re: I dont even know what to name this :P
                  mattcom Level 1

                  Flash catalyst generates the MXML code that he can send to you and you can edit it in Flex.  Or at least that's my understanding of Flash Catalyst, based on the video tutorials in the past.  It seems to me that Flash Catalyst does nothing but create Flex apps which can be edited.