Hi,

You need a separate clip to attach the mouse handlers too - not the loaded clip, but another transparent one over the top of this - you probably need something in the "mousetrap" clip with an alpha of 0 to make this work.

   Glen

mike cann wrote:
Okay well setting these values:

        mask.onMouseUp = Delegate.create(this, advertClickthrough);
        mask.onRelease = function() { }
        mask.onPress = function() { }
        mask.onMouseDown = function() { }
        mask.onMouseMove = function() { }

to

        _mc.onMouseUp = Delegate.create(this, advertClickthrough);
        _mc.onRelease = function() { }
        _mc.onPress = function() { }
        _mc.onMouseDown = function() { }
        _mc.onMouseMove = function() { }

has had no effect.

Believe me i have tried every single combination of where to place these
listeners. The mask is essentail BTW as some ads have objects off-stage and
hence need to be masked when they are loaded in.



2008/12/3 Glen Pike <[EMAIL PROTECTED]>

Hi,

  Use a transparent clip over the top rather than making a clip a mask for
your loaded clip - that should intercept mouse clicks, not sure a mask will?

  Glen


mike cann wrote:

Hello List,

I have been forced to go back to AS2 recently for a work project and oh my
is it annoying me.

Part of the project I am writing a simple advertising loader, its
basically
just a swf that loads other swfs into it.

The problem is that the adverts that are loaded in sometimes contain
clicks
within them so without access to the source code i need a method of
preventing those clicks from happening.

To my knowledge this should be doable by implementing a cover over the top
of the loaded swf with a onPress, onRelease etc functions defined correct?

Well for some reason this isnt happenining.

See the source output below. You can download the project here:
http://www.mikecann.co.uk/DumpingGround/AS2_StrippedBare.zip


import flash.geom.Matrix;
import mx.controls.Loader;
import mx.utils.Delegate;
/**
 * ...
 * @author DefaultUser (Tools -> Custom Arguments...)
 */
class GJAdJacket
{
   // Privates
   private var _mc : MovieClip;
   private var _adContainter : MovieClip;
   private var _sizeWidth:Number;
   private var _sizeHeight:Number;

   public function GJAdJacket(attachToMC:MovieClip)
   {
       // The MC we are to attach to
       _mc = attachToMC;

       // Set the stage scale modes
       Stage.scaleMode = "noScale";
       Stage.align = "TL";

       // Init
       _sizeWidth = 300;
       _sizeHeight = 250;
       loadAdvert("

http://gjacket-images.adbureau.net/gjacket/_clientcreative/Eidos/BattleMail021208.swf
");
   }

   private function loadAdvert(advertURL:String)
   {
       // Make a mask for those naughty ads that dont mask
       var mask : MovieClip = _mc.createEmptyMovieClip("mask",
_mc.getNextHighestDepth());
       mask.beginFill(0, 255);
       mask.moveTo(0,0);
       mask.lineTo(_sizeWidth,0);
       mask.lineTo(_sizeWidth,_sizeHeight);
       mask.lineTo(0,_sizeHeight);
       mask.lineTo(0,0);
       mask.endFill();
       _mc.setMask(mask);

       mask.onMouseUp = Delegate.create(this, advertClickthrough);
       mask.onRelease = function() { }
       mask.onPress = function() { }
       mask.onMouseDown = function() { }
       mask.onMouseMove = function() { }

       _adContainter = _mc.createEmptyMovieClip("container",
_mc.getNextHighestDepth());
       _adContainter.loadMovie(advertURL);
   }

   public function advertClickthrough()
   {
       getURL("http://www.google.com";, "_blank")
   }
}


Cheers.



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders





_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to