8/11/2010 9:56:44 PM
Title:
Dynamic Application
Hi all..
Does flex really has limitations or rather i'm wrong??
I, initially had set my application height as 500(say) and would like the application to increase in height as data increases.. is this possible??
I mean the html page should not have scrollbar initially when the data is less and as data increases the scrollbars should appear and the application height should increase which implies that the div size should also increase dynamically to accomodate the application!...
The main problem of having fix the application height and div height is when the data is less there seems to be huge empty space which doesn't look good in a web world!
Hoping for a positive response.
Note: i work in flex 4
Davis
Points: 780
Posts:0
8/11/2010 10:54:53 PM
why don't you just use the scrollbar inside the flash rather than using the html scrollbar, You can disable the scrollbars from html and keep the swf file height fixed. The scrollbars will automatically appear inside flex when data exceeds
8/11/2010 11:10:20 PM
there is no such direct way , you can get the height of content from inside flex and call a JavaScript function which should change the swf height. To call JavaScript function from flex use the externalInterface class. Like when you add a new content in flex or change the content send a call to JavaScript to set new height for swf
8/11/2010 11:21:02 PM
Hello All,
You can control your SWF height in HTML file.
You can dispatch resize event from flex and in that you can call JavaScript method to increase or decrease the height of SWF file.
hope this shows some light to you.
Regards,
8/11/2010 11:24:04 PM
@davis: that seems to be a good option.
@mark: the point is not only using externalinterface , i should also be able to dynamically change the div size. i tried changing the div size and it increased the size but the increased size is not of any use as the color i have set for the application background doesn't seem to extend to the new height.
for ex : if my app height was 200 initially with white background color and now if i increase the div height to 500, the app's background color is white for 200 and the remaining 300 has the default color. i'm unable to change or grow the app according to div.
it would b better if ther is a sample snippet to just change the div and app size on any action(say a button click)
8/12/2010 12:10:01 AM
you need to change the height of swf also not just div
below code should work
//ebmed the swf using this code
<object type="application/x-shockwave-flash" data="main.swf" width="100%" height="100%" id="myFile">
<param name="movie" value="main.swf">
<param name="scale" value="noscale">
<param name="menu" value="false">
<param name="quality" value="high">
<h3>No flash plugin</h3>
<br>Please install <a href="http://www.macromedia.com/go/getflashplayer" target="_blank">FLASH plugin</a>.
</object>
//javascript code in html
<script type="text/javascript">
function Resize(ID,number) {
document.getElementById(ID).height=number;
}
</script>
//to test from html use this
<a href="#" onClick="Resize('myFile',800)">Change height to 800</a>
//you can use getURL or externalInterface
getURL("javascript:Resize('myFile',800);");
8/12/2010 12:30:07 AM
Thanks mark.. i'll try that :)