Discussion:
Papervision Cube, change faces on roll over and out
Francis Altomare
2010-09-24 20:19:30 UTC
Permalink
Hello,
Sorry if this is considered spam, I'm new to the mailing list and
Papervision3D.

I'm currently working on creating rollover effects on each face of a cube
done in papervision, I'm trying to lower the opacity of the face and add a
border when the user rolls over it.

I am attaching a roll over to each cube face

boxFace.addEventListener(MouseEvent.MOUSE_OVER, onMatOver);

boxFace.alpha = .9;

var movieMat:MovieMaterial = new MovieMaterial(boxFace,
true, true);
movieMat.interactive = true;


Inside of my onMatOver function I change the face of the rolled over cube.
This will eventually be in a switch statement but for now I'm just trying it
with the "back" face

protected function onMatOver(e:MouseEvent):void{


var boxFace:Sprite = new Sprite();
boxFace.graphics.lineStyle(1);
boxFace.graphics.beginFill(0x76b6f8);
boxFace.graphics.drawRect(0, 0, 100, 100);
boxFace.alpha = .5

boxFace.graphics.endFill();
boxFace.name = "back"


colorBox.addEventListener(MouseEvent.MOUSE_OUT, onMatOut);

var movieMat:MovieMaterial = new MovieMaterial(boxFace,
true, true);
movieMat.interactive = true;
movieMat.smooth = true;
movieMat.doubleSided = true;

cube.replaceMaterialByName(movieMat, "back");


This seems to be working

My problem is with the MOUSE OUT event, that function is the same as
onMatOver except it is redrawing the sprite without the lineStyle and with a
higher opacity.


The problem is this does not seem to be working. The MOUSE_OUT event is
called but the material is not changed.



--

Loading...