0

I'm running through a pretty simple Flash based website tutorial from ActiveTuts. Any who, I'm attempting to convert one of my HTML5/CSS3 designs into Flash as a learning experience. Currently, I have navigation that is the width of the stage (so each child is the width of the stage - 980px). I would like to have each navigation element on it's own line - as of now, and after hours of searching Google I'm only able to have navigation children added horizontally instead of my vertical goal.

To sum it up, all new children are added horizontally and thus off stage, I would like to have them display one under another. I'm decently experienced in PHP/Java/C# etc. but completely new to AS3. Perhaps I'm getting a bit over my head diving headfirst this way into AS3 :x.

Here is the code:

var navContainer:Sprite = new Sprite;
addChild(navContainer);

var navArray:Array =["Home","About","Work","Contact"];

for(var i:Number=0;i<4;i++){

var navItem:NavItem = new NavItem;

navItem.x = navItem.width*i;

navItem.nav_name.text = navArray[i];

navContainer.addChild(navItem);

navContainer.alpha = 0.7;

navContainer.width = stage.stageWidth;

navContainer.y = stage.stageHeight - (stage.stageHeight/1.25);

For what it's worth, I'm running through http://active.tutsplus.com/tutorials/web-design/create-a-full-screen-scalable-flash-website-part-1/

1 Answer 1

0

In your loop, you're setting the x position of navItem:

navItem.x = navItem.width*i;

That is what is positioning the navItems horizontally. If you'd like to affect the vertical position, set the y position instead:

navItem.y = navItem.height * i

3
  • Haha, wow! I can't believe I didn't notice that; you can tell I didn't get enough sleep :P.
    – eric
    Jun 14, 2012 at 3:39
  • No problem :) And welcome to Stack Overflow! Make sure to take a look at the FAQ for any questions on how to use the site. Also, if someone answers your question, make sure to mark it as answered (by clicking the checkmark next to the answer) so people in the future can easily find the same answer as well. Jun 14, 2012 at 17:00
  • Haha, I was wondering how to check it as answered :P. Sorry for the delay!
    – eric
    Jun 27, 2012 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.