I've been trying to get Sprite3D to support mouse interaction as well when displaying a PNG file with transparency but could not figure out how to get it to work - it looks like there is a bug listed for Sprite3D and interaction with transparency. I did have success using a MovieClipSprite instead and adding standard flash mouse events to the movie clip like this:
// Make a sprite image, one that watches the view camera for Little Bird: var bitmapLB:Bitmap = new LBPageOne_Bitmap(); var mcSprite:MovieClip = new MovieClip(); mcSprite.addChild(bitmapLB); bitmapLB.smoothing = true; var spriteLB:MovieClipSprite = new MovieClipSprite(mcSprite); // ... sprite positioning and other code goes here ... addChild(spriteLB); // Provide mouse interaction on the sprite: mcSprite.addEventListener(MouseEvent.MOUSE_DOWN, eventMouseDown3DSprite); On May 31, 3:48 am, colouredfunk <[email protected]> wrote: > Can anyone help me out on this? > > Thanks > > On May 26, 5:33 pm, colouredfunk <[email protected]> wrote: > > > > > > > > > Hi, > > > I have a MovieClip with several buttons on that I want to add into my > > 3D scene. At the moment I'm using a Plane, but as it's always facing > > the camera it makes sense to use a Sprite3D or MovieClipSprite, to > > save some memory (it's quite a big MovieClip) > > > But when I swap over from the Plane, it doesn't seem to pick up the > > interaction on the MovieClip for some reason.. It is even possible? or > > am I barking up the wrong tree? > > > Actually, just tested it again, and I get an error > > > [Fault] exception, information=TypeError: Error #1009: Cannot access a > > property or method of a null object reference. > > MovieMaterial.as > > > private function onMouseMove(event:MouseEvent3D):void > > { > > x = event.uv.u*_renderBitmap.width; > > y = (1 - event.uv.v)*_renderBitmap.height; > > > ---Here is my code-- > > > _cityBG = new CityScape() > > _cityBG.addEventListener(CityScape.FLAG_CLICK, onFlagClick); > > _cityBG.addEventListener(CityScape.POPCLOSE_CLICK, resetCam); > > _cityBG.scaleX = _cityBG.scaleY =1 > > var mat2:MovieMaterial = new MovieMaterial(_cityBG) > > mat2.smooth = true; > > mat2.interactive = true; > > > var test:Sprite3D = new Sprite3D(mat2, 866, 440) > > test.x = 127 > > test.y = 11 > > test.z = -133 > > _scene.addSprite(test); > > > Kaan
