3 Replies Latest reply on Jan 27, 2010 6:53 AM by jimmyoneshot

    How to use HTML Components within A Tilelist

    jimmyoneshot Level 1

      How is it possible to use HTML components within a tilelist component and still have them display normally? I have created several html components that each have different locations which therefore show an image of the site which is at that location but I want to somehow put these images/html components into an array collection/data provider which will be assigned to the tilelist and they will then display inside this tilelist but I can't figure out how to get this to work.

        • 1. Re: How to use HTML Components within A Tilelist
          jimmyoneshot Level 1

          Can anyone help me out on this? Here's the code for my tilelist but the html components simply will not

          dsplay once they are in the tilelist:-

           

           

           

           

          <mx:TileList x="0" y="0">

           

           

           

          <mx:HTML location="http://www.google.com/" width="300" height="300"/>

           

          <mx:HTML location="http://www.yahoo.com/" width="300" height="300"/>

           

           

          </mx:TileList>

          • 2. Re: How to use HTML Components within A Tilelist
            durbonix Level 1

            I believe you need to use a dataprovider and an itemrenderer for this to work. The dataprovider would be an array collection of your urls and the itemrenderer would display them for you. For example, change your tilelist as follows:

             

            <mx:ArrayCollection id="arrColl">
                    <mx:source>
                        <mx:Array>
                            <mx:Object location="http://www.google.com/" />
                            <mx:Object location="http://www.yahoo.com/" />
                        </mx:Array>
                    </mx:source>
                </mx:ArrayCollection>

            <mx:TileList x="0" y="0" dataProvider="{arrColl}" itemRenderer="com.renderer.HTMLRenderer" />

             

             

            And then create an itemRenderer (in this case I named it HTMLRenderer and put it in com.renderer):

            <?xml version="1.0" encoding="utf-8"?>
            <mx:HTML xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" width="300" height="300">
                <mx:Script>
                    <![CDATA[
                       
                       
                        private function init():void
                        {
                            this.location = data.location.toString();
                        }
                    ]]>
                </mx:Script>
            </mx:HTML>

            • 3. Re: How to use HTML Components within A Tilelist
              jimmyoneshot Level 1

              That works great mate. Thank you very much.

               

              I now need to scale the images produced by the html components so the images themselves are 100 x 100 and also make them non interactive so users can't use the sites themselves within them but I'll start a new post for that. Thanks.