AW: [Flashcoders] Algo's to change the ordering of arrays
Something like a spiral-sort? http://chattyfig.figleaf.com/pipermail/flashcoders/2005-March/134713.html hth - Andreas Weber -Ursprungliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von Mike Mountain Gesendet: Mittwoch, 17. Januar 2007 16:37 An: Flashcoders mailing list Betreff: [Flashcoders] Algo's to change the ordering of arrays I'm looking for some simple algo's to change the ordering of an array which represents squares in a grid: In the first instance I want to translate from 0 3 6 1 4 7 2 5 8 Existing Array=new Array(0,3,6,1,4,7,2,5,8) To: 0 1 2 7 8 3 6 5 4 (0,1,2,7,8,3,6,5,4) Ideally I'd want a whole bunch of these to produce pretty patterns by changin a particular MC's property in the grid. I'm thinking there must be stuff like this already out there - but I'm not even sure what I should be googling! But I want this to be scaleable for any grid, x by y represented by an array. Anyhow - any help would be greatly appreciated. Ta Mike 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] dynamically tween gradient
For an old project I did this 'Gradient Tween Editor' which might be a good starting point for what you want to do: http://motiondraw.com/md/as_samples/t/gradientTween/asynchronousTween.html Here's an example (on the right-hand side) that tweens from one gradient to another over time: http://motiondraw.com/md/as_samples/t/gradientTween/asynchronousTween.html On the left is the same tween, but not over time but from top to bottom - the first horizontal, 1 pixel high stripe corresponds with the 'first frame' of the tween on the right. The stripe at the bottom corresponds with the 'last frame'. See the code below! hth -- Andreas Weber // for the class see: // http://motiondraw.com/md/as_samples/t/gradientTween/gradientTweenEditor.html import com.motiondraw.GradientTween this.createEmptyMovieClip('gradient_mc', this.getNextHighestDepth()) gT = new Object(); gT.colors1 = [10092288,153,65331]; gT.alphas1 = [100,100,100]; gT.ratios1 = [0,208,255]; gT.rotation1 = 0; gT.colors2 = [13052923,16750848,2266464]; gT.alphas2 = [100,100,100]; gT.ratios2 = [0,130,255]; gT.rotation2 = 0; gT.gradModeRotation = 'linear'; gT.gradWidth = 250; // Note: in the asynchronous view // the gradHeight is the number of frames gT.gradHeight = 250; gT.gradient_mc =_level0.gradient_mc; gT.draw = true;// draws the 'synchronous' tween var myGrad:GradientTween = new GradientTween( gT.colors1, gT.alphas1, gT.ratios1, gT.rotation1, gT.colors2, gT.alphas2, gT.ratios2, gT.rotation2, gT.gradModeRotation, gT.gradWidth, gT.gradHeight, gT.gradient_mc, gT.draw); // draws the 'asynchronous tween' var i = 0; var c = this.createEmptyMovieClip('canvas', this.getNextHighestDepth()); c._x = 300; this.onEnterFrame = function(){ var mg = myGrad.multiGradient[i]; mg.r = mg.rotation; c.beginGradientFill(mg.gradModeRotation, mg.colors, mg.alphas, mg.rotation, mg.matrix); c.moveTo(0, 0); c.lineTo(gT.gradWidth, 0); c.lineTo(gT.gradWidth, gT.gradHeight); c.lineTo(0, gT.gradHeight); c.lineTo(0, 0); c.endFill(); i++; if(i == gT.gradHeight + 1){ i = 0; } } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Brantley Sent: Freitag, 15. Dezember 2006 20:59 To: Flashcoders mailing list Subject: [Flashcoders] dynamically tween gradient I'm building a website. The background for each of the sections of the site is a different colored linear gradient. Does anyone have any ideas on how to build a class, prototype or series of functions that will dynamically change the background gradient from one colored gradient to another over a period of time? If anyone has any pre-built code and wouldn't mind sharing I will greatly appreciate it! Thanks ___ 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] FLASC problem
I always get that error when I forget to close an already open swf-preview-window (the one that pops up after testing/compiling) - the newly compiled swf cannot (for some reason) replace the one that is still open in the preview window. I'm using FLASC every day and it has saved me countless hours - thanks a bunch for your great tool, John (and Nicolas of course) -- Andreas Weber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Grden Sent: Dienstag, 17. Oktober 2006 03:54 To: Flashcoders mailing list Subject: Re: [Flashcoders] FLASC problem yeah when using MTASC without flasc that's true, but with FLASC, it fails internally and gives that JSFL message. I need to catch that error and provide a nice message about what could be wrong ___ 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] geometry // oval around text
Sorry, wasn't aware that you were looking for a real ellipse, I thought something nicely ovalish, kind-of-roundish would do :-) You'll find a bit more on CatmullRom here: http://www.mvps.org/directx/articles/catmull/ hth ------ Andreas Weber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthias Dittgen Sent: Freitag, 6. Oktober 2006 13:10 To: Flashcoders mailing list Subject: Re: [Flashcoders] geometry // oval around text Hello Andreas, your CatmullRomSpline is really impressive, but it draws not a real ellipse. If it would, this code should produce a circle, right? var points:Array = new Array( {x: 0, y: 0}, {x: 0, y: 50}, {x:50, y: 50}, {x:50, y: 0}, {x: 0, y: 0}); var spline:CatmullRomSpline = new CatmullRomSpline(points); var approxLineLength:Number = 3; spline.plotAll(mc, approxLineLength); How is the bend of the curve defined? Matthias 2006/10/5, Andreas Weber <[EMAIL PROTECTED]>: > Instead of re-inventing the wheel (which can be a lot of fun!) you > might find it easier to use an already existing Spline class, e.g. my > CatmullRom > Spline: > > http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/closedShape > .html > > The advantage is that you can just pass in the corner points of the > textfield (or, if you want some 'padding', it's easy to calculate the > corners of the outer rectangle) - the spline will automatically curve > through these points. > > > If you are interested in the Math of Splines, don't miss the in-depth > tutorials by Jim Armstrong: http://www.2112fx.com/ > > hth > -- > Andreas Weber > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Matthias Dittgen > Sent: Donnerstag, 5. Oktober 2006 09:41 > To: Flashcoders mailing list > Subject: [Flashcoders] geometry // oval around text > > > Hello, > > I need a tipp for drawing an oval around a dynamic textfield with > variable line numbers and variable width? Perhaps, someone can point > me to a good tutorial dealing with such geometry questions. The > drawOval methods I am using have width and height as parameters, but > of course I can't use width and height of the textfield without a > padding. How can I calculate an i appropriate padding? > The drawOval methods: > > public function drawOval_Old(x:Number, y:Number, width:Number, > height:Number):Void { > movieClip.lineStyle(lw, lc, la); > movieClip.moveTo(x,y+height/2); > movieClip.curveTo(x,y,x+width/2, y); > movieClip.curveTo(x+width,y,x+width, y+height/2); > movieClip.curveTo(x+width,y+height, x+width/2, y+height); > movieClip.curveTo(x,y+height, x, y+height/2); > } > > public function drawOval(x:Number, y:Number, width:Number, > height:Number):Void { > x+=width/2; > y+=height/2; > width/=2; > height/=2; > var j:Number = width * 0.70711; > var n:Number = height * 0.70711; > var i:Number = j - (height - n) * width/height; > var m:Number = n - (width - j) * height/width; > movieClip.lineStyle(lw, lc, la); > movieClip.moveTo(x+width, y); > movieClip.curveTo(x+width, y-m, x+j, y-n); > movieClip.curveTo(x+i, y-height, x, y-height); > movieClip.curveTo(x-i, y-height, x-j, y-n); > movieClip.curveTo(x-width, y-m, x-width, y); > movieClip.curveTo(x-width, y+m, x-j, y+n); > movieClip.curveTo(x-i, y+height, x, y+height); > movieClip.curveTo(x+i, y+height, x+j, y+n); > movieClip.curveTo(x+width, y+m, x+width, y); > } > > Thanks, > Matthias > > > ___ > 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] Weak bounce easing equation
> Is there anywhere I can find a greater range of Penner type easing equations than are normally > around? Specifically I want a much weaker bounce than the usual "easeOutBounce". Try Timothée Groleau's brilliant "Easing Function Generator" - by dragging the control points you can easily shape the easing curve: http://timotheegroleau.com/Flash/experiments/easing_function_generator.htm hth -- Andreas Weber ___ 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] geometry // oval around text
Instead of re-inventing the wheel (which can be a lot of fun!) you might find it easier to use an already existing Spline class, e.g. my CatmullRom Spline: http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/closedShape.html The advantage is that you can just pass in the corner points of the textfield (or, if you want some 'padding', it's easy to calculate the corners of the outer rectangle) - the spline will automatically curve through these points. If you are interested in the Math of Splines, don't miss the in-depth tutorials by Jim Armstrong: http://www.2112fx.com/ hth ------ Andreas Weber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthias Dittgen Sent: Donnerstag, 5. Oktober 2006 09:41 To: Flashcoders mailing list Subject: [Flashcoders] geometry // oval around text Hello, I need a tipp for drawing an oval around a dynamic textfield with variable line numbers and variable width? Perhaps, someone can point me to a good tutorial dealing with such geometry questions. The drawOval methods I am using have width and height as parameters, but of course I can't use width and height of the textfield without a padding. How can I calculate an i appropriate padding? The drawOval methods: public function drawOval_Old(x:Number, y:Number, width:Number, height:Number):Void { movieClip.lineStyle(lw, lc, la); movieClip.moveTo(x,y+height/2); movieClip.curveTo(x,y,x+width/2, y); movieClip.curveTo(x+width,y,x+width, y+height/2); movieClip.curveTo(x+width,y+height, x+width/2, y+height); movieClip.curveTo(x,y+height, x, y+height/2); } public function drawOval(x:Number, y:Number, width:Number, height:Number):Void { x+=width/2; y+=height/2; width/=2; height/=2; var j:Number = width * 0.70711; var n:Number = height * 0.70711; var i:Number = j - (height - n) * width/height; var m:Number = n - (width - j) * height/width; movieClip.lineStyle(lw, lc, la); movieClip.moveTo(x+width, y); movieClip.curveTo(x+width, y-m, x+j, y-n); movieClip.curveTo(x+i, y-height, x, y-height); movieClip.curveTo(x-i, y-height, x-j, y-n); movieClip.curveTo(x-width, y-m, x-width, y); movieClip.curveTo(x-width, y+m, x-j, y+n); movieClip.curveTo(x-i, y+height, x, y+height); movieClip.curveTo(x+i, y+height, x+j, y+n); movieClip.curveTo(x+width, y+m, x+width, y); } Thanks, Matthias ___ 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] strange scope behaviour
AS 1 and 2 actually do have a strange (buggy?) way to handle function definitions in block statements like for, catch, try, finally and if. As there is no block-level scope in ActionScript we'd expect that function definitions are scoped to the parent timeline / surrounding scope - however they are not: { function test(){} trace(test); } Output in AS 1 & 2 : undefined In AS3 however function definitions inside these block statements do behave as expected and are scoped to the surrounding scope (local scope of the function that holds the block or to the timeline the code is on). The output of above sample in AS3 is therefore: function Function() {} Some more info: http://livedocs.macromedia.com/labs/as3preview/docs/0032.html hth ------ Andreas Weber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Weiser Sent: Sonntag, 20. August 2006 18:11 To: Flashcoders mailing list Subject: [Flashcoders] strange scope behaviour Hello, just take a while and try this: function area55() { if (_root) { trace("_root true") function f() { var g; var h; } } //g=0 trace("f "+f) function h() { } function jj() { for (var i in this) { trace(i+" : "+this[i]); } } jj(); } area55(); and this: function area55() { function f() { var g; var h; } //g=0 trace("f "+f) function h() { } function jj() { for (var i in this) { trace(i+" : "+this[i]); } } jj(); } area55(); why the function f is not even seen, after for sure the if statement is true MW ___ 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] Rubiks Cube
Eric Lin, neuro surgeon and brilliant Flash hobbyist, has one: http://www.geocities.com/~dr_ericlin/flash/indexgeo.html hth -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danny Kodicek Sent: Donnerstag, 29. Juni 2006 14:13 To: Flashcoders mailing list Subject: [Flashcoders] Rubiks Cube Just wondering if anyone has any Flash 8 Rubiks Cube code lying around? I can do it myself (the only example I found in a quick search was F5), but I thought it was worth asking if there was an open source version to save me reinventing the wheel. Thanks 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
RE: [Flashcoders] Plot Graph / Spline (was: Help needed)
Sounds like you are looking for a Spline class; http://motiondraw.com/md/as_samples/t/CatmullRomSpline/tween.html And don't miss Jim Armstrong's series of about 8 technotes on different splines: http://www.2112fx.com/blog/ hth ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roliks Long Sent: Donnerstag, 29. Juni 2006 16:50 To: Flashcoders mailing list Subject: [Flashcoders] Help needed Hey guys I have a questionn. My client wants to have flash display a spectrum wave graph. I am using Swift and I know it examines the MP3 during the conversion process and generates spectrum values that can be used to create the spectrum analyzer animation. Wouldnt it be possible to take this information for all 17 values per frame and plot a graphic of the wave (EX: like a sin, cos wave or wav editor). I have tried a couple things and I havent been able to get it to work at all. Any help would be appreciated as I am at a loss and getting frustrated now. Thanks -Ski ___ 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] optimize lineTo algorithm
> Say I have 500 points all fairly close that I'd like to reduce to fewer points. > I guess what I'm really after is an algorithm similar to the "Modify > Shape > Optimize" command in the Flash API. http://www.motiondraw.com/md/as_samples/t/LineGeneralization/demo.html hth -- Andreas Weber motiondraw.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] Re: diagonal slices of a grid (was: Displaying objects)
To get the indeces of the tiles in diagonal 'rows' or 'slices' in a grid you could do something like this: function getDiagonalGridSlices(numRows:Number, numCols:Number, startingCorner:String):Array{ var a1 = new Array(), a2 = new Array(), c = 0; for(var i=0; ihttp://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] Shape tweens through AS?
Actually there are many very interesting uses for code-based Shape Tweening, one of them is to dynamically morph any shape into any other shape. As for finding the coordinates of the points that define the shape: one option is a custom, AS based shape editor / drawing tool. Another one is to draw in the Flash IDE and then extract the drawing data with ASV (using some code by Peter Hall) or Robin Dubreuil's brilliant JSFL script sel2Draw (part of an old SDK). For translating the points of one drawing to the points of the other one - we'd need something analogous to the 'shape-hints' in the IDE. Another, much easier approach, is to just use shapes that have an equal number of defining points, thus making it easy to map each point to a point of the new shape. In this sample http://www.motiondraw.com/md/as_samples/t/cards/2006/FlashCard.php each shape is defined by 60 points - it is then quite straight-forward to morph each shape into a randomly chosen other shape. To make a shape with only 60 defining points look good (smooth) a fast Catmull-Rom spline was helpful: http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/tween.html Shape tweens through AS - not as straight-forward as it would be if we could access the drawing data at runtime, but still possible. hth ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Zeh Fernando Sent: Montag, 6. März 2006 22:08 To: Flashcoders mailing list Subject: Re: [Flashcoders] Shape tweens through AS? >I haven't dug very deeply into the tween class. Anyone know if it is >possible to do shape tweens with it (or has someone written a custom >class to do this)? Well, short answer: you can't do it. It isn't a matter of building classes for it; you can't just modify an existing drawing. There are two things you can do though, depending on what you actually want to build: 1. build a normal shape tween using the timeline, then use any tween class/code to control the playhead on that timeline, so you can go back and forth on the animation, use different times, etc. 2. build objects by code (using the drawing API). Then you'll be fully able to animate each of their points separately. This is overkill though and probably not what you want, since you will not only have to draw all your objects by code, but also need to create code to properly translate the points of one drawing to the other. - Zeh ___ 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] Smoothing lines using bezier
http://motiondraw.com/md/as_samples/t/LineGeneralization/demo.html hth -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ramon Miguel M. Tayag Sent: Samstag, 4. März 2006 03:02 To: FlashCoders Programming Subject: [Flashcoders] Smoothing lines using bezier Is there already existing code for something like this? http://www.simdesign.nl/bezier.html -- Ramon Miguel M. Tayag Managing Director Quirkworks ___ 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 a rope
> and update it - it'd be great to convert all the lines to curves huh? Maybe use a spline class, e.g. Catmull-Rom? http://motiondraw.com/md/as_samples/t/CatmullRomSpline/tween.html Jim Armstrong has a number of great, in-depth technotes on Spline-Math: http://www.2112fx.com/technotes.html hth ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Seb L Sent: Tuesday, February 21, 2006 4:50 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Simulating a rope Thanks Josh, it was pretty much the same sort of techniques that have been presented here, only difference is the specularity which changes brightness depending on the angle of that segment of rope... I'll have to dig it out and update it - it'd be great to convert all the lines to curves huh? Seb Plug-in Media UK www.pluginmedia.net On 20/02/06, Josh McDonald <[EMAIL PROTECTED]> wrote: > > That's nice dude :) I dunno about the rest of this mob, but I'd definitely > like to see the source for that effect. Nicer than most of the other ones > that have been posted. > > -Josh > > -- > > "His comrades fought beside him, Van Owen and the rest... >But of all the thompson gunners- Roland was the best." > > Josh McDonald > Analyst Programmer > Information Technology > Ph: 61 7 3006 6460 > Email: [EMAIL PROTECTED] > > > >>> [EMAIL PROTECTED] 20/02/2006 9:24:14 pm >>> > > We built one for Jak2 a couple of years ago - > http://www.jak2renegade.com(click on the crate on the first scene). If > there's enough demand, I'll dig > out the source code and blog it somewhere. > > cheers > Seb > > On 20/02/06, Luca Candela <[EMAIL PROTECTED]> wrote: > > > > Hi to all, how do I simulate a rope in ActionScript? I've seen something > > like that somewhere, but I'm not able to figure out what it was. > > > > Anyone knows about it? > > > > -- > > MATTEO 25:11 Più tardi arrivarono anche le altre vergini e > incominciarono > > a > > dire: Signore, signore, aprici! > > ___ > > 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 > > > > > > > > > > *** > Messages included in this e-mail and any of its attachments are those > of the author unless specifically stated to represent WorkCover > Queensland. The contents of this message are to be used for the intended > purpose only and are to be kept confidential at all times. > This message may contain privileged information directed only to the > intended addressee/s. Accidental receipt of this information should be > deleted promptly and the sender notified. > This e-mail has been scanned by Sophos for known viruses. > However, no warranty nor liability is implied in this respect. > > > > ___ > 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] checking combinations
Nice! And I was determined not to post again, but at a certain stage my mental block irresistibly kicked in again: why ingeniously bit-wise encode the combinations just to later decode them for better readabilty? Why not drop this altogether as we won't do any encoding: static var STATE_A:Number = 1; // 1 << 0 Define the handlers like handlers = {};// or type it/ make it a class handlers["STATE_A"] = Delegate.create(this,handleAOnly); // etc. And finally: public function handleUpdate(a:Object,b:Object,c:Object,d:Object) { state = 'STATE_'; if(a.selected){ state += 'A'}; if(b.selected){ state += 'B'}; // etc. handlers[state](); } What's the benefit of encoding/decoding numbers? Please enlighten me! Cheers! -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Martin Wood Sent: Thursday, January 26, 2006 11:21 AM To: Flashcoders mailing list Subject: Re: [Flashcoders] checking combinations to be more complete how i would actually program it is like this : import mx.utils.Delegate; class CombinationHandler { // Declare the values used for each state static var STATE_A:Number = 1; // 1 << 0 static var STATE_B:Number = 2; // 1 << 1 static var STATE_C:Number = 4; // 1 << 2 static var STATE_D:Number = 8; // 1 << 3 // Either declare the combinations here, or just use // the STATE_A | STATE_B form in the declare handlers function static var COMBINATION_AB:Number = STATE_A | STATE_B; static var COMBINATION_BC:Number = STATE_B | STATE_C; // array of functions to handle particular states // and state combinations private var handlers:Array; public function CombinationHandler() { handlers = new Array(); createHandlers(); } private function createHandlers() { // single case handlers handlers[STATE_A] = Delegate.create(this,handleAOnly); handlers[STATE_B] = Delegate.create(this,handleBOnly); handlers[STATE_C] = Delegate.create(this,handleCOnly); handlers[STATE_D] = Delegate.create(this,handleDOnly); // combination handlers handlers[COMBINATION_AB] = Delegate.create(this,ABhandler); // OR // handlers[STATE_A | STATE_B] = ... } public function handleUpdate(a:Object,b:Object,c:Object,d:Object) { // 'Digitise' the state from the selected flag in a,b,c,d. var state:Number = (a.selected) | (b.selected << 1) | (c.selected << 2) | (d.selected << 3); // call the function handlers[state](); } } I think this way adding and modifying handlers is easy and safe, youre not editing code thats surrounded by support code (like case:, else if etc) so its clear where each response to a particular state is configured. You can leave the declaration of the combinations out of the static declarations at the top of the class like i said and just create the combinations when defining the handler. That way when you add a combination its just one place to edit, not two, but you may have a case for using that information again so the static var could be useful. I dont know :) btw, in all the places you see | (bitwise OR) you can use + because it works out the same, im just used to using the bitwise operators for dealing with bit-based states and state masks. Similary for the shifts (<<) you can change them for their equivalent multiplication. thanks, Martin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] checking combinations
Ok, ok I'm clearly outnumbered here - waving white flag :-) And the approach Daniel demonstraded (similar to what Martin outlined) is indeed very elegant and succint. When the actions to take (depending on which combination 'is the case') are rather complex, requiring several lines of code, imo the immediately readable 'string-based' switch still has its merits in terms of readability/managability, but I won't insist - up to Eric to pick the one that best matches the needs of his project. Cheers! -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ben Smeets Sent: Thursday, January 26, 2006 8:19 AM To: Flashcoders mailing list Subject: RE: [Flashcoders] checking combinations What he said :) Without kidding, using the binary type of variable values and checking what the resulting value is, is the way we do it. Don't ask me how it works, but it does :) (just to help pointing in the right direction) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Line optimization
An implementation of "Lang Simplification" and "McMaster's Slide Averaging Algorithm": http://motiondraw.com/md/as_samples/t/LineGeneralization/demo.html hth ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Brown Sent: Donnerstag, 26. Januar 2006 02:16 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Line optimization Does anyone know where I can find code or equations for the line optimization of curves? I'm looking for something similar to the way the Flash Authoring Environment implements Modify > Shape > Smooth, Modify > Shape > Straighten, and Modify > Shape > Optimize. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] checking combinations
I guess I must be missing something here - I still don't understand the advantage of 'encoding' the conditions as numbers. As I see it, there is no way around evaluating 16 conditions. We can either make this transparent or we can 'elegantly' hide it behind numbers - which we'll have to comment heavily to 'decode' the meaning of the numbers and to make the code readable for humans. It's about reacting to the possible combinations of 4 different events, right? Let's say the events are 'Inited','Clicked','Bedazzeled','Dragged'. We could now just do this: // When event 'Inited' is dispatched, set the flag Inited to true, etc. combo = ''; if(events[i]){ combo += 'Inited';} if(events[i]){ combo += 'Clicked';} if(events[i]){ combo += 'Bedazzeled';} if(events[i]){ combo += 'Dragged';} switch(combo){ case "": //do stuff here break; case "Bedazzeled": //do stuff here break; case "BedazzeledDragged": //do stuff here break; case "Clicked": //do stuff here break; case "ClickedBedazzeled": //do stuff here break; case "ClickedBedazzeledDragged": //do stuff here break; case "ClickedDragged": //do stuff here break; case "Dragged": //do stuff here break; case "Inited": //do stuff here break; case "InitedBedazzeled": //do stuff here break; case "InitedBedazzeledDragged": //do stuff here break; case "InitedClicked": //do stuff here break; case "InitedClickedBedazzeled": //do stuff here break; case "InitedClickedBedazzeledDragged": //do stuff here break; case "InitedClickedDragged": //do stuff here break; case "InitedDragged": //do stuff here break; } //-- - Imo this is a very readable solution - no comments needed to explain what the code is doing. Above code is generated and traced to the Output window with this: events = ['Inited','Clicked','Bedazzeled','Dragged']; numElems = events.length; combos = new Array(); // find the combinations c=0; while(cmailto:[EMAIL PROTECTED] On Behalf Of eric dolecki Sent: Mittwoch, 25. Januar 2006 21:17 To: Flashcoders mailing list Subject: Re: [Flashcoders] checking combinations Thats interesting. A bit more involved than what I was doing but it is indeed interesting. On 1/25/06, Daniel Cascais <[EMAIL PROTECTED]> wrote: > > What about something like this: > > > var results:Array = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", > "j", "k", "l", "m", "n", "o", "p" ]; > > function getResult( value1:Boolean, value2:Boolean, value3:Boolean, > value4:Boolean ):Number { > var resultIndex:Number = 0; > > if( value1 ) resultIndex |= 8; > if( value2 ) resultIndex |= 4; > if( value3 ) resultIndex |= 2; > if( value4 ) resultIndex |= 1; > > return results[ resultIndex ]; > } > > trace( getResult( true, true, false, true) ); > > /* > Results Table > > value1 value2 value3 value4 Results > 0 0 0 > 0 a > 0 0 0 > 1 b > 0 0 1 > 0 c > 0 0 1 > 1 d > 0 1 0 > 0 e > 0 1 0 > 1 f > 0 1 1 > 0 g > 0 1 1 > 1 h > 1 0 0 > 0 i > 1 0 0 > 1 j > 1 0 1 > 0 k > 1 0 1 > 1 l > 1 1 0 > 0 m > 1 1 0 > 1 n > 1 1 1 > 0 o > 1 1 1 > 1 p > */ > > On 1/25/06, eric dolecki <[EMAIL PROTECTED]> wrote: > > I have 4 variables I need to check the states of routinely... and > > combinations thereof. > > -- > Daniel Cascais > Tel: +56 (0)2 4589495 > Cel: +56 (0)9 9417355 ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] checking combinations
Seems to be an ispiring question/problem! Eric - if you'd go with the combo - Strings - these are the 16 possible combinations: ,a,ab,abc,abcd,abd,ac,acd,ad,b,bc,bcd,bd,c,cd,d (first one is an empty string if a && b && c && d are false) I'm not overly proud of how I found the combinations, but sometimes nothing beats brute force :-) arr = ['a','b','c','d']; numElems = arr.length; combos = new Array(); c=0; while(c<10){ combo = ''; for(var i=0; imailto:[EMAIL PROTECTED] Behalf Of Martin Wood Sent: Wednesday, January 25, 2006 8:05 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] checking combinations i've got to go out now so cant give the full answer i have in my head, but one way of tackling it is to make each state variable's value a power of 2 a = 1 b = 2 c = 4 d = 8 then you know that any combination of them has a unique value. (its basically a 4 bit number) then to handle the dispatch depending on the state combination you can build a function table. functionTable = new Array(); // create a handler for the combination a + b functionTable[a + b] = Delegate.create(this,combinationAB); and when you check the variables just call the function directly from the table : // a,b,c,d are just passed as boolean flags here function handleUpdate(a:boolean,b:boolean,c:boolean,d:boolean) { // taking advantage of a true being 1 in flash // and ideally you would setup these numbers // as static class variables var state = a + (b * 2) + (c * 4) + (d * 8); // call the defined function functionTable[state](); } of course you could do a check first to see if the function is defined and do something like log a warning or whatever is appropriate for your situation. hope that makes sense. martin ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] checking combinations
You seem to have something like a 'Round Robin' situation, only more complex as it is not only about pairs, but also about singles/triplets/quadruplets. If each of these possible combinations leads to a different action, the if/else if or switch statement will naturally be very long... To make it quite a bit more readable and thus managable, maybe you could do combo = ''; if ( a ){ combo += 'a'; } if ( b ){ combo += 'b'; } if ( c ){ combo += 'c'; } if ( d ){ combo += 'd'; } switch(combo){ case 'a': // do stuff brek; case 'ab': // do some other stuff break; case 'abc': //etc. } For finding all the 'pairs' see my RoundRobin class below (used to be in the archives, but can't find it anymore) hth -- Andreas Weber motiondraw.com class com.motiondraw.util.RoundRobin{ /* Usage import com.motiondraw.util.RoundRobin numPlayers = 12; // create players players = new Array(); for(var i=0; imailto:[EMAIL PROTECTED] Behalf Of eric dolecki Sent: Wednesday, January 25, 2006 7:03 PM To: Flashcoders mailing list Subject: [Flashcoders] checking combinations I have 4 variables I need to check the states of routinely... and combinations thereof. I am assuming that if I have a counter, and interogate and += them values, I can then check the value of the counter to determine the combinations. psudeo-code: var counter:Number = 0; if ( a ){ counter += 2; } if ( b ){ counter += 3; } if ( c ){ counter += 6; } if ( d ){ counter += 12;} if ( counter == 2 ){ // only a was true } else if ( counter == 3 ){ // only b was true } ... Which is fine, but thats gonna be one honkin' if else statement to catch all the combinations. Is there a better way of doing this that will catch all the possible combinations in an elegant way? - edolecki ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] getting the name of an object
> shouldn't there be a === or !== in there somewhere to make > sure you're talking about _exactly_ the same object rather > than one which just has the same value..? Good question... In my understanding - i.e. please correct me if I'm wrong! - when testing objects for equality the simple and the strict equality operator are completely interchangeable. We are not comparing values, which can be of different types (and thus provoke 'false positives' with the simple equality operator), but references, which have a simple, 'binary' quality: either they do point at the same place in memory or they don't. And two objects - by definition? - always occupy two distinct locations in memory, completely independent of wether they are of the same type and contain the same values. trace({} == {});// output: false That's why I think that when testing objects for equality, the simple and the strict oprator will always return the same result. -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: Montag, 23. Januar 2006 16:38 To: Flashcoders mailing list Subject: Re: [Flashcoders] getting the name of an object Andreas, Just sight-reading the code rather than testing it - shouldn't there be a === or !== in there somewhere to make sure you're talking about _exactly_ the same object rather than one which just has the same value..? Cheers, Ian On 1/23/06, Andreas Weber <[EMAIL PROTECTED]> wrote: > > If you have a weakness for kludgy solutions, try the 'getObjNames' > function below. > Otherwise: don't 'forget' the names of the objects: store the name in the > same object, as an additional property. > > > // 'don't try this at home!' > > a = {someProp:'someValue'}; > b = {someProp:'someOtherValue'}; > c = a; > > arr = [a, b]; > > > // later, when we have 'forgotten' the names of the objects > > for(var i=0, len=arr.length; i trace(getObjNames(arr[i]) + ' - someProp: '+ arr[i].someProp); > > // Output: c,a - someProp: someValue > // b - someProp: someOtherValue > > } > > > // kludgy, poorly tested and a waste of processor cycles function > getObjNames(o:Object, timeline:MovieClip){ > var names:Array; > var o2 = arguments[1] ? arguments[1] : _level0; > if(!names){names = []} > for(var p in o2){ > if(typeof(o2[p]) == 'object'){ > if(o2[p] != o){ > getObjName(o, o2[p]); > }else{ > names.push(p); > } > } > } > return names; > } > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] getting the name of an object
If you have a weakness for kludgy solutions, try the 'getObjNames' function below. Otherwise: don't 'forget' the names of the objects: store the name in the same object, as an additional property. // 'don't try this at home!' a = {someProp:'someValue'}; b = {someProp:'someOtherValue'}; c = a; arr = [a, b]; // later, when we have 'forgotten' the names of the objects for(var i=0, len=arr.length; imailto:[EMAIL PROTECTED] Behalf Of Sascha Balkau Sent: Monday, January 23, 2006 2:03 PM To: flashcoders Subject: [Flashcoders] getting the name of an object hi, this might be obvious but how do I get the name of an object? If I got an object named fooObj how can I get Flash to for example trace out the name of the object, so that it traces "fooObj"? I know this works with movieclips but how about objects or arrays? Sascha ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] expanding a second array given values of the firstarray
Like so? taskSet = [2,1,5,1,3]; taskSetExpanded = new Array(); for(var i=0, len=taskSet.length; imailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Donnerstag, 19. Januar 2006 21:02 To: Flashcoders mailing list Subject: [Flashcoders] expanding a second array given values of the firstarray Should be pretty straightforward, but I am having trouble wrapping my head around it. I want to create an array of N length, which is expanded according to the values of another array. What I mean is, for example: taskSet = [2,1,5,1,3] //values of how much the new array should expand I want to, based on the values of the taskSet array, make a running add-up total of the values of taskSet & repeat that number in the final array taskSet[n] times in the new taskSetExpanded array. I do not mean just add up the values of taskSet which I already know how to do (though by so doing, I know that also shows the length of the final array). So (and this may be the easiest way to explain) given the array: taskSet = [2,1,5,1,3]; The taskSetExapanded array would then become an array with these exact values: [2,2,3,8,8,8,8,8,9,12,12,12] ...where for example, the number 8 as seen in the array(8 comes from the running total of 2+1+5 from TaskSet) is repeated 5 times (where 5 is the value of taskSet[3]) ..and where for example the number 9 as seen in the array (9 comes from the running total of 2+1+5+1 from TaskSet) is repeated 1 time (where 1 is the value of taskSet[4]) Etc. Make sense? Perhaps I over explained. I have tried numerous for loops and never been able to get the final result I need. Any help is appreciated. Thanks! Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Q:Tracing out objects in an array
Very convenient: mx.data.binding.ObjectDumper http://weblogs.macromedia.com/dehaan/archives/2005/04/hidden_componen.cf m hth -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Donnerstag, 19. Januar 2006 00:18 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Q:Tracing out objects in an array Hi I'm populating an array with objects. When I trace out the array I get ==[object Object] Whats the best way to trace out the contents of the objects once they're in the array? Thansk in advance Jim Bachalo [e] jbach at bitstream.ca [c] 416.668.0034 [w] www.bitstream.ca "...all improvisation is life in search of a style." - Bruce Mau,'LifeStyle' ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] photo mosaics
Despite the Bitmap API in Flash 8, I'd still recommend to use the GD library of PHP to do this, mainly for saving the resulting mosaic. Either way, you'll have to: - 'homogenize' the size of the images in the pool. They will come in different orientations and sizes now, but in the end you have to map them to one of the square-shaped pixels in the target image. Cut out the central square part and size each to e.g. 100x100 pixels. - store the average color of each picture in a database. Get the average color by scaling a copy of the image down to 1x1 pixel, GD (or Flash) will do the work of calculating the average value. You may get better results by scaling down in several steps. - the average color is a value between 0 and > 16 millions - but the pool consists of only 3'000 images. To find a match for each pixel in the target image we'll not be able to work with identical colors, we'll have to find similar colors. Finding the closest 'websafe' color might be a good approach: http://chattyfig.figleaf.com/pipermail/flashcoders/2005-July/143567.html Now that the we have indexed all images and saved their average color in the db, we can take any other image, iterate through each pixel, get its color (probably convert to 'websafe'), search the db for images with matching colors, randomly select one of them, add it to the big, emerging mosaic. Be aware that these operations are very heavy on any processor (after indexing several ten-thousands 'googled' images, my ISP disabled the PHP script because it ate to many processor cycles...) If you do not need to do this 'on the fly' (and prepare for a rather slow flight...) I don't see a good reason why you would want to program this yourself - there are several programs, even free ones, out there (google). hth -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Dienstag, 17. Januar 2006 22:32 To: Flashcoders mailing list Subject: RE: [Flashcoders] photo mosaics No one has replied to this post of mine so I am wondering if there is a better way to describe what I am doing could it be some thing else I need to look into first to accomplish this? Thanks! Corban Baxter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Tuesday, January 17, 2006 11:50 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] photo mosaics Hey guys do you all by chance remember seeing a site that used flash to create photo mosaics of an image you upload to the site. I am looking to do the same thing but I am not sure where to start. I have this database with about 3,000 images I'd like to use to make photo mosaics out of. Does anyone remember the site for one and for two know of any tutorials that would get me started in creating this application. Thanks for the help everyone! Corban Baxter ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] TreeDataProvider - "There is no method with thename'addTreeNode'"
In the light of longer compilation times and the hours wasted with issues like this... Shouldn't we consider the claim that strict-typing cuts down developement time as one of those completely unfounded urban legends? ;-) > mx.controls.treeclasses.TreeDataProvider Sounds great, but I still don't get it to work - no compiler error, but also no node added: import mx.controls.treeclasses.TreeDataProvider class Test{ function Test(){ var myTreeDP:TreeDataProvider = TreeDataProvider(new XML()); myTreeDP.addTreeNode("node", 0); trace('cast to TreeDataProvider '+myTreeDP); // avoid Compiler error when publishing for Player 7 var myTreeDP = new XML(); myTreeDP.addTreeNode("node", 0); trace('untyped '+myTreeDP); } } Output: cast to TreeDataProvider null untyped Cheers! -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Johannes Nel Sent: Thursday, January 12, 2006 3:21 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] TreeDataProvider - "There is no method with thename'addTreeNode'" mx.controls.treeclasses.TreeDataProvider you need to get a good editor :) On 1/11/06, Derek Lords <[EMAIL PROTECTED]> wrote: > > "missing intrinsic class issue" good guess.This happened to me upon > upgrading to Flash 8. I had to downgrade each instance to an Object and > the > problem went away. > > > > > > > >From: "Andreas Weber" <[EMAIL PROTECTED]> > >Reply-To: Flashcoders mailing list > >To: "Flashcoders" > >Subject: [Flashcoders] TreeDataProvider - "There is no method with the > >name'addTreeNode'" > >Date: Wed, 11 Jan 2006 16:13:26 +0100 > > > >With a Tree component on stage and this framecode > > > > var myTreeDP:XML = new XML(); > > myTreeDP.addTreeNode("node", 0); > > > >the TreeDataProvider API works fine. > > > >However, the same code in a class > > > > class Test{ > > function Test(){ > > var myTreeDP:XML = new XML(); > > myTreeDP.addTreeNode("node", 0); > > } > > } > > > >instantiated from a .fla that has a Tree component on stage, throws a > >compiler error: > > > > "There is no method with the name 'addTreeNode'" > > > >Is this a missing intrinsic class issue? Workarounds? (don't have any > luck > >with avoiding the compiler error through Array access syntax: no error, > but > >no node is added). > > > >Cheers! > > > >-- > >Andreas Weber > >motiondraw.com > > > > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] TreeDataProvider - "There is no method with thename'addTreeNode'" - SOLVED
Thanks Derek - that's it! Not typing the dataprovider as XML allows to publish for Player 7: import mx.controls.Tree; class Test{ function Test(){ // Published for Player 7. Error: There is no method with the name 'addTreeNode'. //var myTreeDP:XML = new XML(); // Compiles fine when not typed as XML var myTreeDP = new XML(); myTreeDP.addTreeNode("node", 0); } } Cheers! ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Derek Lords Sent: Donnerstag, 12. Januar 2006 05:11 To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] TreeDataProvider - "There is no method with thename'addTreeNode'" "missing intrinsic class issue" good guess.This happened to me upon upgrading to Flash 8. I had to downgrade each instance to an Object and the problem went away. >From: "Andreas Weber" <[EMAIL PROTECTED]> >Reply-To: Flashcoders mailing list >To: "Flashcoders" >Subject: [Flashcoders] TreeDataProvider - "There is no method with the >name'addTreeNode'" >Date: Wed, 11 Jan 2006 16:13:26 +0100 > >With a Tree component on stage and this framecode > > var myTreeDP:XML = new XML(); > myTreeDP.addTreeNode("node", 0); > >the TreeDataProvider API works fine. > >However, the same code in a class > > class Test{ > function Test(){ > var myTreeDP:XML = new XML(); > myTreeDP.addTreeNode("node", 0); > } > } > >instantiated from a .fla that has a Tree component on stage, throws a >compiler error: > > "There is no method with the name 'addTreeNode'" > >Is this a missing intrinsic class issue? Workarounds? (don't have any >luck with avoiding the compiler error through Array access syntax: no >error, but no node is added). > >Cheers! > >-- >Andreas Weber >motiondraw.com > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] TreeDataProvider - "There is no method withthename'addTreeNode'"
Thanks Johannes - this import mx.controls.Tree; import mx.*; class Test{ function Test(){ //var myTreeDP:XML = new XML(); var myTreeDP:TreeDataProvider = TreeDataProvider (new XML()); myTreeDP.addTreeNode("node", 0); } } gives the error The class or interface 'TreeDataProvider' could not be loaded. In which package is the TreeDataProvider (the docs don't tell)? ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johannes Nel Sent: Mittwoch, 11. Januar 2006 22:41 To: Flashcoders mailing list Subject: Re: [Flashcoders] TreeDataProvider - "There is no method withthename'addTreeNode'" var myTreeDP:TreeDataProvider = TreeDataProvider (new XML()); myTreeDP.addTreeNode("node", 0); thjis might just fail silently though, but should work is an example of how we use it. On 1/11/06, Andreas Weber <[EMAIL PROTECTED]> wrote: > > > cast it. > > how? > > Could you elaborate a bit? Thanks! > > -- > Andreas Weber > motiondraw.com > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Johannes Nel > Sent: Mittwoch, 11. Januar 2006 21:57 > To: Flashcoders mailing list > Subject: Re: [Flashcoders] TreeDataProvider - "There is no method with > thename'addTreeNode'" > > > cast it. > > On 1/11/06, Andreas Weber <[EMAIL PROTECTED]> wrote: > > > > Thanks Devendran - > > This should do it and usually does do it... > > > > However in the context of my project I got the 'no method with the > > name 'addTreeNode' error, no matter in how many even remotely > > related classes I put the import statement. Now, after a lot of > > digging, cursing, ASO file deleting and hair pulling I found the > > culprit: I was publishing for Player 7. Published for Player 8 it > > compiles just fine. (Reproducable by publishing the simple test case > > for Player 7 / > 8) > > > > Does not make any sense to me and at the moment I'd really still > > prefer to publish for 7... > > > > Cheers! > > -- > > Andreas Weber > > motiondraw.com > > > > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of > > Devendran I > > Sent: Mittwoch, 11. Januar 2006 17:24 > > To: Flashcoders mailing list > > Subject: Re: [Flashcoders] TreeDataProvider - "There is no method > > with > > > thename 'addTreeNode'" > > > > > > Hi > > > > use this code in your Class file > > import mx.controls.Tree; > > > > > > And then compile the Movie. > > > > > > Devendran.I > > > > > > > > Andreas Weber <[EMAIL PROTECTED]> wrote: > > With a Tree component on stage and this framecode > > > > var myTreeDP:XML = new XML(); > > myTreeDP.addTreeNode("node", 0); > > > > the TreeDataProvider API works fine. > > > > However, the same code in a class > > > > class Test{ > > function Test(){ > > var myTreeDP:XML = new XML(); > > myTreeDP.addTreeNode("node", 0); > > } > > } > > > > instantiated from a .fla that has a Tree component on stage, throws > > a compiler error: > > > > "There is no method with the name 'addTreeNode'" > > > > Is this a missing intrinsic class issue? Workarounds? (don't have > > any luck with avoiding the compiler error through Array access > > syntax: no error, but no node is added). > > > > Cheers! > > > > -- > > Andreas Weber > > motiondraw.com > > > > > > > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > > > > > - > > Yahoo! Photos > > Got holiday prints? See all the ways to get quality prints in your > > hands ASAP. ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > -- > j:pn > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- j:pn ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] TreeDataProvider - "There is no method with thename'addTreeNode'"
> cast it. how? Could you elaborate a bit? Thanks! -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johannes Nel Sent: Mittwoch, 11. Januar 2006 21:57 To: Flashcoders mailing list Subject: Re: [Flashcoders] TreeDataProvider - "There is no method with thename'addTreeNode'" cast it. On 1/11/06, Andreas Weber <[EMAIL PROTECTED]> wrote: > > Thanks Devendran - > This should do it and usually does do it... > > However in the context of my project I got the 'no method with the > name 'addTreeNode' error, no matter in how many even remotely related > classes I put the import statement. Now, after a lot of digging, > cursing, ASO file deleting and hair pulling I found the culprit: > I was publishing for Player 7. Published for Player 8 it compiles just > fine. (Reproducable by publishing the simple test case for Player 7 / 8) > > Does not make any sense to me and at the moment I'd really still > prefer to publish for 7... > > Cheers! > -- > Andreas Weber > motiondraw.com > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Devendran I > Sent: Mittwoch, 11. Januar 2006 17:24 > To: Flashcoders mailing list > Subject: Re: [Flashcoders] TreeDataProvider - "There is no method with > thename 'addTreeNode'" > > > Hi > > use this code in your Class file > import mx.controls.Tree; > > > And then compile the Movie. > > > Devendran.I > > > > Andreas Weber <[EMAIL PROTECTED]> wrote: > With a Tree component on stage and this framecode > > var myTreeDP:XML = new XML(); > myTreeDP.addTreeNode("node", 0); > > the TreeDataProvider API works fine. > > However, the same code in a class > > class Test{ > function Test(){ > var myTreeDP:XML = new XML(); > myTreeDP.addTreeNode("node", 0); > } > } > > instantiated from a .fla that has a Tree component on stage, throws a > compiler error: > > "There is no method with the name 'addTreeNode'" > > Is this a missing intrinsic class issue? Workarounds? (don't have any > luck with avoiding the compiler error through Array access syntax: no > error, but no node is added). > > Cheers! > > -- > Andreas Weber > motiondraw.com > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > - > Yahoo! Photos > Got holiday prints? See all the ways to get quality prints in your > hands ASAP. ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- j:pn ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] TreeDataProvider - "There is no method with thename 'addTreeNode'"
Thanks Devendran - This should do it and usually does do it... However in the context of my project I got the 'no method with the name 'addTreeNode' error, no matter in how many even remotely related classes I put the import statement. Now, after a lot of digging, cursing, ASO file deleting and hair pulling I found the culprit: I was publishing for Player 7. Published for Player 8 it compiles just fine. (Reproducable by publishing the simple test case for Player 7 / 8) Does not make any sense to me and at the moment I'd really still prefer to publish for 7... Cheers! ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Devendran I Sent: Mittwoch, 11. Januar 2006 17:24 To: Flashcoders mailing list Subject: Re: [Flashcoders] TreeDataProvider - "There is no method with thename 'addTreeNode'" Hi use this code in your Class file import mx.controls.Tree; And then compile the Movie. Devendran.I Andreas Weber <[EMAIL PROTECTED]> wrote: With a Tree component on stage and this framecode var myTreeDP:XML = new XML(); myTreeDP.addTreeNode("node", 0); the TreeDataProvider API works fine. However, the same code in a class class Test{ function Test(){ var myTreeDP:XML = new XML(); myTreeDP.addTreeNode("node", 0); } } instantiated from a .fla that has a Tree component on stage, throws a compiler error: "There is no method with the name 'addTreeNode'" Is this a missing intrinsic class issue? Workarounds? (don't have any luck with avoiding the compiler error through Array access syntax: no error, but no node is added). Cheers! -- Andreas Weber motiondraw.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders - Yahoo! Photos Got holiday prints? See all the ways to get quality prints in your hands ASAP. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] TreeDataProvider - "There is no method with the name 'addTreeNode'"
With a Tree component on stage and this framecode var myTreeDP:XML = new XML(); myTreeDP.addTreeNode("node", 0); the TreeDataProvider API works fine. However, the same code in a class class Test{ function Test(){ var myTreeDP:XML = new XML(); myTreeDP.addTreeNode("node", 0); } } instantiated from a .fla that has a Tree component on stage, throws a compiler error: "There is no method with the name 'addTreeNode'" Is this a missing intrinsic class issue? Workarounds? (don't have any luck with avoiding the compiler error through Array access syntax: no error, but no node is added). Cheers! -- Andreas Weber motiondraw.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Registration points
> This thing is driving me crazy. You're certainly not the first one, if this is any consolation ;-) The x and y values in the Property Inspector can refer to one of 3 things: - registration point (the little cross) - upper left corner - transformation/(rotation) point (the little circle), which is purely an authortime thing The basic flaw of this part of the GUI is that there is no indication which is the currently active view. And how the user - usually inadvertedly - switches between one of these views is obscure, weird and buggy. See the comment on this page: http://livedocs.macromedia.com/flash/mx2004/main_7_2/0189.html A very expert Flash user who got confused by this once referred to this phenomenon as 'Who moved my fridge while I wasn't looking?'. It's in the bugbase - let's hope they'll fix this for Flash 9. HTH -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Danny Kodicek Sent: Thursday, December 29, 2005 1:31 PM To: Flashcoders mailing list Subject: [Flashcoders] Registration points Could someone point me to a very clear explanation of exactly how Flash calculates the position of a movieClip? I'm starting to get very fed up with the weird behaviour of the thing I'm working on (importing and creating a bunch of lines based on external data using jsfl). What actually *are* the numbers in the X,Y fields at the bottom? How are they calculated? It certainly doesn't seem to be anything nearly as obvious as the position of the registration point. Is there some kind of internal process which is remembering previous contents of the movieClip and positioning it on that basis? This thing is driving me crazy. Danny ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] "scribbling" an oval
> What sample are you referring to? 'cause my stuff is still online ;-) Sorry, hadn't reallized that the link had just an unwanted line-break. All fine now! > Yeah I also thought about doing pre-recorded paths but I though > it was gonna look cooler if it were totally random :-) Note that the pre-recorded path is just used as a 'matrix' which is then altered by random factors. I don't think that 'totally random' will work for anything but a chaotic scribble - you'll need some original 'matrix' for the shape, either constructed mathematically or drawn manually. HTH -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Serge Jespers Sent: Wednesday, December 28, 2005 3:59 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] "scribbling" an oval Yeah I also thought about doing pre-recorded paths but I though it was gonna look cooler if it were totally random :-) What sample are you referring to? 'cause my stuff is still online ;-) S > The sample you originally posted is not accessible anymore, so my > take on > this might be off-base: > > http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/ > scribbledOval.htm > l > > This approach is more about 'scribbling' than Math - > > First several ovals are manually drawn with this tool > http://www.motiondraw.com/md/as_samples/t/LineGeneralization/demo.html > > Now each time the mouse is clicked one of the pre-recorded paths is > selected, some random is applied to its coordinates, it is smoothed > again > and finally it is rendered as Catmull Rom spline: > http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/tween.html > > Post again if you need more details/code! > > HTH > -- > Andreas Weber > motiondraw.com > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] "scribbling" an oval
The sample you originally posted is not accessible anymore, so my take on this might be off-base: http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/scribbledOval.htm l This approach is more about 'scribbling' than Math - First several ovals are manually drawn with this tool http://www.motiondraw.com/md/as_samples/t/LineGeneralization/demo.html Now each time the mouse is clicked one of the pre-recorded paths is selected, some random is applied to its coordinates, it is smoothed again and finally it is rendered as Catmull Rom spline: http://www.motiondraw.com/md/as_samples/t/CatmullRomSpline/tween.html Post again if you need more details/code! HTH ------ Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Serge Jespers Sent: Wednesday, December 28, 2005 2:44 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] "scribbling" an oval It's supposed to be the drawing API ;-) Positioning an animated MC would be the easy way and I always seem to go for the not so easy way ;-) I got this far (ahum) > http://webkitchen.be/downloads/scribble.swf And now I need a mathematician to fix the coordinates :p Obviously, this is totally wrong ;-) but hey... at least I'm trying here ;-) Oh man... I can totally see my math-teacher laughing his ass off right now... makeOvalCoordinates = function (w, h, p) { if (p<=1) { nx = w/2; ny = h/2; } else { if (nx>= -w/2){ nx -= 10; } else { nx+=10; } if (ny>=-h/2){ ny -= 10; } else { ny+=10; } } return {x:nx, y:ny}; }; > Are you trying to position an animated movieClip Serge, or use the > drawing API to draw scribbles? Because it sound like the > suggestions you're getting are the latter solution. > > S ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] onload(Success:Boolean) - what's it mean?
Good to know - thanks for the pointer! Andreas Weber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: Donnerstag, 15. Dezember 2005 20:43 To: Flashcoders mailing list Subject: Re: [Flashcoders] onload(Success:Boolean) - what's it mean? HI Andreas, I have definitely had issues where declaring the two in the wrong order has meant that the onLoad doesn't get called. Can't remember specifics - but there are definitely cases where it's a problem. (From what I remember, executing within Zinc and loading from the local file system was one case...) Cheers, Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] onload(Success:Boolean) - what's it mean?
> Just a quick observation: your onLoad should appear in code above the > actual sendAndLoad function. Does it - readability apart - really matter? Let's run a little test and make a really small and fast load: a textfile that just contains the string x=small And in the .fla: lv = new LoadVars(); lv.load('test.txt'); // waste much more time than the load can possibly take while(getTimer() < 5000){}; lv.onLoad = function(s){ trace('onLoad is called, success :'+s); } The onLoad handler is called just fine even though it is declared several seconds after load() is called. It seems to be quite safe to assume that with asynchronous load operations the onData and onLoad events are dispatched with a delay of at least one frame. hth Andreas Weber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of eric dolecki Sent: Donnerstag, 15. Dezember 2005 15:02 To: Flashcoders mailing list Subject: Re: [Flashcoders] onload(Success:Boolean) - what's it mean? Just a quick observation: your onLoad should appear in code above the actual sendAndLoad function. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] universal toString() function
Helen, Jobe - thanks for your replies! Jobe: excellent, that comes very close and does help. The only issue I had was that the for-in loop messes up the order of the items in the Array. While for one-dimensional Arrays it's just reversed and can be 'cured' easily by a call to Array.reverse(), with multi-dimensional Arrays the order of the for-in loop is a non-intuitive mess. Taking your ideas and starting over I came up with this: /* Accepts a complex object and returns its String representation Handy for saving complex data structures as Strings The object may contain nested Variables of the following types: Object, Array, String, Number, Boolean Example: o = {a:1, b:'Beta', c:{c1:["c1_0", "c1_1", "c1_2"], c2:true}}; var s:String = stringify(o); trace(s); // Output: // {a:1, b:"Beta", c:{c1:["c1_0", "c1_1", "c1_2"], c2:true}} */ function stringify(o:Object):String { s = arguments[1] ? s : ''; var isArray:Boolean = o instanceof Array ? true : false; s += isArray ? '[' : '{'; if(isArray) { for(var i=0, len=o.length; imailto:[EMAIL PROTECTED] On Behalf Of Jobe Makar Sent: Mittwoch, 7. Dezember 2005 17:14 To: Flashcoders mailing list Subject: Re: [Flashcoders] universal toString() function Hi Andreas, Give this a shot I think it will do what you need. Its a little messy since I just typed it really quick. Hope it helps: //---Some contrived complex structure to trace var myOb = new Object(); myOb.name = "jobe" myOb.animals = ["free", "gulliver"]; myOb.someArr = [{email:"[EMAIL PROTECTED]", vocation:"programmer", male:true, hasKids:false}, 30]; //-- checkIt(); function checkIt() { var output:String = inspect(myOb, ""); trace(output); } function inspect(ob, str, parent) { if (ob instanceof Array) { str += "["; } else if (ob instanceof Object) { str += "{"; } var firstone:Boolean = true; for (var i in ob) { var type = typeof ob[i]; if (!firstone) { str += ", "; } else { firstone = false; } if (type == "object") { var val = inspect(ob[i], "", ob); if (ob instanceof Array) { str += val; } else { str += i+": "+val; } } else { if (ob instanceof Array) { str += interpretValue(ob[i]) } else if (ob instanceof Object) { str += i+":"+interpretValue(ob[i]); } } } if (ob instanceof Array) { str += "]"; } else if (ob instanceof Object) { str += "}"; } return str; } function interpretValue(val) { if (Number(val) === val){ //number return val; } else if (val == true || val == false) { return val; } else { return "'"+val+"'"; } return val; } Jobe Makar http://www.electrotank.com http://www.electro-server.com phone: 919-609-0408 mobile: 919-610-5754 fax: 919-341-8104 - Original Message - From: "Andreas Weber" <[EMAIL PROTECTED]> To: "Flashcoders" Sent: Wednesday, December 07, 2005 10:14 AM Subject: [Flashcoders] universal toString() function > I'm quite sure that this must be around somewhere, but this time I didn't > have any luck searching the archives... > > What I'm looking for is similar to a deep-copy/clone method (e.g. > Arul/Tatsuo > http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2004-March/106149 .htm > l) but instead of getting a clone of the object in return, I'd like to get > a > String representation of the object. > > Example of the desired functionality: > > o = {a:1, b:2, c:{c1:['a','b','c'], c2:true}}; > var s:String = universalToString(o); > trace(s); > > Output: {a:1, b:2, c:{c1:['a','b','c'], c2:true}} > > In my case the object will not contain any methods, just (deeply nested) > 'vanilla' Objects, Arrays, Strings, Numbers and Booleans. > > Thanks for any pointers! > > -- > Andreas Weber > motiondraw.com > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] universal toString() function
I'm quite sure that this must be around somewhere, but this time I didn't have any luck searching the archives... What I'm looking for is similar to a deep-copy/clone method (e.g. Arul/Tatsuo http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2004-March/106149.htm l) but instead of getting a clone of the object in return, I'd like to get a String representation of the object. Example of the desired functionality: o = {a:1, b:2, c:{c1:['a','b','c'], c2:true}}; var s:String = universalToString(o); trace(s); Output: {a:1, b:2, c:{c1:['a','b','c'], c2:true}} In my case the object will not contain any methods, just (deeply nested) 'vanilla' Objects, Arrays, Strings, Numbers and Booleans. Thanks for any pointers! -- Andreas Weber motiondraw.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE:[Flashcoders] Q:Animating a gradient
Maybe describe the effect a bit? http://motiondraw.com/md/as_samples/t/gradientEye/ Probably not what you want, it's not even Flash 8... HTH -- Andreas Weber motiondraw.com Hi Has anyone seen examples of animating a gradient in flash8? Recall seeing something as part of the original maelstrom demo, but having some difficulty reproducing the effect. Thanks in advance Jim Bachalo [e] jbach at bitstream.ca [c] 416.668.0034 [w] www.bitstream.ca "...all improvisation is life in search of a style." - Bruce Mau,'LifeStyle' ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Drawing gradients
Flash's Drawing API only supports linear (or radial) gradients, to get '2D' or 'tweened' gradients we have to programmatically 'concatenate' 1-pixel wide gradient-stripes. My GradientTween class does just this. Use this visual Editor to generate the necessary code: http://www.motiondraw.com/md/as_samples/t/gradientTween/gradientTweenEditor. html HTH -- Andreas Weber motiondraw.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Claudia Barnal Sent: Friday, November 18, 2005 3:15 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Drawing gradients Hi guys. I have tried to create a four colored gradient through AS, but I am not really getting any results. One example can be found here: http://www.fnordware.com/superpng/samples.html Im not really sure what the name of these type of gradients are, but they are usually found in color selectors in graphics tools i.e. Photoshop. And have four colors equally bended from each corner. Could you give me a hint on how I could achieve this kind of help? TIA Claudia ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] gradient fills based on temperature maps
Oops, just realized that when running my code in Flash 8 nothing shows up - because the drawing is just outside the bounds of the stage. After line 52 or so canvas._x = i; just add canvas._y = canvas._height; Find the corrected code below. hth -- Andreas Weber motiondraw.com temperatureValues = new Array(); // create some random temperature data for(var i= 0; i<400; i++){ lastVal = i ? temperatureValues[i-1] : 50; if(lastVal > 100){ c = -1; }else if(lastVal < 0){ c = 1; }else{ c = Math.random() > 0.5 ? 1 : -1; } temperatureValues[i] = lastVal + c; } neutralColor = 0x00; coldColor = 0x66;// temperature = 0 hotColor = 0xFF;// temperature = 100 hotColdRange = colorRange(coldColor, hotColor, 100); drawGraph(); function drawGraph(){ for(var i=0, len=temperatureValues.length; i> 16, g:(c1 & 0x00FF00) >> 8, b:c1 & 0xFF}; var c2 = {r:(c2 & 0xFF) >> 16, g:(c2 & 0x00FF00) >> 8, b:c2 & 0xFF}; var r = (c2.r-c1.r)/(n-1); var g = (c2.g-c1.g)/(n-1); var b = (c2.b-c1.b)/(n-1); var color_arr = new Array(); for(var i=0, len=n; ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] gradient fills based on temperature maps
If I understand what you're trying to achieve, you'll need not only one gradient but a large number of them. Basically a linear gradient tweens 2 or more color values in _one_ direction, e.g. red to green to grey on the x-axis. It is not possible to fill a rectangle with a gradient where e.g. all 4 corners have different colors. To get this gradient in 2 directions, on the x and the y axis, we'll have to 'concatenate' the gradient using a big number of 1-pixel wide gradient stripes. This principle is applied in this gradient tween editor: http://motiondraw.com/md/as_samples/t/gradientTween/gradientTweenEditor.html (drag in more color tabs and turn the 'knobs' for rotation) For a 'kind of borealis style pseudo temperature graph' you could start with something like this: temperatureValues = new Array(); // create some random temperature data for(var i= 0; i<400; i++){ lastVal = i ? temperatureValues[i-1] : 50; if(lastVal > 100){ c = -1; }else if(lastVal < 0){ c = 1; }else{ c = Math.random() > 0.5 ? 1 : -1; } temperatureValues[i] = lastVal + c; } neutralColor = 0x00; coldColor = 0x66;// temperature = 0 hotColor = 0xFF;// temperature = 100 hotColdRange = colorRange(coldColor, hotColor, 100); drawGraph(); function drawGraph(){ for(var i=0, len=temperatureValues.length; i> 16, g:(c1 & 0x00FF00) >> 8, b:c1 & 0xFF}; var c2 = {r:(c2 & 0xFF) >> 16, g:(c2 & 0x00FF00) >> 8, b:c2 & 0xFF}; var r = (c2.r-c1.r)/(n-1); var g = (c2.g-c1.g)/(n-1); var b = (c2.b-c1.b)/(n-1); var color_arr = new Array(); for(var i=0, len=n; imailto:[EMAIL PROTECTED] Behalf Of Andreas Rønning Sent: Friday, November 04, 2005 9:46 AM To: Flashcoders mailing list Subject: [Flashcoders] gradient fills based on temperature maps I'm building a temperature grid in a 2d array, where i'd like to build some kind of smooth gradient based on the entire map. For instance this map can start red in the top left, fade to a cool blue near the center, then flare into red again off to the right, while everything else becomes a green tinted blue. As is i could use the drawing api to draw colored blocks to give the impression of such a map, but ideally i'd be able to smooth out the values with gradients, because the map is really quite low res. Anyone got any ideas for this? - Andreas ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] > Normalizing point
Another option: use my LineGeneralization class www.motiondraw.com/md/as_samples/drawing/lineGeneralizationDemo/demo.html An excellent explanation/visualisation of the implemented algos - Lang Simplification and McMaster's Slide Averaging Algorithm - is found at http://www.sli.unimelb.edu.au/gisweb/LGmodule/LGSelect.htm (thanks to Jim Cheng) What is still missing in this context is a good AS spline function: feed in an arbitrary number of points, get back - reasonably fast... - a number of quadratic bezier curves that connect the points in an elegant way. This would allow to reduce the number of points drastically while still getting visually acceptable results (as you'll see, I'm using a over-simplistic approach in the demo to draw the 'pseudo-spline' which will not always produce elegant results...) For math buffs: Jim Fitzsimmons has several interesting-looking articles on Bézier Curves http://www.tinaja.com/third01.asp which might be helpful (not for me though - that's _far_ beyond me...) But I guess that it's not so much about mathematical precision as about finding an approximation that is fast enough to be processed by Flash... Martin? Helen? How about reviving the good ol' hardcore Math/Trig sessions on flashcoders? :-) HTH -- Andreas Weber motiondraw.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders