0 Replies Latest reply on Jun 20, 2012 6:05 PM by kdpowell1895

    Running Perlin Noise concurrently with other EventListeners

    kdpowell1895 Level 1

      I'm trying to create a pencil pushdown ad that utilizes Perlin Noise for flames and also utilizes two other event listeners - one for a clickTAG and another that will display a different ad on mouse out.  The perlin noise will run fine, but this disables my code for the clickTAG and the mouse out event (which work just fine in my other ads without perlin noise). The following is just the portion of the code that I think is effected.  Any thoughts?


      // Perlin Noise

      addEventListener(Event.ENTER_FRAME, animate);

      function animate(e:Event):void {

                // Animating the octaves in time

                for(var o=0;o<numOctaves;o++){

                          offsets[o].x += speeds[o].x;

                          offsets[o].y += speeds[o].y;


                bitmapData.perlinNoise(baseX, baseY, numOctaves, randomSeed, stitch, fractalNoise, channelOptions, grayScale, offsets);

                Flames.filters = [disp];



      // clickTAG

      Button.addEventListener(MouseEvent.CLICK, goToClickTag, false, 0, true);


      function goToClickTag(e:MouseEvent):void{

      var url:String = this.loaderInfo.parameters.clickTAG;

      var request:URLRequest = new URLRequest(url);

      try {

      navigateToURL(request, '_blank');

      } catch (e:Error) {

      trace("Error occurred!");




      // Close Ad

      Button.addEventListener(MouseEvent.MOUSE_OUT, MoveOut, false, 0, true);


      function MoveOut(e:MouseEvent):void {

                var url:String = "javascript:closeAd();";

                var mouseoutrequest:URLRequest = new URLRequest(url);

                navigateToURL(mouseoutrequest, "_self");