• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Problem with movieclip height

Contributor ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

I faced one problem with movieclip height. Actually I created a moveiclip which is having 4 labels, 1 textinput, 1 textarea, 1 button (all these are components). The height of the movieclip is 280. I added this movieclip to another movieclip for displaying it onto the stage. At that time height of the movieclip is 337.5. I want to know the reason for why the height is changed? Anyone please help me.

and my code is as follows:

import flash.display.MovieClip;

var mc:MovieClip = new MovieClip();
addChild(mc);

for(var i:int=0;i<2;i++)
{
var cell;
if(i == 0)
{
  cell = new email_cell();
}
if(i == 1)
{
  cell = new details_cell();
}
cell.x = 20;
cell.y = mc.height;
mc.addChild(cell);
trace(cell.height);
trace(mc.height);
}

Both email_cell and details_cell height is changed.

TOPICS
ActionScript

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

Are you saying that the line trace(cell.height); indicates a value greater than what you believe the height is (280)?

What value of height does it trace is you just manually add an instance to the stage?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

ya i manually added an instance to the stage.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

according to my i got the output as follows:

337.5 - cell.height for i=0

337.5 - mc.height

197.5 - cell.height for i=1

535 - total mc height (cell height for i=0 + cell height for i=1)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

If the manually placed instance still measures 337.5 then chances are that is its true height.  If you can show a screenshot of the offending movieclip, I can probably recreate it to see if I get the same result and then maybe determine which object within it it might be creating height that you can't see.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

email_cell.jpg

This is email_cell and

details_cell.jpg

This is details_cell.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 13, 2012 Apr 13, 2012

Copy link to clipboard

Copied

Here's what I have concluded... the label elements are what are causing the problem, the one inside the button component being the contributor to the 337.5 value.  If you were to remove that button I am guessing you would still see something around the 311 height value due to the label above the button.

I cannot answer why this is the case, but that's what it is.  The labels apparently carry some unseen baggage.  I generally avoid using components for a few reasons... they tend to weigh too much byte-wise, some can be a pain to manage, and then they go and pull stuff like this.

What I did to investigate this is to place each component on a separate layer in the movieclip and made each layer a guide layer.  Then I gradually changed them back and watched the height values reported by your code.

You options for a solution...

1) don't use labels or button components... use textfields and button symbols (ones you create yourself)

2) create the backgrounds as movieclips and use those to find the height.

3) assign some property to the movieclips for their height values and use those instead of the height you read as a property.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 15, 2012 Apr 15, 2012

Copy link to clipboard

Copied

Thank you so much for your answer that helps me alot.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 16, 2012 Apr 16, 2012

Copy link to clipboard

Copied

LATEST

You're welcome

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines