Article View: adobe.atmosphere
Article #4Re: Changing texture at MouseOver
From: steven_licciardi
Date: Sun, 29 Aug 2004 14:42
Date: Sun, 29 Aug 2004 14:42
36 lines
2497 bytes
2497 bytes
Hello,
I could have done with this demo a couple of months ago :). In the demo you comment that the mouseOut event doesn't work, which is true for Atmo primitives, but it does work for VP objects. So what you can do is create a simple VP object with two planes in it, one for mouseOut and one for mouseOver, then use the MoueOut and Over events to set the opacitiy of the planes to zero or one as required.
Like this (for lots of buttons, where this.buttonNames refers to the names of VP objects in the world) :
this.buttonNames = new Array("Stage1button1","Stage1button2","Stage1button3","Stage1button4","Stage2button1","Stage2button2","Stage2button3","Stage2button4","Stage3button1","Stage3button2","Stage3button3","Stage3button4","Stage4button1","Stage4button2","Stage4button3","Stage4button4","Stage5button1","animButton1","animButton2","animButton3","resetButton","DoorButton");
this.buttons = new Array(this.buttonNames.length);
for (var i=0; i<this.buttons.length; i++) { this.buttons[i]=theStage.getViewpointObject(this.buttonNames[i]);
//create the MouseOver Event
this.buttonEvent = MouseEventHandler();
this.buttonEvent.owner = this;
this.buttonEvent.index = i;
this.buttonEvent.setFilterOnMouseOver(this.buttons[i]);
this.buttonEvent.onEvent = function(event, what)
{
this.owner.buttons[this.index].scene.getInstance(0).opacity = 0;
this.owner.buttons[this.index].scene.getInstance(1).opacity = 1;
}
//create the MouseOut Event
this.buttonEvent1 = MouseEventHandler();
this.buttonEvent1.owner = this;
this.buttonEvent1.index = i;
this.buttonEvent1.setFilterOnMouseOut(this.buttons[i]);
this.buttonEvent1.onEvent = function(event, what)
{
this.owner.buttons[this.index].scene.getInstance(0).opacity = 1;
this.owner.buttons[this.index].scene.getInstance(1).opacity = 0;
}
}
Steven
Technical Details
Message-ID:
<3bb5a9f7.1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news-out.ntli.net!newsrout1.ntli.net!news-in.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<3bb5a9f7.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: fa820,a6ab6d76db190552 X-Google-Attributes: gidfa820,public X-Google-Language: ENGLISH,ASCII-7-bit From: steven_licciardi@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news-out.ntli.net!newsrout1.ntli.net!news-in.ntli.net!ntli.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.atmosphere Subject: Re: Changing texture at MouseOver Message-ID: <3bb5a9f7.1@webx.la2eafNXanI> Date: Sun, 29 Aug 2004 07:42:47 -0700 References: <3bb5a9f7.-1@webx.la2eafNXanI> Lines: 49 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit