[Flashcoders] [AS2] Catching clicks in child clip?
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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Mike Cann http://www.mikecann.co.uk/ http://www.artificialgames.co.uk/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
I forget but doesn't the _mc.enabled property cascade downwards? So once loaded you could set the container for the loaded swf as enabled = false... ? On Wed, Dec 3, 2008 at 9:07 AM, 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
On Wed, Dec 3, 2008 at 2:34 PM, mike cann [EMAIL PROTECTED] 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. There's nothing to stop you having a mask and a transparent overlay. And believe me, you _haven't_ tried every combination, because it definitely does work. I suspect your _mc settings are failing because you're doing it before the clip has loaded - but without seeing your source it's difficult to say. If that's an issue, you can apply it even further up the tree - to the parent clip of your _mc. Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
Hi, I think enabled only applies to the clip, not it's children. Glen jonathan howe wrote: I forget but doesn't the _mc.enabled property cascade downwards? So once loaded you could set the container for the loaded swf as enabled = false... ? On Wed, Dec 3, 2008 at 9:07 AM, 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
setting _adContainter.enabled = false; doesnt work. (this is the one that contains the loaded swf); I have tried using MovieClipLoader and then doing the masking and the event listening after the load too If you would like i can do you an example with that method too. I have tried making a mouse trap over the top and it didnt work, ill try again and do you a version 2 mins.. 2008/12/3 Glen Pike [EMAIL PROTECTED] 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Mike Cann http://www.mikecann.co.uk/ http://www.artificialgames.co.uk/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
Okay the mousetrap over the top doesnt work. Find the new example here: http://www.mikecann.co.uk/DumpingGround/AS2_StrippedBare_MouseTrap.zip Source output here: 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); _adContainter = _mc.createEmptyMovieClip(container, _mc.getNextHighestDepth()); _adContainter.loadMovie(advertURL); _adContainter.enabled = false; var mouseTrap : MovieClip = _mc.createEmptyMovieClip(mouseTrap, _mc.getNextHighestDepth()); mouseTrap.beginFill(0xFF, 255); mouseTrap.moveTo(0,0); mouseTrap.lineTo(_sizeWidth,0); mouseTrap.lineTo(_sizeWidth,_sizeHeight); mouseTrap.lineTo(0,_sizeHeight); mouseTrap.lineTo(0,0); mouseTrap.endFill(); mouseTrap._alpha = 50; mouseTrap.onMouseUp = Delegate.create(this, advertClickthrough); mouseTrap.onRelease = function() { } mouseTrap.onPress = function() { } mouseTrap.onMouseDown = function() { } mouseTrap.onMouseMove = function() { } } Ill now attempt to do an _enabled on the loaded clip by using MovieClipLoader instead of loadMovie() 2008/12/3 Glen Pike [EMAIL PROTECTED] Hi, I think enabled only applies to the clip, not it's children. Glen jonathan howe wrote: I forget but doesn't the _mc.enabled property cascade downwards? So once loaded you could set the container for the loaded swf as enabled = false... ? On Wed, Dec 3, 2008 at 9:07 AM, 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 Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Mike Cann http://www.mikecann.co.uk/ http://www.artificialgames.co.uk/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com
Re: [Flashcoders] [AS2] Catching clicks in child clip?
Okay i have now tried the mc.enable approach and still the clicks are getting through? Download this example here: http://www.mikecann.co.uk/DumpingGround/AS2_StrippedBare_Enable.zip Source below: 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); _adContainter = _mc.createEmptyMovieClip(container, _mc.getNextHighestDepth()); var clip : MovieClip = _adContainter.createEmptyMovieClip(clip, _adContainter.getNextHighestDepth()); var mcl : MovieClipLoader = new MovieClipLoader(); mcl.addListener( { onLoadInit:adInit } ); mcl.loadClip(advertURL,clip); } private function adInit(mc:MovieClip):Void { mc.enabled = false; trace(mc.enabled +mc.enabled); } Just thinking this couldnt a _lockroot problem could it?? 2008/12/3 mike cann [EMAIL PROTECTED] Okay the mousetrap over the top doesnt work. Find the new example here: http://www.mikecann.co.uk/DumpingGround/AS2_StrippedBare_MouseTrap.zip Source output here: 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); _adContainter = _mc.createEmptyMovieClip(container, _mc.getNextHighestDepth()); _adContainter.loadMovie(advertURL); _adContainter.enabled = false; var mouseTrap : MovieClip = _mc.createEmptyMovieClip(mouseTrap, _mc.getNextHighestDepth()); mouseTrap.beginFill(0xFF, 255); mouseTrap.moveTo(0,0); mouseTrap.lineTo(_sizeWidth,0); mouseTrap.lineTo(_sizeWidth,_sizeHeight); mouseTrap.lineTo(0,_sizeHeight); mouseTrap.lineTo(0,0); mouseTrap.endFill(); mouseTrap._alpha = 50; mouseTrap.onMouseUp = Delegate.create(this, advertClickthrough); mouseTrap.onRelease = function() { } mouseTrap.onPress = function() { } mouseTrap.onMouseDown = function() { } mouseTrap.onMouseMove = function() { } } Ill now attempt to do an _enabled on the loaded clip by using MovieClipLoader instead of loadMovie() 2008/12/3 Glen Pike [EMAIL PROTECTED] Hi, I think enabled only applies to the clip, not it's children. Glen jonathan howe wrote: I forget but doesn't the _mc.enabled property cascade downwards? So once loaded you could set the container for the loaded swf as enabled = false... ? On Wed, Dec 3, 2008 at 9:07 AM, 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);
Re: [Flashcoders] [AS2] Catching clicks in child clip?
Use the (very) old invisible button trick. So create a Button symbol with only the hit state (keyframe) defined and put that on top of the movieclip that holds the loaded swf. - Original Message - From: mike cann [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, December 03, 2008 3:07 PM Subject: [Flashcoders] [AS2] Catching clicks in child clip? 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
Hi Muzak, I have just tried this and still get the error. Screenshot of error: http://www.mikecann.co.uk/DumpingGround/AS2_Problem01.png Example Code: http://www.mikecann.co.uk/DumpingGround/AS2_StrippedBare_SneakyButton.zip Also there is another problem. If you click outside of the masked area of the advert it still registers it as a click on the loaded movie!?! Anyone else any ideas? 2008/12/3 Muzak [EMAIL PROTECTED] Use the (very) old invisible button trick. So create a Button symbol with only the hit state (keyframe) defined and put that on top of the movieclip that holds the loaded swf. - Original Message - From: mike cann [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, December 03, 2008 3:07 PM Subject: [Flashcoders] [AS2] Catching clicks in child clip? 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Mike Cann http://www.mikecann.co.uk/ http://www.artificialgames.co.uk/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
The error is likely due to your sandbox situation. If you test the site online you'll likely see the error go away. In order to fix it locally you'll have to add your desktops work folder to your trustes sites list in your flash player preferences. http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html The click error is likely due to assigning mouse event functions to the entire clip. You will probably want to create a button symbol with a square the exact size of the banner in the HIT frame only and apply the functions to it. On Wed, Dec 3, 2008 at 12:28 PM, mike cann [EMAIL PROTECTED] wrote: Hi Muzak, I have just tried this and still get the error. Screenshot of error: http://www.mikecann.co.uk/DumpingGround/AS2_Problem01.png Example Code: http://www.mikecann.co.uk/DumpingGround/AS2_StrippedBare_SneakyButton.zip Also there is another problem. If you click outside of the masked area of the advert it still registers it as a click on the loaded movie!?! Anyone else any ideas? 2008/12/3 Muzak [EMAIL PROTECTED] Use the (very) old invisible button trick. So create a Button symbol with only the hit state (keyframe) defined and put that on top of the movieclip that holds the loaded swf. - Original Message - From: mike cann [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, December 03, 2008 3:07 PM Subject: [Flashcoders] [AS2] Catching clicks in child clip? 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Mike Cann http://www.mikecann.co.uk/ http://www.artificialgames.co.uk/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS2] Catching clicks in child clip?
Yeah, the invisible buton trick won't do in this case (only just now looked at the zip file). Looks like the loaded swf listens for Mouse Events. An overlaying invisible button will only work to prevent underlying buttons from working. I'm not sure if there's a way to 'hijack' those mouse events from the loaded swf. Well, at least I can't think of one right one.. regards, Muzak - Original Message - From: mike cann [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, December 03, 2008 6:28 PM Subject: Re: [Flashcoders] [AS2] Catching clicks in child clip? Hi Muzak, I have just tried this and still get the error. Screenshot of error: http://www.mikecann.co.uk/DumpingGround/AS2_Problem01.png Example Code: http://www.mikecann.co.uk/DumpingGround/AS2_StrippedBare_SneakyButton.zip Also there is another problem. If you click outside of the masked area of the advert it still registers it as a click on the loaded movie!?! Anyone else any ideas? 2008/12/3 Muzak [EMAIL PROTECTED] Use the (very) old invisible button trick. So create a Button symbol with only the hit state (keyframe) defined and put that on top of the movieclip that holds the loaded swf. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders