Math.abs() is using a lot of memory?


(Adam Edney) #21

Thanks both for the reply from both of you

Probably draw a sprite, apply X filter, extract its bitmapdata, draw image

Is there a example on the internet on how to extract its bitmap data, draw image. Because I have only been drawing images rather than extracting the bitmap data.(is there a advantage of this).


(Mike Evmm) #22

See if this helps:

    var sp:Sprite = new Sprite();
    sp.graphics.lineStyle(3,0xffffff);
    sp.graphics.moveTo(0,0);       //Draws line from (0,0)
    sp.graphics.lineTo(100,100);   //To (100,100)

    var glow:GlowFilter = new GlowFilter();
    sp.filters = [glow];

    var bmd:BitmapData = new BitmapData(sp.width,sp.height); //Probably the bit
    bmd.draw(sp);                                        //you're interested in

    var img:Image = new Image(bmd);

I’m not sure this works, but it should.
(and no, there is no advantage to this, but only this way you can apply AS3 filters.)


(Mike Evmm) #23

I’d reeeally like to stress this. My solution is not efficient at all, and has probably made @Ultima2876 cringe.


(Adam Edney) #24

Thanks, I will test both methods when I can access my pc (as i’m on my phone) Then stress test them, but I couldn’t remember that you can stretch images / sprite because I tried on like my first day on flash punk, so I will retry I as soon as possible.