I use the ActionScript Cookbook containers for this. They're very good at automatically arranging things in rows/columns.
http://www.person13.com/ascblibrary/

something like this:

import ascb.containers.Box;

box = new Box();
box.parent = _root.myClip;
box.direction = "horizontal";
box.spacing = 4;

for(var i;i<10;i++){
   box.addElement("symbolID",{myText:"TabName",initData:myData});
}

Handles spacing, attachMovie, spacing, etc. Very handy dandy class. If you're changing the widths of them dynamically, you can re-arrange them by calling box.arrange() I believe.

HTH,
Chris

Dennis Hart wrote:

I was wondering if anyone knew of a way or even the best way to go about
attaching a single movieClip multiple times along the x axis when the actual
width of the clip is determined my the content that it loads.

In this case I am just trying to serve up a number of "buttons" that look
like tabs. The clip being attached handles the creation of a text field,
loading and formatting its text (or label) then drawing up the graphic which
makes it look lie a tab.

I would like to attach them all at once using a loop and the main problem I
encountered is getting flash to instantiate and recognize the previously
loaded clip on the stage so that its x position and width can be determined
before the loop recommences.

I tried something like

if (tabArray.length != 0) {

       var i:Number = 0;
       var clipPositioner:Number;
       var previouslyLoadedClip:MovieClip;

       while (i < tabArray.length) {
       var tabName = "TabBtn" + i;
       var level = i + 1;

       if (tabName == "TabBtn0) {
           previouslyLoadedClip = tabName;
       } else {
           previouslyLoadedClip = tabName.substring(0, 5) + (i-1);
clipPositioner = [previouslyLoadedClip]_x +
[previouslyLoadedClip]_width + 1;

       this.attachMovie("TabBtn_mc",  tabName , level, { _x: clipPositioner
});
       updateAfterEvent(); // THIS DOESN'T WORK - NEITHER DOES :
       onClipEvent(load) { i++ }

       i++;
       }
   }

I understand why the updateAfterEvent() and onClipEvent(load) methods don't
work within the context above, but I am still uncertain how would be the
best way to go about accomplishing this.

I would appreciate it if someone could point me in the right direction.

Thanks

Dennis
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

--
_________________________________________
<   __ __  ____                           >
<  |  |  \/ ___\  Chris Hill              >
<  |  |  / /_/  > [EMAIL PROTECTED]    >
<  |____/\___  /  http://ubergeek.tv      >
<       /_____/   The Smell of Geek!      >
<----------------------------------------->

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to