3 Replies Latest reply on Apr 26, 2006 12:28 PM by blemmo

    is there a getpixel() type operation?

    cmd121
      I have an image file loaded into a movie clip. The image has a wavy line running horizontally through it, and i want to detect the 'y' value of the line as the image scrolls by, at a specific 'x' on the screen. The line is just part of the image, so is there a way to detect its location by color somehow?

      Thanks for any help.
        • 1. Re: is there a getpixel() type operation?
          sneakyimp Level 2
          no.

          your best bet is to work up some math calculations to approximate the location of the line relative to the movie's position and test against that (trigonometry anyone?).

          • 2. Re: is there a getpixel() type operation?
            sneakyimp Level 2
            *or* you could draw a line in flash that looks like the squiggly line and put it in a movie clip that is attached to the image file. you can do hit detection on that object instead of your original image as long as your wavy line movie clip and the image file are always locked together.

            • 3. Re: is there a getpixel() type operation?
              blemmo Level 1
              There's a getPixel() function in the BitmapData class, available since Flash 8. If the line's color is known and unique in the image (e.g. black line on white background), it should be possible to loop through all y values at a given x, and check for the line's color value. All you need to do is create a BitmapData object from the image or from the MC containing the image, see the BitmapData entry in the Flash Help.

              greets,
              blemmo