ActionScript 3.0 :: Mouse Move Initiated Scrolling Math

Jun 30, 2010

I'm really not great with the math. I'm pretty close with the formula but my movement is still wonky and doesn't stop where it should. (Top and bottom of the stage, rather than scrolling into infinity). For example, I need it to work like the menu at this link: [URL].

Code:
import com.greensock.*;
import com.greensock.easing.*;
stage.addEventListener(MouseEvent.MOUSE_MOVE, Move);
function Move(event:Event){
var distance:Number = mouseY - (stage.stageHeight)/2;
var percentage:Number = distance / stage.stageHeight;
var targetY:Number = -(content.height * percentage) + content.y;
TweenMax.to(content, 5 , { y: Math.round(targetY), ease:Expo.easeOut } );
}

Test of my code is here: [URL]. My fla is also posted as an attachment.

View 1 Replies


Similar Posts:


Flex :: Scrolling With Mouse Move?

Sep 4, 2011

How can I scroll a group in flex4 with the movement of the mouse position?

Would like it to scroll on the mouse X position.

View 1 Replies

Actionscript 3.0 :: Scrolling Thumbs - When I Move The Mouse To The Left, The MovieClip.x = 0?

Jan 18, 2010

Im making a horizontal thumbnail-scroller. Thumbnails are loaded in to a MovieClip and placed side-by-side with some spacing.When I move the mouse to the far right of the stage, the last thumbnail is to the far right on the stage, and when I move the mouse to the left, the movieClip.x = 0.

I can do this and have a script ready. BUT: If I would like the first thumb to be at 0 when my mouse is 100px from the left side and the last thumb to be to the far right of the screen when my mouse is 100px from the right side, how would I make this happend?I've spent $30 on scripts from activeden and 5 hours on trying to make this happend, but I just CAN'T find the solution..

Code: Select allfunction moveScrollerThumbs(e:Event):void
{
if (mouseY > box.y && mouseY < box.y +box.height)[code]....

View 2 Replies

ActionScript 3.0 :: Math For Smooth Scrolling

Jun 12, 2009

Envrironment: Flash CS3, AS3 I have a horizontal image scrolling project that I am working on, and it works but is not super smooth, I would like it to be smoother when it scrolls, and realize that this is a function of pixels scrolled over time and the FPS of the document.

Right now I am moving the items 1 pixel at a time on a timer with delay of 8 to get it to scroll at the speed I want. I am moving it at 1 pixel in order to catch exactly when an object should wraparound to the beginning of the scroller to show up again. So I don't know that I can really change the number of pixels moved to more than 1 and still have the images spaced perfectly, which makes me think I need to increase or decrease the FPS and or the timer delay to make it scroll smoother. Right now it is at 30FPS and as mentioned the timer delay is 8. Small changes to the delay is not a problem.

This is one aspect of flash i don't fully understand. I would really like to know how to figure this out so I can apply it to future projects as well without doing trial and error to make it smooth. Can it be function, like a way to figure out I need to move a 120pixel picture 60 pixels in 2 seconds, what should my FPS be and the picture size and movement size and number of seconds can be variables?

View 7 Replies

Flex :: Scrolling Interval In A Spark List With Tilelayout Oversized While Using Mouse Wheel After Scrolling With Mouseclick

Aug 27, 2010

I have a spark List with an item renderer and a tile layout. If I scroll by clicking with the mouse on the scroll bar and trying to scroll with the mouse wheel after that, there is a problem: The interval of the scrolling is oversized, instead of scrolling one item down (or up) the List scrolls 4 items down (or up).

[Code]...

View 1 Replies

ActionScript 2.0 :: Movement - Object Move Towards The Mouse When Move The Mouse The Towards The Object And Backwards

Jun 27, 2006

how to do an object move towards the mouse when i move the mouse the towards the object and backwards when i move the move away, something liike the menu on [URL]

View 2 Replies

ActionScript 3.0 :: Mouse Events Fail To Trigger If Mouse Move Too Fast?

Nov 18, 2009

It has been awhile since I have worked in flash.Right now I am working on something where I would like a panel to disappear when someone mouses off the stage.stage.addEventListener(Event.MOUSE_LEAVE, leaveHandler); It usually works fine but if I move my mouse really fast it doesn't fire. I have also tried the same thing using a custom invisible button that surounds the perimeter of the stage and I have tried ROLL_OVER and MOUSE_OVERand again, if I do it too fast my event doesn't fire (I am using trace)I can't find anything on the net about this - is this typical of flash that if you move your mouse too fast you break it? Do I need to increase my frame rate (I would really rather not because I have perfectly timed animations - I am at 30 frames per second)

View 1 Replies

Professional :: Get Small Rectangle To Appear (with Text) & Move With The Mouse When The Mouse Is Over Image?

Dec 27, 2011

when the mouse rolls over an image, text appears (in a small rectangle) and it moves with the mouse, only while it is still over the image.
 
Or at least, does anyone know what this is called or how to do it?

View 3 Replies

Flash 10.2 :: Update Hardware Mouse Cursor Immediately, Before Mouse Move?

Mar 13, 2012

As of Flash 10.2, Flash supports hardware accelerated mouse cursors:[URL]..Unfortunately, the mouse cursor doesn't update until AFTER the mouse moves. You can see this behavior on the web page above. If you click "Set to custom cursor" in the sample app at the bottom of the article, you'll see that the cursor doesn't change until you move the mouse.

Anyone have a trick for updating the mouse cursor immediately, before the user moves the mouse? I tried doing Mouse.hide(); Mouse.show(); but that doesn't work.

View 1 Replies

ActionScript 2.0 :: Mouse Scroller - Images Won't Move Depending On The Mouse Movements

Jan 12, 2011

I am creating mouse scroller and when I insert actionscript my images wont move depending on the mouse movements..I am using Flash cs5 and Actionscript 2.0...this is my actionscript:

[Code]...

View 9 Replies

Flex :: Mouse Move Fires Mouse Click (Adobe Air)

Oct 11, 2011

I am trying to have two guestures on a SpriteVisualElement which I thought should be pretty simple implemented: Mouse_Move for sweep Gestures and mouse click to enable.. So I have 2 Eventlisteners on my stage:

[Code]...

The main problem is that every type of sweeping on the screen also fires the taphandler().. how to identify the correct event? I tried to to my taphandler only if(!event.buttondown) but no success.

View 1 Replies

ActionScript 2.0 :: Swarm To Mouse With Elasticity And Move Randomly With No Mouse

Mar 17, 2005

I started another thread where i had gotten help and combined the snow tutorial and the programatic mask tutorial to create particles that reveal an in-focus image over a blurred one. I just need help making the particles swarm around the mouse when it is present and have the particles just float around when not. Presently the random motion is just fine and looks like this (i just inverted the this._x and this._y so that they would go with the mouse direction not away from):

[Code]...

View 1 Replies

ActionScript 3.0 :: Mouse Move Event When Mouse Out Of Stage?

Sep 1, 2011

I'm wondering how is this task done that listen to mouse move event when user cursor is out of stage?

View 6 Replies

ActionScript 2.0 :: Move Mc With Mouse But When Mouse Stop Mc Hide?

May 13, 2010

i am using this on Mc

onClipEvent(enterFrame){
diffx = _root._xmouse - this._x ;
diffy = _root._ymouse - this._y ;

[code]....

View 1 Replies

ActionScript 2.0 :: Restrict The Mouse So That Users Cannot Move Their Mouse?

Sep 21, 2002

How can you restrict the mouse so that users cannot move their mouse into a certain area, (or a certain y or x value)? This is useful to me because I need it for a game.

View 2 Replies

ActionScript 3 :: Flash - Math.floor Acting Like Math.round?

Mar 7, 2011

Here is the problem:

var p:int = 0;
var n:Number = 0;
n = 32.999999999999999;
p = Math.floor(n);
trace(p); // returns 33
n = 32.11111111111111;
p = Math.floor(n);
trace(p); // returns 32

I would expect both of these to return 32. I have searched, and it seems this is an unreported bug in AS3. Or ... am I doing something wrong?

View 4 Replies

ActionScript 2.0 :: What Is The Diffrence Between Math.floor And Math.round

Sep 26, 2005

Wat is the diffrence between these two?

View 2 Replies

ActionScript 2.0 :: [F8] Math.round And Math.ceil?

Feb 16, 2009

I have a code in which I have to use Math.round if a certain value is for example 3.67 (67 is higher than 50) and Math.ceil if a value is for example 3.23 (23 is lower than 50). What can I do to make flash calculate if what after the dot �.� in 3.23 (for example) is higher than 50?

View 2 Replies

ActionScript 2.0 :: Metadesign Scrolling Navigation - All Buttons Move To The Left But Not To The Right

Feb 20, 2005

I created the scrolling navigation, akin to [URL] by changing a script that I had. However, I'm stuck now, as all the buttons can move to the left, but not to the right. If it does not make sense, check out the attached swf and fla.

View 2 Replies

CS3 Mouse Direction Scrolling?

May 11, 2009

I designed a horizontally oriented page that expands to the right. The problem is, the content goes off the screen.

I want to know how to make all of the content on the website scroll with the mouse direction like this webpage- sectionseven.com

Does anybody know how to do this or something similar?

View 21 Replies

Mouse Based Scrolling?

Aug 23, 2009

i'm trying to setup a scrolling list of products but without the use of a scrollbar. It would be really thankful if someone would assist me in getting attached fla integrated with mouse based scrolling. So if the user moves his mouse to the upper corner of the product list then it would scroll up and vice-versa.

View 1 Replies

Actionscript 3 - User Initiated Pop-up Window Within Flash Ad?

Sep 3, 2010

I am currently working on a flash ad for a local bank. One of the frames of the animation requires that the disclaimer text be displayed. I am attempting to create a tab within the ad that if clicked will allow a small window to slide up (roughly half the height of the medium rectangle), display the disclaimer and then close. This would occur while the main animation is still progressint. The problem is I'm not sure how to go about it.

I've seen this technique in an Insurance ad on one of the major ad networks but have not been able to determine how to do it.

I am using Flash CS4. I am marginally proficient in AS3.

View 2 Replies

ActionScript 3.0 :: Action Be Initiated Through Pressing A Key Combination?

Sep 11, 2008

Can an action be initiated through pressing a key combination? Here's a snippet instructing a MovieClip to move right when SHIFT+Z are pressed...

Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, testFn);
function testFn(event:KeyboardEvent){
if(event.keyCode == 16 && 90){
dot.x += 5;
}
}

Only the first key is recognized, i.e. the dot moves when SHIFT only or SHIFT+Z together are pressed; the swf's ignoring the second key.

View 4 Replies

ActionScript 3.0 :: Where Is The Current Custom Class Initiated From?

Oct 16, 2009

A Custom Class can be initiated from an FLA or from another Custom Class. Is there a way to find at run-time, where is the current class initiated from?We can't use parent class before it has been added with addChild(thisClass), neither we can use root class to identify its originator. I believe, there should be a way to find it.

View 3 Replies

ActionScript 2.0 :: Scrolling Thumbnails With Mouse?

May 22, 2007

I followed a tutorial over at [URL] regarding scrolling thumbnails with the mouse pointer. Everything is working fine except the thumbnails are not stopping at the left and right x position that I have set. I'm tracing the x position of the thumbnail MC and it's showing that it's not changing, but the MC is definitely still moving. The code I'm using is:

Code:
panel.onRollOver = panelOver;
function panelOver(){
this.onEnterFrame = scrollPanel;

[Code].....

View 8 Replies

Mouse Wheel Scrolling Image?

Nov 15, 2011

I would like to make a panarama viewer that scrolls the image left on mouse wheel up and right on mouse wheel down.my image instance is bg_mc

View 10 Replies

Scrolling Single Image On Mouse Over?

Sep 22, 2009

I have a very loooong image, all I want is to scroll left and right on mouse over. I´ve already searched extensions, everything I find is for multiple images. Here´s an example of what I want to do [URL]

View 3 Replies

ActionScript 2.0 :: Auto - Scrolling When Mouse Over?

Feb 9, 2009

i have completed this script which i have learnt so how do i convert this script into automated scroll when i mouse over the image to left or right by tracking the mouse ?

View 7 Replies

ActionScript 3.0 :: Adding The Mouse Scrolling?

Oct 20, 2010

I got this scrolling code here which works good but I wanna make it so when the mouse rolls over the mask the user can scroll with the mouse wheel.

ActionScript Code:
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

[code]....

View 0 Replies

ActionScript 2.0 :: Mouse Scrolling Xml Menu?

Sep 12, 2007

mouse scrolling xml menu?

[URL]

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved