I am trying to go on this way step by step and and met something that I
cannot understand. Maybe anybody can help. I created pieces of puzzle. Each
puzzle contain mask that I draw with Drawing API on one level. I checked it
and it creates well. Then I attach picture on another layer. I see now mask
and picture. All is correct. I say pic.setMask(mask) after that picture is
masked but it has configuration that is different from mask shape.



function drawPattern(linkageID, target, clipName, depth, x, y, cur_row,
cur_column):MovieClip {

           var r=partW*0.15;

           var mc:MovieClip = target.createEmptyMovieClip(clipName, depth);

           mc._x = x;

           mc._y = y;

           maskX=(partW*cur_column);

           maskY=(partH*cur_row);

           var mask:MovieClip = mc.createEmptyMovieClip("mask", 2);

           var pic:MovieClip=mc.attachMovie(linkageID,"pic",1);

           pic._x=0;

           pic._y=0;

           mask_sides=sides[cur_column][cur_row];

           mask.lineStyle(undefined, 0x0, 100);

           mask.moveTo(maskX, maskY);

           mask.beginFill(0x0, 100);

           drawSideV(mask,mask._xpen,mask._ypen,mask_sides[1]*r,1);

           drawSideG(mask,mask._xpen,mask._ypen,mask_sides[2]*r,1);

           drawSideV(mask,mask._xpen,mask._ypen,mask_sides[3]*r,-1);

           drawSideG(mask,mask._xpen,mask._ypen,mask_sides[4]*r,-1);

           mask.endFill();

           pic.setMask(mask);

           return mc;

}



function tiler (linkageID){

           depthCount=1;

           for (var j=0;j<column;j++){

                       for(var i=0;i<row;i++){


part=drawPattern(linkageID,this,"part"+j+"_"+i,depthCount,stageX,stageY,i,j);

                                   depthCount++;

                                   activity(part.mask);

                       }

           }

}


tiler("pic");

Thanks a lot for help.





2006/7/16, Hans Wichman <[EMAIL PROTECTED]>:

Hi Natalia,
you can find it here:
http://www.google.nl/search?hl=nl&q=jigsaw+puzzle+flashcoders&meta=

and

http://www.mail-archive.com/flashcoders@chattyfig.figleaf.com/msg17822.html


Yes its possible.

greetz
Hans


On 7/16/06, natalia Vikhtinskaya <[EMAIL PROTECTED]> wrote:
>
> Thank you, Guntur.
> I can not find your thread in the archive. Do you have this algorithm or

> any
> basic fla? It would be very helpful. Drawing api is clear for one object
> but
> creating many puzzles looks fantastic. Is it possible?
> Natalia
>
>
> 2006/7/16, Guntur N. Sarwohadi < [EMAIL PROTECTED]>:
> >
> > Natalia,
> >
> > You can search the archive and find recent threads concering jigsaw
> puzzle
> > algorithm. In fact, thats the thread I started.. that's why I (and
Hans)
> > know it's there ^_^
> >
> > But to answer you question...
> >
> > 1. flash 8 has provided a bitmapData class, it's really good handling
> > bitmaps so you can use the copyPixel method and but it in n movieClips

> on
> > it. For jigsaw drawing, you can use flash drawing api.. especially the
> > curveTo method. Basically it's only one type of curving and it is
> repeated
> > for each side with variations being it inward or out..
> >
> > 2. group and blending two pieces isn't that hard actually, as long as
> the
> > pieces are placed in the right position it will look as one. The drop
> > shadow
> > is done by code and updated, while the center curve fading can also be

> > done
> > by code.. sure, it's a little complex than droptarget and hittest but
it
> > can
> > be done :D
> >
> > hope that helps
> >
> > Guntur N. Sarwohadi
> >
> > On 7/15/06, natalia Vikhtinskaya <[EMAIL PROTECTED]> wrote:
> > >
> > > Yes, I checked before posting but found only questions without
> answers.
> > >
> > > 2006/7/15, Hans Wichman <[EMAIL PROTECTED]>:
> > > >
> > > > Please refer to the archives, there is a thread about this going
on
> as
> > > we
> > > > speak...
> > > >
> > > > On 7/15/06, natalia Vikhtinskaya <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Hi to all
> > > > >
> > > > > Can anybody give me advice for creating game like this?
> > > > >
> > > > > http://www.magickeys.com/books/jigsaws/cheetah_1/e.html
> > > > >
> > > > >   1. How can I create each time different pieces? I can only
guess
> > > that
> > > > >   there are some sets with different shapes and they attached as
> > mask.
> > > > >   2. When pieces are correct new pieces appear. How this is
done?
> > How
> > > > >   they determinate that? This is not droptarget or hittest. How
> from
> > > two
> > > > > masks
> > > > >   they create one mask?
> > > > >
> > > > > Has anybody any code that can help to create this?
> > > > >
> > > > > Thanks,
> > > > > natavi
> > > > > _______________________________________________
> > > > > 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
> > > >
> > > _______________________________________________
> > > 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
> >
> _______________________________________________
> 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

_______________________________________________
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