# Fake an HTML-like page flow

**URL:** https://forum.kirupa.com/t/fake-an-html-like-page-flow/199378
**Category:** flash
**Created:** [September 1, 2006, 7:18pm UTC](https://forum.kirupa.com/t/fake-an-html-like-page-flow/199378 "2006-09-01T19:18:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jedhu0920](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jedhu0920/32/905_2.png) [@jedhu0920](https://forum.kirupa.com/u/jedhu0920)
#### Post date: [September 1, 2006, 7:18pm UTC](https://forum.kirupa.com/t/fake-an-html-like-page-flow/199378/1 "2006-09-01T19:18:45Z")

</div>

I am laying out a Flash site that has copy very much like you’d see on an html page (see attached screenshot).

It will have the equivalents of h1, h2, and p tags.

Now, flowing text into an html page is easy because browsers follow CSS rules like padding and margin and will automatically “push” a paragraph down the page if it is preceded by a header.

However, in Flash, everything is totally free-form and will end up at 0,0 unless you specify absolute coordinates for each element on the stage.

Though the free-form nature of the Flash stage is very cool in most cases, it really sucks in this case.

So I’m gonna try to fake it…

We’ll start out with an empty array and fill it with all of the elements (H1s, H2s, Ps, etc…) to be flowed to the stage. Each element will be an instance of a class that I create and each class will have constants like ‘MARGIN-BOTTOM = 5;’, ‘MARGIN-TOP = 3;’ and so on…

As a loop places each element in the array on the stage, it will check the Class constants of the previous element in the array and will place the next element on stage by figuring:

```auto
nextElement._y = previousElement._y + previousElement._height + previousElement.MARGIN-BOTTOM + nextElement.MARGIN-TOP;

```

So what do you think? Is it divine inspiration? Maybe you’ve come up with something way more simple? Let’s hear it!

[![](http://img68.imageshack.us/img68/730/pageflowaf4.th.png)](http://img68.imageshack.us/my.php?image=pageflowaf4.png)
