A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: TileList [Resize Height] Problen [Flex 3]

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    46

    Angry TileList [Resize Height] Problen [Flex 3]

    Hello Guys
    Im using a [Scroll-less] TileList for displaying images. I attached an ArrayCollection as a dataprovider.
    I want that TileList will resize its height on RunTime, according to the number of Images (as i dont want Scrollbars but Its Height).
    Please guide, how can i do that
    Thanks in advance.

  2. #2
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,987
    Lemme ask... you have a "stacked list" that builds within a field and sometimes your list - let's say if it's 5 lines instead of 4 - that 5th line might be obscured?

    [ Hello ] | [ gerbick ] | [ Ω ]

  3. #3
    Member
    Join Date
    Dec 2007
    Posts
    46
    Thanks for your reply

    Yes, It shows only 4 rows and the rest is hidden, i use mouse middle button to scroll the whole list [as scrollpolicy is off]
    i want to change its heigh according to the images.
    e.g. if there are 10 rows and each image heigh is 100px then Tilelist should resize its height according to rows/images
    which will be 100x10 = 1000 height.

    Please help me in this regard
    Thanks once again

  4. #4
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,987
    Without seeing your code, you could have used a few methods... for instance, I ran into an incident where I was using a ViewStack, and within that ViewStack, I had a Canvas (hidden unless it returned results via ArrayCollection) that had a ButtonScrollingCanvas, within it a HBox, that held my Repeater and I treated each return as a LinkButton.

    Each LinkButton would use the Repeater.currentItem as String to fill the "box", then scale the height which as set as simply "100%" and set my variableRowHeight="true".

    It "worked", I could still trip it up by providing data in just one repeater within that ButtonScrollingCanvas as one line - all my returns had to be expanded to two lines to avoid that.

    I do remember that being a problem.

    Care to snip/paste that bit of code around your return results perhaps?

    [ Hello ] | [ gerbick ] | [ Ω ]

  5. #5
    Member
    Join Date
    Dec 2007
    Posts
    46
    Code for Tilelist
    Code:
    	<mx:VBox width="490" height="">
    		<mx:TileList id="myTile" dataProvider="{projects}">
    			<mx:itemRenderer>
    			 <mx:Component>
    			 	<comps:thumbnail/>
    			 </mx:Component>
    			</mx:itemRenderer>
    		</mx:TileList>
    	</mx:VBox>

    Code for Component
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="150" height="100" horizontalAlign="center" horizontalScrollPolicy="off" verticalScrollPolicy="off" verticalGap="0">
    	<mx:Image height="75" source="port/{data.src}" width="100"/>
    	<mx:Label text="{data.name}"/>
    </mx:VBox>


    VBOX gets height automatically according to TileLIST
    but TileLIST doesnt resize its height according to the data. as i mentioned last.

    Thanks

  6. #6
    supervillain gerbick's Avatar
    Join Date
    Jul 2000
    Location
    undecided.
    Posts
    18,987
    You're locking each Image (port{data.src}) to 75 max height, no? your myTileList acts a bit differently when you change the height to 100%, no?

    I'm only able to fake an array coming in to this - I pointed to a few pictures, but I grabbed the entire VBox and wrapped it into a Canvas, which I allowed to add a scroller to.

    Gimme a moment on this one though. I just got handed some other work that needs to be pushed out.

    [ Hello ] | [ gerbick ] | [ Ω ]

  7. #7
    Member
    Join Date
    Sep 2002
    Location
    Seattle
    Posts
    93
    I stopped by earlier and you had no solution yet.
    So I took your code and made you an example of my own.

    I do not know how you acquire your data so I used my favorite, XML.

    The example reads in the XML file for your data provider as a ListCollection AND its length is used to determine your 'height'.

    Code:
    <mx:HTTPService id="image_db_xml"
    	url="./image_db.xml"
    	makeObjectsBindable="true"
    	fault="Alert.show('Image data acquisition failed.\nTry refreshing your browser.','Data Error')" />
    
    <mx:VBox width="490" >
    	<mx:TileList id="myTile" columnCount="1" verticalScrollPolicy="off"
    			dataProvider="{image_db_xml.lastResult.data.image}"
    			height="{image_db_xml.lastResult.data.image.length*104+4}" >
    		<mx:itemRenderer>
    		 <mx:Component>
    		 	<comps:thumbnail/>
    		 </mx:Component>
    		</mx:itemRenderer>
    	</mx:TileList>
    </mx:VBox>
    The TileList has a vertical spacer of some 4 pixels I think ...so,
    the height calculation is like:
    itemCount * ( 100 + 4 ) +4

    Well attached is a project zip (Flex3).
    Attached Files Attached Files

    Bye now,

    Greg

  8. #8
    Member
    Join Date
    Dec 2007
    Posts
    46
    @gerbick
    Thanks for your Reply

    @Greg
    Thanks a lot, You are the real Champ Bro


    New Problem
    Im using ArrayCollection and i perform filter functions on it.
    So i use a bindable varibale for height as following

    tileHeight = 117 * (photos.length/3);

    where each component is 117 height. i want to show 3 rows in the view at a time.
    Code works perfect [Thanks to Greg]

    Im using Mouse to scroll up and down. Its like scroller where tilelist goes up and down in the vbox according to my mouse.

    Problem is. It displays only 25 Items. not the complete 32
    But when i disable bindable height and use mouse wheel on tilelist, it works good

    I think the problem is tilelist doesnt know that it is being scrolled. Need to update its display
    But i dont know HOW

    Please Help
    Thanks in advance

  9. #9
    Member
    Join Date
    Sep 2002
    Location
    Seattle
    Posts
    93
    OK, U R welcome.

    Now this is a whole new question and should be a thread of it's own.
    No one will find it here to help.

    At that issue though, I think that you need to make a "display" component, say a modified canvas, that allows you to layout your renderer instances and then recalculate its own height. This is done by overriding the protected function 'measure' .... and most likely the 'updateDisplayList' too.

    But first move this to a new thread/question and appropriately title it.
    You can copy this link and reference it from your new thread if needed.


    gsb

    Bye now,

    Greg

  10. #10
    Member
    Join Date
    Dec 2007
    Posts
    46
    Thanks a lot
    That problem is automatically got a solution
    I dont know why it wasnt showing the whole data
    but now its working fine
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center