7 Replies Latest reply on Jun 5, 2012 12:28 AM by manojb05

    Flame Effect

    manojb05 Level 1

      Dear all,

      I am make a flame but smoothness & running of flame is not correct,

      Please help this weblink

        • 1. Re: Flame Effect
          SuhasYogin Adobe Employee

          Hi Manoj,

           

          The link you posted didn't work. Could you please repost?

           

          Regards,

          Suhas Yogin

          • 2. Re: Flame Effect
            manojb05 Level 1

            hi suhas thanks for your reply please check updated link WEBLINK

            • 3. Re: Flame Effect
              SuhasYogin Adobe Employee

              Hi, Manoj

               

              We need you to share your FLA file with us, you can use any free file sharing website for the same.

               

              Regards,

              Suhas Yogin

              • 4. Re: Flame Effect
                manojb05 Level 1
                • 5. Re: Flame Effect
                  manojb05 Level 1

                  hi anybody know how can do?

                  plz help

                  • 6. Re: Flame Effect
                    Rothrock Level 5

                    I don't know if you are using AS2 or AS3. But here is an AS2 flame effect. Try it by itself first and see if you can figure out a way to use it.

                     

                    Or you might like this tutorial here: http://www.powerabuse.co.uk/tutorials/particle_fire.html

                     

                    Good luck

                     

                     

                     

                    import flash.display.BitmapData;

                    import flash.filters.BlurFilter;

                    import flash.geom.*;

                     

                     

                    var flameWidth:Number = 800

                    var flameHeight:Number = 300;

                    var seedWidth:Number = 15;

                    var blurX:Number = 4;

                    var blurY:Number = 8;

                    var numSeeds:Number = 15;

                    var numPasses:Number = 2;

                     

                     

                    var blur:BlurFilter = new BlurFilter(blurX, blurY,2);

                     

                     

                    var bmp0:BitmapData = new BitmapData(flameWidth, flameHeight+blurY*2, false, 0x0);

                    var bmp1:BitmapData = new BitmapData(flameWidth, flameHeight, true, 0xffffffff);

                    this.createEmptyMovieClip("img",100);

                    this.attachBitmap(bmp0,200);

                    img.attachBitmap(bmp1,100);

                    img._y = Stage.height-flameHeight+(blurY >> 1);

                    img._x = (Stage.width-flameWidth)/2

                     

                     

                    var map:Array = new Array();

                    var nullArray:Array = new Array();

                     

                     

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

                              map[i] = HSL2RGB(i/3, 255, Math.min(255, i*2));

                              nullArray[i] = 0;

                    }

                     

                     

                    onEnterFrame = function() {

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

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

                                                  bmp0.fillRect(new Rectangle(getRandInt(150,flameWidth-150), flameHeight+(blurY >> 1), seedWidth, 2),0xffffff);

                                        }

                                        bmp0.applyFilter(bmp0,new Rectangle(0, 0, flameWidth, flameHeight+(blurY >> 1)),new Point(0, -3),blur);

                              }

                              bmp1.paletteMap(bmp0,new Rectangle(0, 0, flameWidth, flameHeight-(blurY >> 1)),new Point(0, 0),map,nullArray,nullArray,null);

                    };

                     

                     

                     

                     

                    function HSL2RGB(h:Number, sl:Number, l:Number) {

                              var r:Number;

                              var g:Number;

                              var b:Number;

                              h /= 255;

                              sl /= 255;

                              l /= 255;

                     

                     

                              var v:Number = (l<=0.5) ? (l*(1.0+sl)) : (l+sl-l*sl);

                     

                     

                              if (v<=0) {

                                        r = g=b=0;

                              } else {

                                        var m:Number = l+l-v;

                                        var sv:Number = (v-m)/v;

                                        h *= 6;

                                        var sextant:Number = Math.floor(h);

                                        var fract:Number = h-sextant;

                                        var vsf:Number = v*sv*fract;

                                        var mid1:Number = m+vsf;

                                        var mid2:Number = v-vsf;

                                        switch (sextant) {

                                                  case 0 :

                                                            r = v;

                                                            g = mid1;

                                                            b = m;

                                                            break;

                                                  case 1 :

                                                            r = mid2;

                                                            g = v;

                                                            b = m;

                                                            break;

                                                  case 2 :

                                                            r = m;

                                                            g = v;

                                                            b = mid1;

                                                            break;

                                                  case 3 :

                                                            r = m;

                                                            g = mid2;

                                                            b = v;

                                                            break;

                                                  case 4 :

                                                            r = mid1;

                                                            g = m;

                                                            b = v;

                                                            break;

                                                  case 5 :

                                                            r = v;

                                                            g = m;

                                                            b = mid2;

                                                            break;

                                        }

                              }

                              return ( ((r*255) << 16) | ((g*255) << 8) | ((b*255)));

                    }

                     

                     

                    function getRandInt(min:Number, max:Number):Number {

                              var num:Number = Math.floor(Math.random()*(max-min+1))+min;

                              return num;

                    }

                    • 7. Re: Flame Effect
                      manojb05 Level 1

                      Rothrock, Awesome thanks for your valuable feedback. I am try to your tutorial its works fine.

                      I am that code incorporate in my creative