Ok so check out this page: http://paragon.sortismarketing.com, and check out the scrolling menu below. This is the infinite scrolling menu found on this site. It works great.
Now i have one request, I know how to create a rollover with a movie clip that scales, but what I can’t make work is the buttons in this movie scale(get larger, and smaller) upon rolling over and upon rolling off.
Please help. I was told there is a way to do this with action script instead of making the buttons a movie clip. is this true?
hey onecommoncode. i used your code and added a click event to it. when i click on the button it should take me to frame 3. it takes me there, but it also gives me this error code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at website1_fla::mcMaster_1/mouseListener()
I’d rather see you using a TweenLite than the built-in tween class.
It’s superior in virtually every way, and only costs you 2K.
The example below uses the targetFrame variable to move the playhead to specific frame labels.
I also added setChildIndex to the over state so the selected button is always on top.
fla is attached.
/*----------------------------------------------------------------------------
frame navigation script.
wrap button instances in parent movieclip "btnGroup"
button instance names correspond with their respective frame label targets.
----------------------------------------------------------------------------*/
stop();
import gs.TweenLite;
import fl.transitions.easing.*;
btnGroup.addEventListener(MouseEvent.MOUSE_OVER, mouseListener, false, 0, true);
btnGroup.addEventListener(MouseEvent.MOUSE_OUT, mouseListener, false, 0, true);
btnGroup.addEventListener(MouseEvent.CLICK, mouseListener, false, 0, true);
btnGroup.buttonMode = true;
btnGroup.mouseEnabled = false;
var targetFrame:String = "";
function mouseListener(event:MouseEvent):void {
switch (event.type) {
case MouseEvent.MOUSE_OVER :
btnGroup.setChildIndex(event.target as MovieClip, btnGroup.numChildren-1);
TweenLite.to(event.target, .5, {scaleX:1.5, scaleY:1.5, ease:Strong.easeOut});
break;
case MouseEvent.MOUSE_OUT :
TweenLite.to(event.target, .5, {scaleX:1.0, scaleY:1.0, ease:Strong.easeOut});
break;
case MouseEvent.CLICK :
targetFrame = event.target.name;
gotoAndStop(targetFrame);
break;
}
}
The buttons and their respective frame label targets share the same names.
If button “btn1” is clicked, it’s instance name will be assigned to the targetFrame variable, since this variable has been defined as the event.target.name within the CLICK function.
ie: “btn1” is clicked; event.target.name = “btn1”, so targetFrame = “btn1”, so the script below actually represents gotoAndStop(“btn1”); playhead is sent to the frame label “btn1”.
Below are the key aspects of the code.
var targetFrame:String = "";
targetFrame = event.target.name;
gotoAndStop(targetFrame);