# Issue with dynamic resizing

**URL:** https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423
**Category:** flash
**Created:** [June 15, 2008, 11:39pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423 "2008-06-15T23:39:44Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 15, 2008, 11:39pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/1 "2008-06-15T23:39:44Z")

</div>

I am pulling a blog into flash through an XML sheet. I have a clip in the library that gets attached per blog entry. The issue I am having right now is not all the posts are the same length so I am trying to adjust the clips background to the height of the post text box, but they are all reading as the same height so they aren’t properly adjusting. I even have the text boxes set to autoSize = true;

Here is my code…the resizeBlog function is where I am trying to resize it and then I want to adjust its y property accordingly.

```auto

stop();
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success)
{
    if (success)
    {
        var pagelength = xml.firstChild.childNodes.length;
        var depth = 100;
        for (var i = 0; i < pagelength; i++)
        {
            var mc = newsHolder.scrollContent.eventHolder.attachMovie("newsclip", "newsclip" + i, depth++);
            var node = xml.firstChild.childNodes*.attributes;
            var title = node.title;
            var author = node.author;
            var date = node.date;
            var post = xml.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
            mc.titletxt.text = title;
            mc.authordatetxt.text = "Posted by " + author + " on " + date;
            mc.posttxt.html = true;
            mc.posttxt.htmlText = post;
            mc.id = i;
            resizeBlog(mc.id);
        }
    } else
    {
        trace("cant load xml");
    }
};
xml.load("loadblog.php");

function resizeBlog(itemID)
{
    var mc = newsHolder.scrollContent.eventHolder["newsclip" + itemID];
    mc.newsbg._height = mc.newsbg._height + mc.posttxt._height;
    trace(mc.newsbg._height);
    //mc._y = itemID * mc.posttxt._height + 100;
}

```

---

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 16, 2008, 4:09pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/2 "2008-06-16T16:09:12Z")

</div>

Anyone have an idea how to do that?

---

<div class="post-metadata">

### Author: ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)
#### Post date: [June 16, 2008, 5:52pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/3 "2008-06-16T17:52:01Z")

</div>

I’m not an advanced scripter at all, but the first thing my brain is troubleshooting:

could it be that the text is not yet loaded at the moment of calculating the height of the movieclip it resides in?  
The function seems properly written. Might just be an order problem.

---

<div class="post-metadata">

### Author: ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)
#### Post date: [June 16, 2008, 6:35pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/4 "2008-06-16T18:35:06Z")

</div>

Have you tried different combination?  
If you make a post with only on line of text, are all the following post will have this same tiny height?  
Or if you post a 20 lines paragraph, will the all the other clips be tall…

or it is just its default height all the time no matter what the post length is?

My point here is if you get the first height generate from the post length, this means that the clip gets resized accordingly. Then you would have to set up an array of background clips for each post.

I hope I’m clear… I understand Flash mechanics, since I have been using it for almost 10 years, but still don’t speak its language!

---

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 16, 2008, 8:10pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/5 "2008-06-16T20:10:36Z")

</div>

[quote=artriste;2343733]Have you tried different combination?  
If you make a post with only on line of text, are all the following post will have this same tiny height?  
Or if you post a 20 lines paragraph, will the all the other clips be tall…

or it is just its default height all the time no matter what the post length is?

My point here is if you get the first height generate from the post length, this means that the clip gets resized accordingly. Then you would have to set up an array of background clips for each post.

I hope I’m clear… I understand Flash mechanics, since I have been using it for almost 10 years, but still don’t speak its language![/quote]

If I trace out the height of the text box in my resizeBlog function, the text box height are the same on all, so it would say:

```auto

104.7
104.7
104.7
104.7

etc...

```

I do have the fields set to autoSize, but maybe that doesn’t adjust the height.

---

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 16, 2008, 8:17pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/6 "2008-06-16T20:17:27Z")

</div>

im at work right now and dont have my files, but I think I might of figured it out. So my attached movie clip has the AS on it that sets the text field autoSize to true. I made a simple little example here at work and put the autoSize attribute in the for loop and it traced out the correct height for each one. I think I may have found my solution.

---

<div class="post-metadata">

### Author: ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)
#### Post date: [June 17, 2008, 12:11am UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/7 "2008-06-17T00:11:40Z")

</div>

Great, hope it is working.

I’d be interested in seeing this project when it’s live. There are not too many flash blogs around. Are you using Worpress or another service and build your flash based on it, or you come up with your own code?

---

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 17, 2008, 6:12am UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/8 "2008-06-17T06:12:39Z")

</div>

Nah this is all my code…using mysql and php. I use PHP to create the XML then I bring the xml into flash…its live right now, just a work in progress.

[http://drewestate.com/new/2008/](http://drewestate.com/new/2008/)

Click Twani on the left to see the blog. Nothing too crazy. The site is very heavy on using a database and php too. Has a complete custom backend cms too that ive been working on.

---

<div class="post-metadata">

### Author: ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)
#### Post date: [June 17, 2008, 1:50pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/9 "2008-06-17T13:50:38Z")

</div>

Very impressive.  
Will there be comments added to the blog?

It seems that you managed to fix the height issue.

---

<div class="post-metadata">

### Author: ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)
#### Post date: [June 17, 2008, 2:27pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/10 "2008-06-17T14:27:38Z")

</div>

to solve the problem:  
onLoadInit {resize}

---

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 17, 2008, 4:26pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/11 "2008-06-17T16:26:19Z")

</div>

[quote=artriste;2344260]Very impressive.  
Will there be comments added to the blog?

It seems that you managed to fix the height issue.[/quote]

I doubt it. It wouldnt be hard to do though. If the client requests it I will.

[quote=Macsy;2344276]to solve the problem:  
onLoadInit {resize}[/quote]

No use of movieClipLoader here. Its through XML.

---

<div class="post-metadata">

### Author: ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)
#### Post date: [June 17, 2008, 8:43pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/12 "2008-06-17T20:43:36Z")

</div>

i see. thought it was about loading a MC.  
Then you make like a 100 ms delay before you show the loaded xml data.

---

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 17, 2008, 9:14pm UTC](https://forum.kirupa.com/t/issue-with-dynamic-resizing/263423/13 "2008-06-17T21:14:41Z")

</div>

its all good I figured it out alreayd.
