6 Replies Latest reply on Dec 29, 2006 4:28 PM by pedro123penduko

    Using a Tree to display images

    LukeSkope
      Ok, so I'm pretty new to Flex, here's my problem

      I have a tree whose branches and leaves are defined in actionscript like this
      [Bindable]
      private var xml:XML =
      <root label="Shows">
      <show label="show1">
      <char label="character1"/>
      <char label="character2"/>
      </show>
      <show label="show2">
      <char label="character1b"/>
      <char label="character2b"/>
      </show>
      </root>

      I have an HDividedBox with 2 panes, one containing the tree and the other containing an image. I want the image to be relevant to the selected leave, so selecting character1 in the tree will display a picture of character 1, etc.

      Can someone help? I will post my entire code if someone thinks that will help.

      Thanks
      Luke.
        • 1. Re: Using a Tree to display images
          ntsiii Level 3
          First, this is not a Flex Builder question, so it should go in the General Discussion forum, not here.

          Do you have your image display code working? If so, then driving it with the tree should be pretty easy.

          Tracy
          • 2. Re: Using a Tree to display images
            LukeSkope Level 1
            How is it not a Flex Builder question?

            Flex Builder is the program I am using to write the code, what's the problem?

            Yes, it should be pretty easy, obviously I am having trouble getting this seemingly easy task to work.

            I can get it to work with buttons & with an accordion, with both images and FLV video in a view stack, and by changing the source on a click event, but for some reason the tree method is not working.

            Don't bother posting anything if you're not going to attempt to help.
            • 3. Re: Using a Tree to display images
              ntsiii Level 3
              Flex Builder is an IDE, a fancy code editor. Flex is a language. This is analagous to Visual Studio, an IDE, and C#, a language, or Notepad, an editor, and English, a language.

              The Flex Builder 2 forum is intended for questions regarding The Flex Builder IDE. The Flex General Discussion Forum is intended for discussions about Flex, the language.

              It is to your benefit to post in the correct forum, since you will be more likely to get help. Many Flex users do not use Flex Builder at all, and may not be watching this forum.

              Regarding your issue, set a handler function on the Tree's change event. In that handler, access the item value that you need to identify the image, and then call the function that sets the image source, passing in the image identifier.

              Are you doing something along these lines? What is not working?

              Tracy
              • 4. Re: Using a Tree to display images
                upshotvideo Level 1
                What would someone ask about the IDE? Are the components part of the IDE or part of the language? I just can't imagine that many people would ever know not to post in this section.
                • 5. Re: Using a Tree to display images
                  ntsiii Level 3
                  Components are part of the language/framework.

                  There are plenty of valid Flex Buider 2 questions posted here. Many people know where to post their questions. Compare the traffic in General Discussion to the traffic here.

                  Quit playing dumb and head over to General discussion.

                  Tracy
                  • 6. Using a Tree to display images
                    pedro123penduko
                    Regarding your issue, set a handler function on the Tree's change event. In that handler, access the item value that you need to identify the image, and then call the function that sets the image source, passing in the image identifier


                    Can you provide a working example?
                    Thanks!