Insert a 2D table group in a single group

No worries :slight_smile:

Just discovered that there’s a limit on the number of quotes you can put in a thread post though.

M

Yea, well I did worse!

I found out, there is a limit to the “smiley faces” you can add!

:slight_smile:

Chris:) 

Horacebury,

I have implemented your code and all works wonderfully with my existing code!

The changes I had to make were surprisingly painless and quick!

I have a question: "How can I dispatch an event to each card through the SECOND for-loop below?

– shuffle cards

for i=1, math.random( 50, 100 ) do local indexToShuffle = math.random( 1, stack.numChildren )--number between 1 and 52 stack[indexToShuffle]:toFront() -- :toBack() works just fine end

– at this point the cards are shown on screen in shuffled order, so we reveal them

for i=stack.numChildren, 1, -1 do--from 52 down to 1

 Right here, how can I dispatch an event to each card through this loop? I have custom functions for each card in the aCard.lua file; each card in-turn has a parent, required() from: class.lua. All cards share common functions, and I have custom constructors that give certain cards special functions:

“EGGsample” :slight_smile:

aCard:doSomething() --COMMON TO ALL CARDS

Card1:doSomethingSpecial() --ONLY SPECIAL CARDS

MY SHOT IN THE DARK!

stack[i]:dispatchEvent( myEvent )--whyDoesThisNotWork?

 transition.to( stack[i], { delay=i\*500, time=350, y=600 } ) end

I even attached:

object:addEventListener( "myEvent", self ) 

…in the same location I attached:

object:addEventListener( "touch", self ) 

The latter works, the former does not.

Using the class.lua and attempting OOP, I am beginning to slightly blur the communication with the “self” in the aCard.lua module, when I am “OUT OF SCOPE”.

I know I am closer. Your assistance today took me ‘personally’ light years ahead in my understanding, hence, the new questions.

Chris:)