4 Replies Latest reply on Aug 19, 2008 8:26 AM by Newsgroup_User

    Dynamic Icon Buttons From XML datasource

    mrmonto
      Hello eveyone,

      I was wondering if it is possible to embed a button Icon from an xml datasource node. The buttons are located in an Hbox, in a component called thumbnail.mxml. The thumbnail.mxml is the item renderer for my tilelist.mxml. I was trying the following code in my component:

      <mx:Button label="{data.title}" labelPlacement="bottom" fillColors="[#ffffff, #ffffff]" id="button" icon="@Embed('{data.logos}')"/>

      The button labels work, but I get an error for the icons. Is this even possible to do? I have spent alot of time trying to figure this one out. Please help. Thanks!
        • 1. Re: Dynamic Icon Buttons From XML datasource
          Level 7

          "mrmonto" <webforumsuser@macromedia.com> wrote in message
          news:g8cv21$76u$1@forums.macromedia.com...
          > Hello eveyone,
          >
          > I was wondering if it is possible to embed a button Icon from an xml
          > datasource node. The buttons are located in an Hbox, in a component
          > called
          > thumbnail.mxml. The thumbnail.mxml is the item renderer for my
          > tilelist.mxml.
          > I was trying the following code in my component:
          >
          > <mx:Button label="{data.title}" labelPlacement="bottom"
          > fillColors="[#ffffff,
          > #ffffff]" id="button" icon="@Embed('{data.logos}')"/>
          >
          > The button labels work, but I get an error for the icons. Is this even
          > possible to do? I have spent alot of time trying to figure this one out.

          http://www.quietlyscheming.com/blog/2007/01/23/some-thoughts-on-doubt-on-flex-as-the-best- option-orhow-i-made-my-flex-images-stop-dancing/


          • 2. Re: Dynamic Icon Buttons From XML datasource
            Level 7

            "mrmonto" <webforumsuser@macromedia.com> wrote in message
            news:g8cv21$76u$1@forums.macromedia.com...
            > Hello eveyone,
            >
            > I was wondering if it is possible to embed a button Icon from an xml
            > datasource node. The buttons are located in an Hbox, in a component
            > called
            > thumbnail.mxml. The thumbnail.mxml is the item renderer for my
            > tilelist.mxml.
            > I was trying the following code in my component:
            >
            > <mx:Button label="{data.title}" labelPlacement="bottom"
            > fillColors="[#ffffff,
            > #ffffff]" id="button" icon="@Embed('{data.logos}')"/>
            >
            > The button labels work, but I get an error for the icons. Is this even
            > possible to do? I have spent alot of time trying to figure this one out.
            > Please help. Thanks!

            Oops. wrong link. Try
            http://blog.xsive.co.nz/archives/233


            • 3. Dynamic Icon Buttons From XML datasource
              mrmonto Level 1
              Thanks for the response, but it still doesn't answer my question. I am trying to pull the embed source of a button icon from the xml ("<logos>" node). I don't want to set the embed source to one specific file in the application for all the buttons. My tilelist is made up of multiple buttons that are dynamically created from xml (title, description, and logo). Here is a chunk of my xml:

              <?xml version="1.0" encoding="utf-8"?>

              <dsApps xmlns=" http://tempuri.org/dsApps.xsd">
              <Apps>
              <id>1</id>
              <title>ORACLE Application</title>
              <description>This is a test</description>
              <logos>oracle_logo.gif</logos>
              <Buttons>
              <btn_title>Oracle Login</btn_title>
              <url> http://www.sandia.gov</url>
              <app_id>1</app_id>
              </Buttons>
              <Buttons>
              <btn_title>Oracle News</btn_title>
              <url>www.espn.com</url>
              <app_id>1</app_id>
              </Buttons>
              </Apps>

              I want each button to have its unique icon based on what is in the <logos> node? Hope this is more clear? Thanks!
              • 4. Re: Dynamic Icon Buttons From XML datasource
                Level 7

                "mrmonto" <webforumsuser@macromedia.com> wrote in message
                news:g8eni8$gu2$1@forums.macromedia.com...
                > Thanks for the response, but it still doesn't amswer my question. I am
                > trying
                > to pull the embed source of a button icon from the xml ("<logos>" node).
                > I
                > don't want to set the embed source to one specific file in the application
                > for
                > all the buttons. My tilelist is made up of multiple buttons that are
                > dynamically created from xml (title, description, and logo). Here is a
                > chunk
                > of my xml:
                >
                > <?xml version="1.0" encoding="utf-8"?>
                >
                > <dsApps xmlns=" http://tempuri.org/dsApps.xsd">
                > <Apps>
                > <id>1</id>
                > <title>ORACLE Application</title>
                > <description>This is a test</description>
                > <logos>oracle_logo.gif</logos>
                > <Buttons>
                > <btn_title>Oracle Login</btn_title>
                > <url> http://www.sandia.gov</url>
                > <app_id>1</app_id>
                > </Buttons>
                > <Buttons>
                > <btn_title>Oracle News</btn_title>
                > <url>www.espn.com</url>
                > <app_id>1</app_id>
                > </Buttons>
                > </Apps>
                >
                > I want each button to have its unique icon based on what is in the <logos>
                > node? Hope this is more clear? Thanks!

                I take it you didn't read this link that I sent?

                http://blog.xsive.co.nz/archives/233

                Here is another link that has given some people success

                http://blog.benstucki.net/?p=42

                Hope this is more clear?

                You're welcome