Mike,
A mask (as defined by setMask()) isn't a visible object, so you
can't apply clicks to it like that. setMask() is used for clipping
areas of a movieclip (like looking at the movieclip through an
irregularly-shaped window).
A better bet would be either to apply the onRelease/onMouseDown
etc. to the _containing movie_ of the advert (the clicks won't get
through), or to put a rectangular 'mask' movieclip over the top of the
advert (pretty much as you've described, but _not_ using setMask) that
has an _alpha of 0.
HTH,
Ian
On Wed, Dec 3, 2008 at 2:07 PM, mike cann <[EMAIL PROTECTED]> 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.
>
> --
> Mike Cann
> http://www.mikecann.co.uk/
> http://www.artificialgames.co.uk/
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders