[Papervision3D] add/remove Event Listener for an Interactive Material..
Tyler E
tyleregeto at hotmail.com
Thu Nov 8 13:53:51 PST 2007
The problem is that your variable is a function variable, so it only exists
inside of that function. Once the function is finished it kills the
reference from Flash's memory. Anyways, try this:
e.currentTarget.removeEventListener(MouseEvent.CLICK, handleMainClick);
mikotondria wrote:
>
> Halloo...
>
> In my app, I have set up an InteractiveMovieAssetMaterial, then added an
> eventListener to it, that calls a function, thusly:
>
> //____inside function that creates a plane and adds it to the 'scene'..
> var biosmaterial:InteractiveMovieAssetMaterial = new
> InteractiveMovieAssetMaterial("bios", initMats);
> biosmaterial.movie.addEventListener(MouseEvent.CLICK, handleMainClick);
>
>
> when the plane that uses this material is clicked, I want to remove the
> event listener (the plane becomes the background for some 2nd level
> content), and I thought I could just refer to the biosmaterial.movie, as I
> did when I constructed it..by:
>
> public function handleMainClick(e:MouseEvent):void {
> //trace("you clicked", e.currentTarget);
> biosmaterial.movie.removeEventListener(MouseEvent.CLICK,
> handleMainClick);
> }
>
> but I am getting the ubiquitous:
>
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
> at myExperiment/handleMainClick()
>
> What do I need to do to access this material's movie, or am I going about
> it all wrongly :/
>
> Mr Grden, if you have 0.8 seconds, I would be eternally grateful, lol :D
>
> Many thanks talented people.
>
>
>
>
--
View this message in context: http://www.nabble.com/add-remove-Event-Listener-for-an-Interactive-Material..-tf4773257.html#a13656729
Sent from the Papervision3D mailing list archive at Nabble.com.
More information about the Papervision3D
mailing list