0 Replies Latest reply on Dec 7, 2006 10:41 AM by Bioflash

    Bugs Live in Actionscript Filters

    Bioflash
      Greetings Actionscript Geniuses,

      I'm looking for some help on what seems to be a glitch in Actionscript. I've run into problems with using filters before, but this time it is particularly annoying. If you can help me find a work-around or you know of a solution to this problem, I will be forever grateful.

      I want to use an animated movie clip button to load an external SWF file, and I want to be able to interact with the SWF while it's on the stage. I want multiple buttons with the same functionality, so it is necessary to unload the SWF when the user explores further. The button animation is accomplished by changing the angle of a gradient filter.

      My approach has been to define a hit area in the shape of the external SWF. When the user mouses over the mc button, the shape of the hit area changes from just the button to a new hit area defined by a movie clip that is shaped like the button + the externally loaded SWF. In this way I can add functionality to the external SWF (buttons, exc.). When I mouse off of the newly defined hit area, I have the hit area revert back to the shape of the mouse.

      The problem is that the hitArea method does not work properly when a filter is applied to the button that calls the external SWF. I can get this functionality when I animate the mc button in the timeline, but, of course, there are problems with the animation sticking if I mouse on and off before the button's timeline runs through completely.

      I attached some code so you can see this glitch for yourself, and here are some quick instructions to get you there fast:

      1. Create a new file and make a circle and a rectangle and convert both to movie clips and put them on separate layers if you like.
      2. Give the rectangle the instance name "btn_mc" and name the circle "hit_mc."
      3. Adjust the circle (hit area) to be 2-3 times the size of the rectangle (mc button) and make the rectangle button overlap the hit area.
      4. Now make a separate SWF to load onto your stage and save it as Btn1.swf. It could contain a shape or bitmap, but make sure the external SWF has the same stage dimensions and put the shape or bitmap on the stage away from the button and hit area. (Alternatively, you could make both the button and the hit area be rectangles that overlap, then you could load an image into the space taken up by the hit area. This would be similar to what I want to do, but this bug test can be much simpler.)
      5. Add the attached code.
      6. Try disabling the filter by commenting out the following line (5th from the top):
      var gbevel:GradientBevelFilter = new GradientBevelFilter (4,45,colors,alphas,ratios,20,20,5,2,"inner", false)

      If you play with the code you will experience this glitch for yorself. When you test your movie, mouse over the area of the button that does not overlap with the hit area, and try to mouse onto the hit area from the button, both with the filter applied and not applied. You will se that the filter modifies the functionality such that the hitArea method is useless for its intended purpose. If you know of a way to get around this problem, please let me know.

      Onward. . .
      Randall