2 Replies Latest reply on Oct 25, 2010 6:41 AM by saratogacoach

    bitmapData.noise any way to control speed of change?

    saratogacoach Level 1



      I have been trying to create a visual noise pattern using bitmapData.noise, and with help from Rothrock and Kglad have created a working version. Here's the previous forum posting:




      There is a posted Flash version at: http://www.eLearningprojects.com/WN1.html


      I checked with a colleague who is expert on the use of these visual patterns, and he suggested that the change speed is too fast: that the dots (pixels) need to change at just under 400 dots per second for an 800 x 600 stage.


      With beginner skills in AS3, I am unsure if there is any way to change the script to slow the rate of dot change in the bitmapData.noise function? (Ideally, a slider control that would give the viewer the ability to slow or increase the rate would be very helpful.)


      Any help would be appreciated.


      Kind Regards,

        • 1. Re: bitmapData.noise any way to control speed of change?
          kglad Adobe Community Professional & MVP

          you must be calling the noise function in a loop.  you can control the speed of that loop to do what you want.  copy and paste the function that applies the noise() method and the loop that calls it.

          1 person found this helpful
          • 2. Re: bitmapData.noise any way to control speed of change?
            saratogacoach Level 1

            Hi kglad,


            This is good news. But...


            Having done some JavaScript in the past I know a little about loops. But I am not sure based on this script, which loop and how to control it, in order to slow it down.


            Can you suggest where and how? Unfortunately, I'm stuck.


            Here's the current script:


            var array:Array=new Array();
            for (var i:uint = 0; i < 255; i++) {


            array[i] = 0xffffff * (i % 2);


            var _bitmapData:BitmapData;


            var bDHolder:Sprite = new Sprite();


            _bitmapData = new BitmapData(stage.stageWidth/4, stage.stageHeight/4);




            bDHolder.addChild(new Bitmap(_bitmapData));
            bDHolder.scaleX = bDHolder.scaleY = 4;






            addEventListener(Event.ENTER_FRAME, onSpriteEnterFrame);


            function makeNoise():void {
                        _bitmapData.noise(getTimer(), 100, 255, 7, true);
                        _bitmapData.paletteMap(_bitmapData, _bitmapData.rect, new Point(0,0), array, array,array);


            function onSpriteEnterFrame(event:Event):void {


            var itsNoisy:Boolean = true;




            stage.addEventListener(MouseEvent.MOUSE_DOWN, manageNoise);




            function manageNoise(evt:MouseEvent):void {
                     removeEventListener(Event.ENTER_FRAME, onSpriteEnterFrame)
                 } else {
                     addEventListener(Event.ENTER_FRAME, onSpriteEnterFrame)
                 itsNoisy = !itsNoisy;


            Thanks for your help.


            Kind Regards,