tags:

views:

316

answers:

3

Hi,

I am trying to increase the height of container with increase in the number of contents inside the container. Like in my case i m using tileList inside tabNavigator , when I put contents inside the tileList, the height of tileList does not increase beyond vertical height of the viewport. It puts scrollbar on the container. I want to increase the height of an flex container with increase in the contents and introduce scrollbar on the browser with increase in contents in the flex container.

Could anybody please suggest me how I could achieve this.

Thanks in advance.

A: 

You need to write a javascript function which increases the height of embed object and you need to call this javascript method from flex while adding a new item to tile list.

This link explains how to access javascript from flex.

Umesh
i had tried to do this.. but didnt find it robust solution if my tileList have say 200 odd records... so was wondering isn't there any direct way to do the same as we do in HTML...
shruti
If you want to change the embed object's(SWF's) height and width dynamically, I dont know any other way than javascript. And what is the reason behing saying its not robust? and what you exactly mean by "same as we do in HTML" -like Ajax? can you give samples?
Umesh
same as we do in html meaning : when we put any content in the DOM container, the container takes up the auto height and width, whereas here it is not taking auto height and width. It either takes 100% that equals to the browser's dimensions or hardcoded. Isn't there any way in flex that will put auto height and width to the container.
shruti
AFAIK flex has auto height if you didnt specify the height explicitly. But there is an intermediate layer between HTML and your flex application which is flash player and that is the thing which takes either 100% that equals to the browser's dimensions or hardcoded and not flex.
Umesh
So if the flex application is morethan that player dimentions, it will show scroll (for applicaiton not browser one). If you want scroll for browser, you need to increase the size of flash player(embed object). Since HTML cannot understand the new height of your flex application, you need to communicate with html using javascript to make it know the new height after your flex application is resized.
Umesh
okk thanks Umesh.. now I am communicating with javascript to introduce the Scrollbar on the browser but for some reason IE is not taking my new height which I am passing through javascript.
shruti
Can you post your javascript code that you used for resizing?
Umesh
hey it is working now... thanks alot!!
shruti
A: 

Have considered using javascript and resize the element directly in the source HTML? The JS code could look something like that:

function changeSize(id) {
    var flex = document.getElementById(id);

    flex.setAttribute("width", "800");
    flex.setAttribute("height", "600");
}
A: 

But the given solution is not a generic solution, Every time you compile the code you need to edit the html file and add the javascript code . Is there any other better solution?

Prashant Dubey