ausart
June 13th, 2008, 05:41 AM
Hey first part of my problem is describing/finding the right search criteria.
Basically, if this makes sense, I would like to know how a rollover works, lets say a pop up box, according to where it is in the containing miovie. So for instance on a scrolling timeline, how would the rollover know to make the pop up box appear so that it fits correctly in the content area whether its to the far right or the far left. If its a static rollover function I would assume a rollover in the far right corner might end up disappearing off screen. Am I making sense? Apologies for the long winded attempt to describe this.
Second part being, having problems trying to find a tutorial that covers this.
Any help with this would be appreciated.
Cheers
Largo
June 13th, 2008, 07:13 AM
The ROLL_OVER is a MouseEvent method that is executed when the cursor goes over, for example a movieclip.
So let's say you have a movieclip on the stage that has the instance name of "box", and this code is in the timeline:
box.addEventListener(MouseEvent.ROLL_OVER, box_ROLLOVER);
function box_ROLLOVER(e:MouseEvent):void
{
trace("Mouse is over box!");
}
Then you can see how the rollover works.
Im not sure what you mean when you're talking about this pop up box ...
snickelfritz
June 13th, 2008, 01:17 PM
Hey first part of my problem is describing/finding the right search criteria.
Basically, if this makes sense, I would like to know how a rollover works, lets say a pop up box, according to where it is in the containing miovie. So for instance on a scrolling timeline, how would the rollover know to make the pop up box appear so that it fits correctly in the content area whether its to the far right or the far left. If its a static rollover function I would assume a rollover in the far right corner might end up disappearing off screen. Am I making sense? Apologies for the long winded attempt to describe this.
Second part being, having problems trying to find a tutorial that covers this.
Any help with this would be appreciated.
Cheers
The trick is to target the coordinate space in which an object exists.
For example, the coordinate space for a set of buttons within a movieclip container, is different than the coordinate space for the container itself on the stage.
ie: object translations should be scripted relative to the space in which they exist, not relative to the main timeline. (unless of course, the targeted object is on the stage)
Here's a script that illustrates this to some extent.
example site:http://www.byrographics.com/AS3/popUp/popUp.html (http://www.byrographics.com/AS3/popUp/popUp.html)
stop();
import gs.TweenMax;
import fl.motion.easing.*;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.events.Event;
buttonGroup.mouseEnabled = false;
buttonGroup.buttonMode = true;
buttonGroup.btn1.btnText.text = "popUp 1";
buttonGroup.btn2.btnText.text = "popUp 2";
buttonGroup.btn3.btnText.text = "popUp 3";
TweenMax.to(buttonGroup.popUp, 0, {autoAlpha:0, overwrite:false});
/*
the "popUp" movieclip is contained within the "buttonGroup" container.
"popUp" will therefore share the same coordinate space as other objects within "buttonGroup".
it is then a simple matter to accurately script the position of "popUp" relative to other objects within "buttonGroup".
ie: buttongroup.popUp.y = event.target.y; This will align the vertical center of popUp with the mouse event target.
Notes:
in the actions layer within "buttonGroup" movieclip, mouse events are disabled for "popUp".
in the actions layer within "btn" movieclip, mouse events are disabled for textfield "btnText".
*/
buttonGroup.addEventListener(MouseEvent.CLICK, action, false, 0, true);
buttonGroup.addEventListener(MouseEvent.MOUSE_OVER , action, false, 0, true);
buttonGroup.addEventListener(MouseEvent.MOUSE_OUT, action, false, 0, true);
var button:String = "";
function action(event:MouseEvent):void {
button = event.target.name;
switch (event.type) {
case MouseEvent.MOUSE_OVER :
TweenMax.to(event.target, .2, {scaleX:1.1, scaleY:1.1, dropShadowFilter:{color:0x000000, alpha:0.5, blurX:4, blurY:4, angle:45, distance:4}});
TweenMax.to(buttonGroup.popUp, .4,{autoAlpha:1, y:event.target.y, ease:Exponential.easeOut});
break;
case MouseEvent.MOUSE_OUT :
TweenMax.to(event.target, .2, {scaleX:1, scaleY:1, dropShadowFilter:{color:0x000000, alpha:0, blurX:0, blurY:0, angle:45, distance:0}});
TweenMax.to(buttonGroup.popUp, .4,{delay:.4, autoAlpha:0, y:event.target.y, ease:Exponential.easeOut});
break;
case MouseEvent.CLICK :
TweenMax.to(event.target, .2, {scaleX:1, scaleY:1, dropShadowFilter:{color:0x000000, alpha:0, blurX:0, blurY:0, angle:45, distance:0}});
TweenMax.to(buttonGroup.popUp, .4,{autoAlpha:0, y:event.target.y, ease:Exponential.easeOut});
trace(button);
break;
}
}
ausart
June 15th, 2008, 11:04 PM
46931
46932
thanks for your replies. apologies for the lack of clarity over what I'm after. hope this illustrates it better.
the thing to look at here is the mouseovers for both grabs are for the same button, the difference being the first one is over on the left side of the screen and the second one its over on the right side. what I would like to know is how the positioning of the pop up boxes are specified so that they don't stay static and not disappear off screen?
maybe the previous post was close to what I need/am after.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.