Jump to content

Gary Griswold

Liquid Stage and Display Object that changes size with content

Recommended Posts

I am just starting to use LiquidStage and have been able to get it to do most things that I need, but I have buttons placed at the bottom right corner of a DataGrid.  The buttons need to move when the DataGrid changes in height.  This change in height often occurs because the number of rows being displayed changes.


I have used a DynamicPinPoint to return the bottom right corner of the data grid, and this works very well when the window is resized, but if the DataGrid content changes the DynamicPinPoint function is not getting called.  Is there something I can do with a resize event when the content in the DataGrid changes?


The following is my DynamicPinPoint code:



var assocCorner:Point = associateGridCorner();

associateBtns.x = assocCorner.x - associateBtns.buttonsWidth;

associateBtns.y = assocCorner.y + 5;

var assocPoint:DynamicPinPoint = new DynamicPinPoint(this, associateGridCorner);



private function associateGridCorner() : Point {

    var botX:Number = associateGrid.x + associateGrid.width;

    var botY:Number = associateGrid.y + associateGrid.height;

    return(new Point(botX, botY));


Link to comment
Share on other sites

I wish I had a great answer for you, but unfortunately I don't - I'm not familiar with DataGrids. LiquidStage wasn't really meant for that type of usage. :(

Link to comment
Share on other sites

The problem that I am describing is not just a DataGrid problem, it would occur anytime there are display objects that change in size as a result of changes of content.  Another example would be a text box whose content changes, so that other display objects just below the text box need to move up or down.


The DynamicPinPoint gets the position correct just as soon as one changes the size of the window slightly.  The trick might be to fire an event at the point when the Display Object's size changes in order to get the LiquidStage to recompute positions at that moment.  I see in the LiquidStage code that it uses flash.events.Event.RESIZE, and I was thinking the correct solution might be to dispatch a resize event at the point when a child Display Object has changed size.  But, my trial and error attempts have not yet worked.


Is there a way to do this?

Link to comment
Share on other sites

I found the solution.  I just need to call update() on the liquidStage at the point when the display object size changes.  Great job, Jack.

  • Like 1
Link to comment
Share on other sites

Excellent, glad you figured that out. I should have suggested that in the first place :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.