Re: [Flashcoders] Flash chat options
Or use haXe (haxe.org). On 5/12/07, Jobe Makar [EMAIL PROTECTED] wrote: Hi, You should check out ElectroServer 3 as well. http://www.electro-server.com Jobe Makar http://www.electrotank.com http://www.electro-server.com phone: 252-627-8026 mobile: 919-609-0408 fax: 919-882-1121 - Original Message - From: Mick G [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Friday, May 11, 2007 4:18 PM Subject: [Flashcoders] Flash chat options Does anyone have any suggestions to the best way to implement a Flash based chatroom (Can be commercial, but I have a low budget). I'm after something that utilizes a free XML socket server and something that works efficiently on a server without any nast polling. I've tried implementing ElectroServer but it wasn't really an option with my current hosting situation and in general the documentation on the site seemed sparse. I don't anticipate many more than 20-30 concurrent users. Any links/help appreciated thanks, Mick ___ 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
Re: [Flashcoders] How is it done? coca-cola creator
Here's another with an example and source code. http://www.bytearray.org/?p=26 and http://www.bytearray.org/?p=29 I'm currently using the same JPEGEncoder class on something similar (draw and stick activity multimedia-application) for a local kindergarten using haXe and screenweaver :) ___ [EMAIL PROTECTED] 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
Re: [Flashcoders] simulating airbrush + calligraphy brush
Thanks for the replies, Yeah I was thinking the same about system chugging with lots of vectors to handle.. I think I'm more to the BitmapData solution, since it is much cleaner (adding pixels to the single BitmapData instead of having lots ad lots of MCs). Thanks Danny Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] simulating airbrush + calligraphy brush
apply the airbrush effect in a bitmap along the path - this way you can assign different brushes to the path after it's been drawn, undo points etc. mmm.. love the idea... but, what do you mean by placing bitmaps along a path? did you mean it will also stretch or just show for every vertex of the path? can you give me pseudo-code of how to do this? thanks Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] simulating airbrush + calligraphy brush
yeah.. i usually just use lineTo in a loop while the mouse is pressed.. no curveTo as i thought it's unnecessary. so I just need to place the bitmaps after the lineTo? is that all? if I need to stretch the bitmap, say from the last point to the current, is that possible? or by just placing the bitmaps per point will suffice? Guntur N. Sarwohadi On 2/28/07, Danny Kodicek [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guntur N. Sarwohadi Sent: 28 February 2007 14:56 To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] simulating airbrush + calligraphy brush apply the airbrush effect in a bitmap along the path - this way you can assign different brushes to the path after it's been drawn, undo points etc. mmm.. love the idea... but, what do you mean by placing bitmaps along a path? did you mean it will also stretch or just show for every vertex of the path? can you give me pseudo-code of how to do this? Depends how you want to do it, but the simplest is to work with a spline. One method is to take one brush point every few moments and turn this path into a Catmull-Rom spline. Then you can draw as many points along the spline as you like. A quick guide to catmull rom splines is here: http://www.mvps.org/directx/articles/catmull/, but in essence: function catmullPoint (p0, p1, p2, p3, t) { // where p0 to p3 are points, and t is the fraction of the distance between p1 and p2 return 0.5 * (2*p1 + t*(p2 - p0) + t*t*(2*p0 - 5*p1 + 4*p2 - p3) + t*t*t*(-p0 + 3*p1 - 3*p2 + p3)) } So if you have a list of points p0, p1, ... , pN, then you can draw as many points along the spline as you like. Flash uses quadratic bezier curves in the drawing API and cubic beziers in the actual application - a cubic bezier and a Catmull-Rom spline are essentially the same thing but with different parameterizations. Danny ___ 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
Re: [Flashcoders] simulating airbrush + calligraphy brush
hmmm... nice.. very nice.. but not exactly what i want to achieve.. it seems it has a lag due to the 'calculating stuff to bitmaps'.. i need to be responsive.. similar to MS-Paint.. and it doesn't have to look as good as BitmapExporter.. but it is something i'll look in to, definitely. if that's my case, placing bitmaps while dragging will suffice, no? Guntur N. Sarwohadi On 2/28/07, Mike Mountain [EMAIL PROTECTED] wrote: http://www.quasimondo.com/archives/000572.php I think someone beat you to it. Complete with source code: http://www.quasimondo.com/scrapyard/BitmapExporter.zip How lucky is that! M ECM Systems Ltd, Ellifoot Park, Burstwick, East Yorkshire HU12 9DZ Tel: 01964 672000 Fax: 01964 671102 Registered in England no. 01646471 The information contained within this email expresses the views of the sender and not necessarily those of the company. It is private and confidential and may be legally privileged. It is intended solely for those authorised to receive it. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or action taken in reliance on its contents is strictly prohibited and may be unlawful. If you have received this email in error, please telephone us immediately on 01964 672000 or email a reply to highlight the error and then delete it from your system. This email may contain links to web-sites, the contents of which ECM Systems Ltd have no control over and can accept no responsibility for. Any attachments have been virus-checked before transmission; however, recipients are strongly advised to carry out their own virus checking as ECM Systems Ltd do not warrant that such attachments are virus-free. Please note that this email has been created in the knowledge that Internet email is not a secure communications medium. We advise that you understand and observe this lack of security when emailing us. ___ 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
Re: [Flashcoders] simulating airbrush + calligraphy brush
@Mick I think I meant modifying bitmapData instead of placing bitmaps one by one.. but to make sure, are you referring to using copyPixels to a single bitmapData per point creation? @Michael I see what you mean.. I think I wont need any undo feature (i'm not like trying to make flash-photoshop or something.. it's just a simple drawing app as an activity module for a kindergarten CD-kiosk) but i like the idea of baking the bitmaps. what's the difference of using copyPixels then? I'd love to know the 10 minute solution, btw Cheers, Guntur N. Sarwohadi ___ 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] simulating airbrush + calligraphy brush
Hi all, Is there a way to simulate how an airbrush tool or a calligraphy brush works using Flash Drawing API? I'm talking about drawing tools you see in MS-Paint, where an airbrush produces random dots/circles near the mouse cursor while calligraphy brush is like a regular brush but the tip is oval. I know that using capsStyle argument in lineStyle method can produce rounded or squared tip, but no oval. Does anyone know how to create a custom tip (capsStyle) for lineStyle? If the regular Drawing API isn't sufficient, can anyone give any ideas of other ways to achieve this? I was thinking of looping an attachMovie method during onEnterFrame/onMouseDown to place custom shaped MCs. Is this a good idea to go with? thanks, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] newbie question - drawing a ring
Hello David, You can use flash drawing API. You might use just 2 drawing methods: moveTo(x,y) moves a pointer from where you want to start drawing from and curveTo(cpx, cpy, x, y) draws a curve with cpx is the location of the curve control point by x, cpx is the curve control point by y, and x y is the final point / destination to draw you might as well define the line style using lineStyle or filling it with a color using beginFill and then endFill. it's all in the help / manual located at the IDE.. Hope this helps, Guntur N. Sarwohadi On 10/20/06, David Cake [EMAIL PROTECTED] wrote: New to the list, new to Flash/flex, experienced java/C/web etc coder. Please excuse me if my question is in a FAQ that I should have read somewhere (and feel free to direct me to such resources) I want to create a vector ring shape, a circle with an excised inner circle, in code. I don't want to use tricks like gradient fills that make it look like a ring - I want sharp borders (and there are a lot of additional graphic elements that I want to look like part of the same object within the ring). I haven't been able to find any examples that create vectors with internal holes to them. Regards David ___ 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
Re: [Flashcoders] jigsaw performance issue
It seems you're being unnecessarily complicated here. Why take the pieces, move piece A, remove piece A from the group and then move all the rest? I'd do it all in one loop. I thought I needed that approach because how would the group know what piece is being moved and how would the other pieces in the group know which to move from? If I just tell the group to move according to current mouse location, all the pieces in the group will position itself to the mouse coordinates, not by where it should be located by the moved piece.. If you have a better solution, I'm happy to hear from you :) As for the source of your problem, I'm guessing it's because the mouse moves while the loop is running. Try storing the _xmouse and _ymouse properties at the start of the loop. within or before the onEnterFrame event? If before, how would I tell the group the current position I want them to be? I mean, I think it's obvious I need to loop _xmouse _ymouse properties, right? If within, wouldn't it be too redundant to store _xmouse + _ymouse properties into a variable before processing it? Sorry for my stupidity here, and thanks for the help :) Guntur N. Sarwohadi ___ 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] jigsaw performance issue
This is the jigsaw topic again.. :D Much thanks for the help you guys lended several weeks ago to make me (almost) finish this jigsaw puzzle project. Most of the core mechanism is done, but now it needs some final adjustments, mostly concerning 'optimizing performance'. Currently I've implemented what Danny and Hans suggested on earlier threads, which is the use of Group objects that contains piece data and its neighbours.. the piece has a property referencing a Group and when a piece snaps to another piece, its Group object 'merge' thus making it easier to detect when the puzzle is done (which is if there is only 1 Group object left).. it's brilliant Danny! Much easier to handle the pieces with this method.. now for the problem.. if you see the flash movie i've attached, you'll notice that when a group of pieces that are connected to each other are moved sometimes it lags. I've manage to lock down the core problem, which is that it only lags when you drag a piece located from the left / top most of the Group. It wont lag if only you drag the right/bottom most of the Group. The drag method for groups is done customely and it tells the members of the Group object the piece you're dragging, to move as well. The code: function dragGroup(what) { //move the pressed MC sX = _root._xmouse; sY = _root._ymouse; wX = what._x; wY = what._y; what.onEnterFrame = function() { this._x = _root._xmouse - sX + wX; this._y = _root._ymouse - sY + wY; } //get the other members tpcs = this.members.slice(); //cut out what MC from tpcs for(i in tpcs) { if(tpcs[i] == what) { tpcs.splice(i, 1); } } disti = new Array(); distj = new Array(); //move the rest of the members not including 'what' by grid //corresponding to 'what' for(a = 0; a tpcs.length; a++) { tpcs[a].onEnterFrame = function() { disti = this.i - what.i; distj = this.j - what.j; this._x = what._x + (distj * (kepingW)); this._y = what._y + (disti * (kepingH)); } } delete(tpcs); delete(disti); delete(distj); } this method is located in the Group object, btw. and i think the problem is located somewhere in the looping part of the algorithm, but unsure where. It's probably logical that when you move the right/bottom most piece in the group, it is cut off from the loop and makes the piece on its left / above to move smoothly... Not sure... anyone have a clue on this issue? Could be somewhere wrong in my method? thanks before, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] jigsaw puzzle piece algorithm
Hello Danny, Thanks alot.. this can't be any clearer :D, workin on it now :)) thanks again, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] jigsaw puzzle piece algorithm
Hello Danny, So for every piece generated, i'll create as much piece and group objects in each piece and group array beyond the piece MC object scope, right? But how does moving all pieces simultaneously be done in pseudocode? How would you tell an object to start drag?.. I mean, since only MCs have the startDrag method, then it will need to delegate to group object, or do you have a better way doing this? Much thanks, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] jigsaw puzzle piece algorithm
Hi Hans, Hmm.. ok.. i think i see what you and Danny are talking about. yes, i think and hope that will solve the problem.. You dont need to explicitly define a's neighbours, since its a grid, so you know how to find it's direct neighbour if necessary. But if i don't define neighbours, how would i tell a piece to stick at a certain piece on a certain side?.. except I'm using a certain naming convention (like you said, grids) which automatically tells where this piece should stick at.. is this approach is what you mean? big thanks guys, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] jigsaw puzzle piece algorithm
Hi Danny, Thanks for the reply.. I'm not quite sure to what you mean, but doesn't it sound similar to my current approach? Rather than using arrays, you suggested objects. Please correct me if I'm wrong. Cheers, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] jigsaw puzzle
Hi Natalia, I think it's best to attach a screen dump as Hans said earlier.. since you mention in your previous post that when you hadn't apply the mask mc, both pic and mask mc looks fine, but once mask, I say pic.setMask(mask) after that picture is masked but it has configuration that is different from mask shape. probably send both versions... (without mask and with mask).. cheers, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] jigsaw puzzle piece algorithm
Hi Hans, Sorry for the long reply on this subject,.. my previous mail got rejected at hadn't notice it till now.. o_O I think your algorithm is about how to search for puzzle pieces, but what I'm looking for is how to tell pieces in the same group to move together.. Here's what I have: For each piece, before randomly positioning them, I register every piece by their location: north, south, east and west. So every piece has 4 properties containing at most 1 MC name. I also added a group property (array class) which will register pieces (mc names) as groups when combined together. Here's a simple diagram of a 3x3 puzzle just to make it easy to explain things: A B C D E F G H I So, for piece A, A.east is B, A.south is D. In B, B.west is A, B.east is C, B.south is E, etc.. Initially each piece group property is an empty array, but for a group something like: A B C D then, A.group is an array of (B, C, D). B.group is an array of (A, C, D), etc.. I've tried several attempts for piece movement... but none meets my expectation let me explain my case with an example,.. say we have a group something like A B D E and we're moving piece E First attempt, I iterate array members of E.group and calculate the distance between each piece from piece E. On mouseMove, I update the distance for every array member of E.group from the piece E current coordinate. This is the easy way to move group members all at once, but having them stick to each other is another thing since I get every piece displacing on every movement. It seems like they're not updating as fast as the mouse move.. Second attempt, similar to the previous attempt but now I calculate the delta of E and update the delta for each array member of E.group. Each piece in E.group moves but displaces too, probably the same issue as the first attempt.. Third attempt, I use the north, east, south, west (N-E-W-S) property in every piece. So on mouseMove I iterate each array member of E.group and tell them to update position by E as parameter. I provided an updating method for each piece class to see if either their north, east, south or west property is the moving MC (in this case, E). Then it updates their coordinates by placing themselves from the moving MC (if north, then E._y + E._height). This sticks the pieces real good, but somehow piece E sometimes slips off and you can see a minor gap. But the problem with this attempt is that it's hard to tell pieces not related directly with E to move as well. Like piece A. So the forth attempt, instead of telling group members to update by E, I'm telling E to update it's own N-E-W-S MC and let it 'spread the word' besides the source (tell B to update it's own N-E-W-S.. tell D to update it's own N-E-W-S, etc... but not return it back to E). This is a better way to tell every piece to move by E, but flash spits out an error about endless looping and that's because A is being called by both B and D. The hard part is, I can't tell which should A listen to. now, i think i'm doing this the wrong way somewhere.. any ideas, anyone? thanks, Guntur N. Sarwohadi On 7/15/06, Hans Wichman [EMAIL PROTECTED] wrote: Hi, great nice to hear, it's all starting to work now. With respect to the moving, are you moving the pieces to round _x, _y values, not sure, but this might have something to do with it. I remember building a panorama with hotspots area's that had to move along with the panorama, and I had the same problem, the area's slowly moved away from where they should be. I rounded all the delta x's and y's and the problem went away. With respect to the other problem, I think (but I haven't yet so sorry if this isnt the way to go!) I wouldn't use a ref and neighbour ref search, but actually define groups. After moving a piece, it can match on four sides. The matches could be groups themselves or single pieces. You could take the first match, and either join the new piece to an already existing group, or start a new group between the matching piece on the moved piece. You could make it more complex, for example, when the moved piece matches on both the left and right side, that you combine all those matches into one group, however that isn't strictly necessary, since if you use only the first match, you simply need to move it after the first grouping and it will group again. This still leaves a lot of questions to be answered though, but still the principle would be to update groups. I'm not sure which solution would be better, they both have something to say for them i think. ANYWAYZ: with respect to A*, it would be something like: - build a childlist for all children not already in the list in pseudo: var piecesToFind = new Array(); var piecesToIterate = [masterPiece]; while (piecesToIterate.length 0) { var currentNode = piecesToIterate.shift(); piecesToFind.push (currentNode); for each matchingPiece in currentNode { if (piecesToFind.contains
Re: [Flashcoders] jigsaw puzzle
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
Re: [Flashcoders] jigsaw puzzle piece algorithm
Hello Hans, I would like to thank you in advanced for helping me this far.. I currently have the jigsaw drawing algorithm in hand, yay! It's looks nicer now :D.. and it does 'blend' when it sticks to other pieces tightly. One good thing is that I use the bevel filter and I thought it wont looked blended since you have that filter around, but somehow it did otherwise and looked pretty nice.. some 'fake' blending effect hehehe.. I've modified the group movement code and now it's moving corresponding to the relation to the 'master' piece (piece the user move).. moving with distance (not piece relation) was pretty buggy coz it (pieces in the group) displaces as the mouse slightly moves away from the master piece. But currently, with the new implementation, it still displaces.. the displacements occur only to the master piece and it seems like because it moves a little faster than the others which make it slightly not sticking with the rest of the group. Very minor bug but still annoying. Broadcast / dispatching isn't the right term for what I did in code, btw.. coz in pseudo all i did was: piece.onMouseMove = function() { for(i = 0; i piece.group.length; i++) { piece.group[i].updatePosition(this); } } group is an array located in each piece mc.. and since it's an array of pieces, then this piece has the 'updatePosition' methode as well.. sumthin like piece.updatePosition = function(ref) { //get the relation to ref, whether it's in the north, south, west or east of it //match the _x and _y property by ref by relation //search for other pieces connected to ref if this piece isn't related directly to ref } Now, this is where my latest problem spawns in.. searching for pieces connected to ref is pretty damn hard.. it reminds me with A* algorithm, which i'm not familiar of.. currently i iterate the methode if a piece can't find a hierarchy connection to ref / master piece, and it comes that only 2 layer 'descendants' follow the master movement.. For example, in a 3 x 3 puzzle, if i move the center (piece_2_2), i would get all pieces move together. But for, say, the top left piece (piece_1_1), would only bring piece_1_2, piece_1_3, piece_2_1, piece_3_1 and piece_2_2. the rest would be left behind.. any idea for this problem? thx Guntur N. Sarwohadi On 7/11/06, Hans Wichman [EMAIL PROTECTED] wrote: Hi, does it displace until you stop moving, or displace and screws it up completely? It sounds like either one of the updates you broadcast are not coming through, or the updates are based on the wrong offsets. I assume that if you move a group of 3, the 2 that should be moved automatically ARE displaced by the same amount? Just a shot in the dark here, but when you broadcast to the group, do you skip the source of the event? For example, normally in a group of 2, when you move one, you could either: 1) move the one you moved and dispatch an event to the other 2) create an event and dispatch to the group 3) move the one you moved and dispatch an event to the whole group the 3rd option clearly is invalid, since one piece would be moved twice. And with respect to the somefrogs.com, i had the same impression you had now how do they do that a few weeks ago, and now i know: one step at a time:). Once you have the mask, and the movement correct, you are 80% there;) good luck! JC On 7/11/06, Guntur N. Sarwohadi [EMAIL PROTECTED] wrote: Hi Hans, Hmm.. I'm not sure what was I thinking when I was writing about onEnterFrame, coz like you describe earlier, I didn't use any onEnterFrame either.. gosh, this what happens when you don't have enough coffee with you after 2 days of no sleep :p.. well, anyway, in onMouseMove, I broadcast to piece group members to move as well, with the current piece as reference. Currently I calculated the distance prior broadcast and as the current piece moves, the piece group members would move in the same way without getting off location... but it does.. when you move the mouse fast enough, it displaces.. somefrogs.com... wow! that's so cool.. How you do such a thing?.. it blends in and mostly, the pieces dont fall off when you move the mouse fast enough!... how the...?.. anyone got an idea with my problem? thx! [g] On 7/11/06, Hans Wichman [EMAIL PROTECTED] wrote: Hi, with respect to the combining pieces, why would you use onEnterFrame to update the other pieces? Of course I dont know the details of your implementation, but it would seem that if you had puzzle clumps (in want of a better term), meaning groups of already combined pieces you could either temporarily parent (meaning recreating) the whole clump in a parent clip, and move the parent clip or do something like: puzzlePiece.onMouseMove = { get self.deltaxy if Puzzle.getGroup(self) == null then self.move(deltaxy) else Puzzle.getGroup(self).move(deltaxy); } With respect to the masking and filling through the drawing api, my routine looks like
Re: [Flashcoders] jigsaw puzzle piece algorithm
Thanks guys for the reply. Now I have a better understanding on how to achieve the effect. Currently i'm planning to provide vector puzzle pieces as mask templates first. Once that's done, I would try to start working on dynamically drawing the puzzle nubs and cutouts.. I like the review Neo handed. It explains a lot what Hans described... One question though, whether the sides are drawn by code or provided as vectors, how would you combine 4 of them to make it as a filled masked vector shape using drawing api? One other thing, the puzzle I'm doing would allow users to move puzzle pieces and combine them by side references (like, piece A is always in the left of piece B, while D is always below A, for example). Now I've manage to make each piece move other pieces in one group as a whole (using onMouseMove for the dragger and onEnterFrame by calculating distance with the dragger for the 'dragee') but it seems unoptimized and often lags (which shifts pieces location) if you move the mouse fast. It would look unsticky. Does anyone have an idea for a better algorithm? thx, Guntur N. Sarwohadi PS. Neo, hows the TGB Isometric Add-On doing? :p On 7/11/06, neo binedell [EMAIL PROTECTED] wrote: Try something like this http://www.cedesign.com/cefx/reviews/reviews1_avbros.html ~neo -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guntur N. Sarwohadi Sent: 06 July 2006 03:15 AM To: Flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] jigsaw puzzle piece algorithm I'm working on a puzzle game in flash, much similar to jigsaw puzzles you see in gameHouse or such casual game publisher. I'm having a hard time trying to cut an image to make it as puzzle pieces in AS2. Currently I'm doing it the hard way, cloning bitmapData image, and masking portions of the image. Can you cut parts on an image using bitmapData methods? And does anyone know how to create the infamous jigsaw pattern to it as well? Many thanks, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] jigsaw puzzle piece algorithm
Hi Hans, Hmm.. I'm not sure what was I thinking when I was writing about onEnterFrame, coz like you describe earlier, I didn't use any onEnterFrame either.. gosh, this what happens when you don't have enough coffee with you after 2 days of no sleep :p.. well, anyway, in onMouseMove, I broadcast to piece group members to move as well, with the current piece as reference. Currently I calculated the distance prior broadcast and as the current piece moves, the piece group members would move in the same way without getting off location... but it does.. when you move the mouse fast enough, it displaces.. somefrogs.com... wow! that's so cool.. How you do such a thing?.. it blends in and mostly, the pieces dont fall off when you move the mouse fast enough!... how the...?.. anyone got an idea with my problem? thx! [g] On 7/11/06, Hans Wichman [EMAIL PROTECTED] wrote: Hi, with respect to the combining pieces, why would you use onEnterFrame to update the other pieces? Of course I dont know the details of your implementation, but it would seem that if you had puzzle clumps (in want of a better term), meaning groups of already combined pieces you could either temporarily parent (meaning recreating) the whole clump in a parent clip, and move the parent clip or do something like: puzzlePiece.onMouseMove = { get self.deltaxy if Puzzle.getGroup(self) == null then self.move(deltaxy) else Puzzle.getGroup(self).move(deltaxy); } With respect to the masking and filling through the drawing api, my routine looks like (in pseudo): canvas.clear() canvas.beginFill() drawTop(canvas);drawRight(canvas);drawBottom(canvas);drawLeft(canvas); canvas.endFill(); each draw routine picks up where the first left off, creating a closed shape which can be filled as normal. However if you had different sides drawn as vectors in flash, and convert them to a symbol, and put four of them together, you can't do this, since 4 symbols together of course dont make a closed 'shape'. One other thing though: did you know this one: http://somefrogs.com/ It might be all you need. It lacks a nice bevelled edge around the pieces, which would have been easy to add to your drawn shapes, using a bevelfilter, but it still is a very nice out of the box reusable puzzle component I think. greetz Hans On 7/11/06, Hans Wichman [EMAIL PROTECTED] wrote: Hi, with respect to the combining pieces, why would you use onEnterFrame to update the other pieces? Of course I dont know the details of your implementation, but it would seem that if you had puzzle clumps (in want of a better term), meaning groups of already combined pieces you could either temporarily parent (meaning recreating) the whole clump in a parent clip, and move the parent clip or do something like: puzzlePiece.onMouseMove = { get self.deltaxy if Puzzle.getGroup(self) == null then self.move(deltaxy) else Puzzle.getGroup(self).move(deltaxy); } With respect to the masking and filling through the drawing api, my routine looks like (in pseudo): canvas.clear() canvas.beginFill() drawTop(canvas);drawRight(canvas);drawBottom(canvas);drawLeft(canvas); canvas.endFill(); each draw routine picks up where the first left off, creating a closed shape which can be filled as normal. However if you had different sides drawn as vectors in flash, and convert them to a symbol, and put four of them together, you can't do this, since 4 symbols together of course dont make a closed 'shape'. One other thing though: did you know this one: http://somefrogs.com/ It might be all you need. greetz Hans On 7/11/06, Guntur N. Sarwohadi [EMAIL PROTECTED] wrote: Thanks guys for the reply. Now I have a better understanding on how to achieve the effect. Currently i'm planning to provide vector puzzle pieces as mask templates first. Once that's done, I would try to start working on dynamically drawing the puzzle nubs and cutouts.. I like the review Neo handed. It explains a lot what Hans described... One question though, whether the sides are drawn by code or provided as vectors, how would you combine 4 of them to make it as a filled masked vector shape using drawing api? One other thing, the puzzle I'm doing would allow users to move puzzle pieces and combine them by side references (like, piece A is always in the left of piece B, while D is always below A, for example). Now I've manage to make each piece move other pieces in one group as a whole (using onMouseMove for the dragger and onEnterFrame by calculating distance with the dragger for the 'dragee') but it seems unoptimized and often lags (which shifts pieces location) if you move the mouse fast. It would look unsticky. Does anyone have an idea for a better algorithm? thx, Guntur N. Sarwohadi PS. Neo, hows the TGB Isometric Add-On doing? :p On 7/11/06, neo binedell [EMAIL PROTECTED] wrote: Try something like this http://www.cedesign.com/cefx
[Flashcoders] jigsaw puzzle piece algorithm
I'm working on a puzzle game in flash, much similar to jigsaw puzzles you see in gameHouse or such casual game publisher. I'm having a hard time trying to cut an image to make it as puzzle pieces in AS2. Currently I'm doing it the hard way, cloning bitmapData image, and masking portions of the image. Can you cut parts on an image using bitmapData methods? And does anyone know how to create the infamous jigsaw pattern to it as well? Many thanks, Guntur N. Sarwohadi ___ 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
Re: [Flashcoders] Andre Michelle experiments
Yeah.. I know.. I think he's currently working on new stuff for flash8.. espesially gamepackage.. what source are u talking about? [g] On 2/27/06, Alan Skinner [EMAIL PROTECTED] wrote: Wow had a look at this guys stuff! He's a true genius! Is there any source you can download on the site, I cant find it? ta -- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. This footer also confirms that this email message has been scanned for the presence of computer viruses. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of DA Group. ___ 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