You might have a look at this:

http://mirror1.cvsdude.com/trac/osflash/red5/browser/java/server/trunk/swf/DEV_Source/classes/org/red5/samples/games/othello/GameBoard.as?rev=604#L98

resolveSiblings() is the method.  Basically, it has some calculations for
finding out if a piece is an end or corner piece by determining
top/bottom/left/right sides based on column and row count.

Might help aid in your resolving some issues in your algorithm

On 3/29/06, Flash Mel <[EMAIL PROTECTED]> wrote:
>
> Hehe, all good.  Thanks John.  I'm sitting here trying to write something
> mathematically that works.  Turns out I am the suck at math, so it's
> making
> this complicated.  Hand coding the array would be laborsome and wouldn't
> allow for extensibility.
>
> Grrr...
>
>
> fM.
>
>
>
> On 3/29/06, John Grden <[EMAIL PROTECTED]> wrote:
> >
> > Sorry, code correction - LOL, on code that's not been tested ...
> >
> > for(var i:Number=0;i<pieceList.length;i++)
> > {
> >     for(var j:Number=0;j<pieceList[i].pieces.length;j++)
> >     {
> >         this["piece_" + pieceList[i].pieces[j]]._visible = true;
> >     }
> > }
> >
> >
> > On 3/29/06, John Grden <[EMAIL PROTECTED]> wrote:
> > >
> > > well, if you're using my code, then it would essentially build all
> > pieces
> > > the way you show it happening in that link.
> > >
> > > to do it diagonaly the way you specify, there's 2 ways:
> > >
> > > 1.  come up with an algorithm to calculate that type of movement based
> > on
> > > the number of rows/cols you have (ouch)
> > > 2.  create the grid first, hide all pieces.  Create an array by hand
> > with
> > > those values, and loop that array displaying the correct pieces:
> > >
> > > var pieceList:Array ({pieces:[0]}, {pieces: [1,14]},
> > {pieces:[2,15,28]});
> > >
> > > for(var i:Number=0;i<pieceList.length;i++)
> > > {
> > >     for(var j:Number=0;j<pieceList[i].pieces.length;j++)
> > >     {
> > >         this["piece_" + pieceList[i].pieces[j]._visible = true;
> > >     }
> > > }
> > >
> > > Either set visible to true of tell it to gotoAndPlay("transitionIn")
> or
> > > whatever you have in frame lables etc.
> > >
> > > Make sense?
> > >
> > > JG
> > >
> > >
> > > On 3/29/06, Flash Mel <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Thanks John,
> > > >
> > > > This is great!  When I trace this, it works.  I've applied it to my
> > > > code,
> > > > and I think I have added something wrong.  What happens is that all
> > the
> > > > elements just build in a single area.
> > > >
> > > > Here is what I had in the previous code:
> > > > http://www.apt11.com/test/test.html
> > > >
> > > > Essentially, I need "0" to display, then "1", "14" then "2", "15",
> > "28"
> > > > and
> > > > so on.
> > > >
> > > > Am I not applying your code correctly?  My apologies for the
> bumbling
> > > > and
> > > > thanks for the help.
> > > >
> > > > fM.
> > > >
> > > >
> > > >
> > > > On 3/29/06, John Grden <[EMAIL PROTECTED] > wrote:
> > > > >
> > > > > This will give you what you're looking for:
> > > > >
> > > > > var cols:Number = 3;
> > > > > var rows:Number = 3;
> > > > >
> > > > > for(var i:Number=0;i<rows;i++)
> > > > > {
> > > > >     for(var j:Number=0;j<cols;j++)
> > > > >     {
> > > > >          var gridLocation:Number = (i+j) + ((rows-1)*i);
> > > > >          trace("grid location = " + gridLocation);
> > > > >          // create your moviecilp
> > > > >     }
> > > > > }
> > > > >
> > > > > row by row, create a movieclip per column.
> > > > >
> > > > > hth,
> > > > >
> > > > > John
> > > > >
> > > > > On 3/29/06, Flash Mel <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Ok, since my email got through this morning, I'm hoping this one
> > > > gets
> > > > > > through.  Here is the question I've emailed four times
> > now.  Doesn't
> > > > > > show up in the threads.
> > > > > >
> > > > > > Here we go:
> > > > > >
> > > > > >
> > > > > >
> > > > > > Here is what I have so far:
> > > > > >
> > > > > > import mx.transitions.Tween;
> > > > > > import mx.transitions.easing.*;
> > > > > >
> > > > > > m = 0;
> > > > > > numTiles = 112;
> > > > > >
> > > > > > function placeTiles() {
> > > > > >     if (m == numTiles){
> > > > > >         m = 0;
> > > > > >          clearInterval(buildTiles);
> > > > > >     } else {
> > > > > >         _root.attachMovie("square", "tile" + m + "_mc", m, {_x:m
> %
> > > > 14
> > > > > > * 50, _y:Math.floor(m / 14) * 50});
> > > > > >         myObj = "tile" + m + "_mc";
> > > > > >         new Tween(_root[myObj], "_alpha", Regular.easeInOut, 0,
> > 100,
> > > > 35,
> > > > > > false);
> > > > > >         _root[myObj].number_text.text = m;
> > > > > >         m++;
> > > > > >     }
> > > > > > }
> > > > > >
> > > > > > buildTiles = setInterval(placeTiles, 30);
> > > > > >
> > > > > > This works fine.  Builds the rows one after another.  But what I
> > am
> > > > > > trying to do is build one row across and one down.  Make sense?
> > > > > >
> > > > > > In essence, the final display and position of the objects will
> be:
> > > > > >
> > > > > > 123
> > > > > > 456
> > > > > > 789
> > > > > >
> > > > > > The sequence I am after:
> > > > > >
> > > > > > 1
> > > > > >
> > > > > > then
> > > > > >
> > > > > > 12
> > > > > > 4
> > > > > >
> > > > > > then
> > > > > >
> > > > > > 123
> > > > > > 45
> > > > > > 7
> > > > > >
> > > > > > and so on
> > > > > >
> > > > > > 123
> > > > > > 456
> > > > > > 78
> > > > > >
> > > > > > Help?!
> > > > > > _______________________________________________
> > > > > > Flashcoders@chattyfig.figleaf.com
> > > > > > To change your subscription options or search the archive:
> > > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > > > > >
> > > > > > Brought to you by Fig Leaf Software
> > > > > > Premier Authorized Adobe Consulting and Training
> > > > > > http://www.figleaf.com
> > > > > > http://training.figleaf.com
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > John Grden - Blitz
> > > > > _______________________________________________
> > > > > Flashcoders@chattyfig.figleaf.com
> > > > > To change your subscription options or search the archive:
> > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > > > >
> > > > > Brought to you by Fig Leaf Software
> > > > > Premier Authorized Adobe Consulting and Training
> > > > > http://www.figleaf.com
> > > > > http://training.figleaf.com
> > > > >
> > > > _______________________________________________
> > > > Flashcoders@chattyfig.figleaf.com
> > > > To change your subscription options or search the archive:
> > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> > > >
> > > > Brought to you by Fig Leaf Software
> > > > Premier Authorized Adobe Consulting and Training
> > > > http://www.figleaf.com
> > > > http://training.figleaf.com
> > > >
> > >
> > >
> > >
> > > --
> > > John Grden - Blitz
> > >
> >
> >
> >
> > --
> > John Grden - Blitz
> > _______________________________________________
> > Flashcoders@chattyfig.figleaf.com
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>



--
John Grden - Blitz
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to