Movieclip pile-up

ETA: Oops, some of my code got eaten up. Sorry about that! The for statement has been corrected.
================

WHY, in the below function snippet, would adding x,y coordinates to the mcOrg movieclip cause the collection of movieclips to dogpile on top of each other? W.T.F.??

var mcOrg:TouchMovieClip = new TouchMovieClip();
var mcOrgContainer:TouchMovieClip = new TouchMovieClip();

function xmlLoaded(e:Event) {
xmlORG=new XML(ulXML.data);
var numMuseums:Number=xmlORG.museum.length();

for (var i:int=0; i<numMuseums; i++) {
var genText:TextField = new TextField();
var genFormat:TextFormat = new TextFormat();
genFormat.color = 0×000000;
genFormat.size = 12;
genFormat.font = "Arial";
genText.embedFonts = true;
genText.type = "dynamic";
genText.x = 10;
//genText.y = 35*(i+1);
genText.y = 10;
genText.background = false;
genText.backgroundColor = 0xffffff;
genText.width = 280;
genText.height = 20;
genText.multiline = true;
genText.wordWrap = true;
genText.antiAliasType = "advanced";
genText.autoSize = TextFieldAutoSize.NONE;
genText.defaultTextFormat = genFormat;
genText.htmlText=xmlORG.museum[i].iwindow[0].name.children();
//trace(genText.htmlText);
genText.setTextFormat(genFormat);
mcOrg.addChild(genText);
mcOrg.x = -10;
mcOrg.height=30;
mcOrg.y =mcOrg.height * i;
mcOrg.addEventListener(TouchEvent.TOUCH_DOWN, traceContent);
mcOrgContainer.addChild(mcOrg);

}//close for statement
orgContainer.addChild(mcOrgContainer);

Advertisement

4 Comments

  1. biorex21 said

    I don’t see any i++; or i+=1; or i = i+1 :P

    • gttygrl said

      Oops! It copied wrong, but it was there in the original code. Sorry about that, I’ve fixed the for statement.

  2. biorex21 said

    You are creating just 1 mcOrg which is outside the for loop.
    I mean, you should place var mcOrg:TouchMovieClip = new TouchMovieClip(); just before mcOrg.addChild(genText);

    • gttygrl said

      That’s it! Dammit, I knew it was gonna be something totally stupid and easy. Thank you soooo much!

RSS feed for comments on this post

Comments are closed.

Follow

Get every new post delivered to your Inbox.