donjon56
asked on
Expanding Flex area without scrollbars
I have an application with a Flex DataGrid component. When the user clicks a button it adds five visible rows to the DataGrid. That works well.
When the datagrid expands the flex application adds scroll bars to allow the user to scroll down to view the additional rows.
How can I make the application expand vertically to allow the rows to be shown without scrolling without reloading the swf?
When the datagrid expands the flex application adds scroll bars to allow the user to scroll down to view the additional rows.
How can I make the application expand vertically to allow the rows to be shown without scrolling without reloading the swf?
ASKER
Hmm... Look at this contrived example.
I want the flex application to expand within the cell and continue using the html scrollbar to scroll up and down.
I want the flex application to expand within the cell and continue using the html scrollbar to scroll up and down.
### HTML ################
<!-- saved from url=(0014)about:internet -->
<html lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!-- END Browser History required section -->
<title>${title}</title>
<script src="AC_OETags.js" language="javascript"></script>
<!-- BEGIN Browser History required section -->
<script src="history/history.js" language="javascript"></script>
<!-- END Browser History required section -->
<style>
body { margin: 0px;}
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = ${version_major};
// Minor version of Flash required
var requiredMinorVersion = ${version_minor};
// Minor version of Flash required
var requiredRevision = ${version_revision};
// -----------------------------------------------------------------------------
// -->
</script>
</head>
<body>
<table border=1>
<tr>
<td>LogoImg</td><td style="height: 100"><H1>Header Bar</H1></td>
</tr><tr>
<td style="width: 100">Left Navigation</td>
<td>
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "${swf}",
"width", "${width}",
"height", "${height}",
"align", "middle",
"id", "${application}",
"quality", "high",
"bgcolor", "${bgcolor}",
"name", "${application}",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="${application}" width="${width}" height="${height}"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
width="${width}" height="${height}" name="${application}" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</td></tr></table>
</body>
</html>
### MXML #########################
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="600" viewSourceURL="srcview/index.html">
<mx:VBox height="100%" width="100%">
<mx:Button label="Add 5 Rows" click="dg.rowCount = dg.rowCount+5"/>
<mx:DataGrid id="dg" rowCount="5">
</mx:DataGrid>
</mx:VBox>
</mx:Application>
Why you want the user to use HTML scroll bar and not Flex scroll bar after full expansion?? how will this differ?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="10%">
<mx:VBox height="100%" width="100%">
<mx:Button label="Add 5 Rows" click="dg.rowCount = dg.rowCount+5"/>
<mx:DataGrid id="dg" rowCount="5">
</mx:DataGrid>
</mx:VBox>
</mx:Application>
ASKER
I tried using your code, but the Flex application does not load when the Application height and/or width are a percentage value.
The HTML page will be longer than the typical screen resolution.
As the user scrolls, the entire html page will need to scroll. A second scroll bar in the flex will be confusing to the user..
The HTML page will be longer than the typical screen resolution.
As the user scrolls, the entire html page will need to scroll. A second scroll bar in the flex will be confusing to the user..
Sorry in the above code by mistake height was 10%, make it 100% try this and let me know, you will never get a html scroll bar when the application is exact 100%, can you show me a screen shot if you are getting so.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%">
<mx:VBox height="100%" width="100%">
<mx:Button label="Add 5 Rows" click="dg.rowCount = dg.rowCount+5"/>
<mx:DataGrid id="dg" rowCount="5">
</mx:DataGrid>
</mx:VBox>
</mx:Application>
ASKER
I didn't notice your HTML code,
by the way how are you passing these $ parmas?
<object classid="clsid:D27CDB6E-AE 6D-11cf-96 B8-4445535 40000"
id="${application}" width="${width}" height="${height}"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="${swf}.swf" />
also one more question why don't u do the whole thing in flex instead of half HTML and half flash?
by the way how are you passing these $ parmas?
<object classid="clsid:D27CDB6E-AE
id="${application}" width="${width}" height="${height}"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="${swf}.swf" />
also one more question why don't u do the whole thing in flex instead of half HTML and half flash?
ASKER
Via Flex Builder.
Same result when I replace placeholders with with actual values.
Same result when I replace placeholders with with actual values.
ok let me explain you a little clearly,
you are just embedding a swf file in html and if you want the html to show the scroll bar based on the height and width of your growing flash file (data Grid) the height of that TD must also increase proportionally. I am not sure if you can use flash object to increase the size of the TD may be you need to use some java script function to which you will pass the new height and width of the datagrid and which updates the TD height accordingly.
Instead of depending on Java script you can put you logo and header bad completely in to flex app and no need of any HTML code at all. you can do the whole thing in flex it self, if you still want to go with html approach let me know.
you are just embedding a swf file in html and if you want the html to show the scroll bar based on the height and width of your growing flash file (data Grid) the height of that TD must also increase proportionally. I am not sure if you can use flash object to increase the size of the TD may be you need to use some java script function to which you will pass the new height and width of the datagrid and which updates the TD height accordingly.
Instead of depending on Java script you can put you logo and header bad completely in to flex app and no need of any HTML code at all. you can do the whole thing in flex it self, if you still want to go with html approach let me know.
you may have to use External Interface
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001008.html
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001008.html
ASKER
Actually this is a contrived example. The flash file must reside in an existing Sharepoint Template. If I can make it work in the example HTML. I can make it work in the template.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
At first, it seemed to work pretty well.
After 5 clicks of the Add Rows button the datagrid went off the bottom of the grid.
Any ideas why it is doing that?
Capture.JPG
After 5 clicks of the Add Rows button the datagrid went off the bottom of the grid.
Any ideas why it is doing that?
Capture.JPG
>>datagrid went off the bottom of the grid.
couldn't get u, can u explain a little more of whats happening?
couldn't get u, can u explain a little more of whats happening?
ASKER
After 5 clicks of the button the VBox the data grid was in was larger than the HTML div.
if u see my code I am increasing the size of complete table no just that TD, are you getting your HTML scroll bar?
you may like to follow this
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000517.html