Hi guys,
I'm sure i'm missing something painfully obvious (i hope anyway) but it's driving me mad.
I have 3 buttons (on this example), each has a mouseover so the button will highlight once the mouse enters the shape. This all works, however the mouseover area seems to be aligned half OFF of the shape.
EG the shape will highlight when hovering off of the shape on one side, and from half way accross the shape on the other.
Here are some grabs and the general code i have.
for(var x = 1; x < 4; x++)
{
var currentBut = eval("but"+x);
currentBut.onMouseMove = function(){
if(this._xmouse > 0 && this._xmouse < this._width && this._ymouse > 0 && this._ymouse < this._height){
this.gotoAndStop(2);
}
else
{
this.gotoAndStop(1);
}
};
}
[edit] - CS4 - Action Script 2
Thanks guys!
i re-read your message and it looks like you're using movieclip buttons and you're using code that would only work correctly if you movieclip graphics were aligned at the upper left of the movieclip's center-stage (that plus-sign on the movieclip's timeline). your movieclip graphics are off-center.
you could remedy by re-aligning your graphics or using the following code:
for(var x = 1; x < 4; x++)
{
var currentBut = eval("but"+x);
currentBut.onMouseMove = function(){
if(this.hitTest(_xmouse,_ymouse)){
this.gotoAndStop(2);
}
else
{
this.gotoAndStop(1);
}
};
}
Hi kglad,
As far as i know they are all vectors (imported from Adobe Illustrator), they should also have transparent backgrounds.
I tried the method you suggested but the 'trace' etc are greyed out and unclickable.
Here is a grab from bringing the images in, showing the settings i've used to do so -
As before; if you don't know a quick fix for this i'm more than happy to start a new thread.
Thanks!
in flash, create one diamond shape, that matches your movieclips' shape, using an alpha=0. right click the shape, click convert to object, assign it a name (eg, mc), select movieclip and click ok. that transparent movieclip will be in your library.
drag that transparent movieclip from the library to your stage and place it over your first movieclip and assign it a name (in the properties panel), mc1. likewise for the next two transparent movieclips (naming them mc2 and mc3) being placed over your 2nd and 3rd movieclips.
you can then remove your previous code and use:
var tl:MovieClip=this;
for(var i = 1; i < 4; i++){
tl["mc"+i].ivar=i;
tl["mc"+i].onRollOver=function(){
tl["but"+this.ivar].gotoAndStop(2):
}
tl["mc"+i].onRollOut=function(){
tl["but"+this.ivar].gotoAndStop(1):
}
}
Hi kglad,
That looks like just what i need, and very clearly described thank you!
I've done all that you've said and all has gone smoothly, however nothing happens when i hover the shapes and i have this error -
Syntax error. tl["but"+this.ivar].gotoAndStop(2):
Syntax error. tl["but"+this.ivar].gotoAndStop(1):
Unexpected '}' encountered
(Just to make sure i've mentioned it i am using AS2)
Also i presume that i should edit the clear diamond shape to change colour once hovered, as the shapes did before?
Hi kglad,
If you're not sick of me by now i have one final problem to overcome. (More than happy to start a new topic if that'd be better).
The Flash works perfectly, no problems, however i am using them on Powerpoint slides in a program called Articulate (a simple program to house things like this as a whole media object on a website etc).
The only issue with this is that i need to add links on top of each page, which link to other slides in the presentation. So not hyperlinks in the Flash code, slide-hyperlinks in Powerpoint.
The Flash code should be enough to make the shapes have hover states, but not be a 'button', if that makes any sense? The hyperlink shapes i add on afterwards in Powerpoint should be the clickable areas with the cursor turning to a hand, but the Flash code by itself should just have a hover state with the cursor staying as an arrow.
Does that make sense?
Again, im more than happy to open this up to the community if it's a hassle!
North America
Europe, Middle East and Africa
Asia Pacific