ActionScript 3.0 :: Orbiting MovieClip If Mouse Within 50 Pixels
Jun 3, 2009
I'm trying to do an animation, where a movieclip will orbit around the mouse if the mouse is within 50 pixels of the movieclip. Basically, the mouse will get near an object and the object will orbit the mouse, even if the mouse moves. The idea is that here will be a number of these objects on the stage, and as the mouse 'collects' these objects, each one will orbit around the last one 'collected'.
Here's what i have so far-
Code:
package{
import flash.display.MovieClip;
import flash.events.*;
public class soundObject extends MovieClip{
[Code] .....
It kind of orbits, but it's not working very well. Also, my conditional statement doesn't work.
View 2 Replies
Similar Posts:
Feb 22, 2012
I'm just re-learning Flash after a 12 year break. How can I make the 3d orbiting light trails that appear on the 2advanced video on YouTube? Here's the link: [URL] Is it simply a case of making a single trail and then animating a mask along the trail to give the effect of movement?
View 1 Replies
Aug 13, 2010
I'm trying to move the mouse and check how many pixels I "walked" by comparing the positions every frame, my idea was doing it with arrays, but I really don't know how to make it.
View 5 Replies
Oct 5, 2011
I have a bitmap with many colors inside it. I want each color, when clicked, to preform a different method. How do I determine the pixel's color value and use it for a mouse event? I found bitmap hit detection but I cannot figure out how to use it (because I have many colors inside the bitmap).
View 2 Replies
Dec 27, 2010
I'd like to draw a line from pointA to the mouse position and trace along that line and return the x,y position every 5 pixels.
View 2 Replies
Mar 24, 2012
so instead of the pixels being dissolved, the pixels being added? :
ActionScript Code:
var Anim:TransitionManager = new TransitionManager(blackbox);
Anim.startTransition({type:PixelDissolve, direction:Transition.OUT, duration:1, easing:None.easeOut, xSections:35, ySections:35});
basically what i would like is the end point to be the start point and the start point the end point.
View 2 Replies
Jun 17, 2009
I have a swf file that loads into my main movie, and within that swf there is a masked image that i would like to scale using zoom in and out buttons and also by using a slider bar.However i cant find any tutorials that will allow me to combine the two.I have used the following code for the buttons. Which seems to work ok but i would like it to be a little smoother. (using speed or some sort of easing??)
ActionScript Code:
zoomPlus.onRelease = function(zoomIn) {
if (test_shirt.shirt._xscale == 400 && test_shirt.shirt._yscale == 400) {[code]....
but for this code it keeps shrinking my initial object down to 10 pixels by 10 pixels..
View 0 Replies
Nov 18, 2009
I have a movie clip called column1_mc. when I click a button I need to move the movie clip in incremental moves consisting of 30 pixels.
column1_mc._y = 30;
Does not work because that is giving a _y coordinate.For example.I need to make the movie clip jump to _y 300 but make 10x30 pixel incremental jumps. Moving 10 times 30 pixel jumps.
View 1 Replies
Apr 29, 2009
I'm moving a movie clip using actionscript (as2) instead of a motion tween (because I want to save file size) and I have this code on the first frame of the main timeline ("stone" is the movieclip instance name) and it tells the movie clip how many pixels to move in the x direction:
Code:
xTargetstone = 600;
I have this code on the movie clip itself ("stone" is the mc instance name) to handle the actual moving of the movie clip:
Code:
onClipEvent (enterFrame) {
xstone = getProperty(_root.stone, _x);
movestone = _root.xTargetstone - xstone;
setProperty(_root.stone, _x, xstone + (movestone/5));
}
The movement works fine, but the issue is that it starts out fast and then slows down over time (even though that amount of time is small). The result is that the movie clip seems to wiggle and vibrate before it stops. Is there a way for me to change the code so that it doesn't wiggle and vibrate? perhaps something with the math I'm just not totally understanding? I would like a nice consistent motion from start to finish, while being able to set the time it takes to move etc.
View 4 Replies
Feb 16, 2010
Is it possible to change the size of a moveClip on the stage by pixels instead of scaling it with scaleX and scaleY? In other words I would like to be able to in crease or decrease the width and height of a movieClip using pixels.
Let say I have this moveClip on the stage, how would you change its width and height using pixels
myBtn.addEventListener(MouseEvent.CLICK, resizeMe,false,0,true);
function resizeMe(event:MouseEvent):void{
// amount doesn't matter
//myMc.scaleX = 1;
//myMc.scaleY = 1;
}
View 2 Replies
Jun 2, 2010
In a project i'm doing I have a custom cursor, using the start drag command and mouse.hide. the issue being that the movieclip being dragged is blocking the mouse from initiation mouse events properly.
View 3 Replies
Aug 11, 2009
I have a horizontal scrolling movieclip that scrolls when the mouse is left or right of a certain point of that movieclip. However, it only moves slightly then stops when the cursor goes over it, it doesnt actually scroll normally...
[Code]...
View 1 Replies
Apr 17, 2010
I am trying to activate a rollOver-function when the mouse rolls over a movieclip inside of a movieclip.On the main window (root), first you rollOver a button where a window shows up with more options (movieclips).From stage, my first movieclip is called "catapultas_read_more" which leads to amother movieclip called "pic1_mc". The label that is going to play when mouse over on pic1_mc is "rollOn".I tried this.gotoAndPlay("rollOn); directly inserted to the movieclip, but the movieclip inside pic1_mc never starts
View 8 Replies
Oct 2, 2009
i have 2 intersecting movieclips.
is there a way to hit test point NOT detecting a bottom movieclip if the mouse is over the top movieclip?
View 3 Replies
Mar 4, 2009
i've not tried to do anything odd with eventListeners up until now. i have a movieclip with multiple frames that i use AS to attach a textfield to it. problem is i have a eventlistener for when the mouse rollsover the movieclip to go to frame 3 of the movieclip.
[Code]...
what's causing the textfield to suddenly take precedence and how do i stop it. when i trace the evt.target - it is my movieclip.
View 5 Replies
Jan 26, 2011
Okay I have a script in which I have added an image to the stage. It is absolute centered. I then have another with is on top but much bigger. I would like the big image to move opposite of my mouse position on the smaller image. ie: cursor is on bottom left corner the bottom left corner of the larger image is in the same spot. And the same thing for any other area.
I have tried many different ways but to no avail. I have done research but no one has been able to give me a solid answer. Anyone know of a way to accomplish this. Keep in mind this it needs to work regardless of the image size.
View 1 Replies
Feb 9, 2006
I have a movie clip that scrolls side to side when you rollover it but when the mouse is off it continues to scroll - I need the movieclip to slow to a stop when the mouse rolls of the movieclip. I've have been playing arounds with the hitest code (red) but this does not fix it... Its prolly a simple problem - I am not much of a coder....
[Code]...
View 3 Replies
Oct 13, 2009
i am adding enterframe event listener on the condition that mouse is not on the stage.
if (!((mouseX < stage.stageWidth) && (mouseY < stage.StageHeight))) {
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
but the if condition always return false because the mouseX and mouseY seems to take the last value when it leaves the stage(i.e. moved out of the flash content
View 2 Replies
Sep 27, 2010
I need to get a similar effect to this [Url] When I move the mouse, some MovieClip moves to the oposite side, with an easing fx.
View 3 Replies
Mar 30, 2009
I have been trying to convert this effect into AS3 but have been having majour issues : rotate clip
I have an object (class) with a handle, when dragged I would like the clip to rotate with the mouse (much like rotating an object in photoshop). I have put my code into an ENTER_FRAME event, and have been using a matrix object to do my rotation (is there an easier way?)
Code:
private function rotateClip(e:Event)
{
myMatrix.rotate((Math.floor(180*Math.atan2(mouseX,mouseY)/Math.PI)+90));
[Code].....
was my attempt at converting the code from the example link. I've also tried various other methods using trig to no avail.
View 1 Replies
May 11, 2009
I've created some animated buttons (using movieclips of keyframe animation) and when the mouse goes over the button it starts a new animation sequence.now I would like to add some text when the mouse goes over the button but I tried adding the text I want to a new layer of the animation but obviously this just plays for the duration of the animation sequence or if I add another keyframe so it only shows for a short time then it will flash up each time the sequence loops around (I don't want the overstate sequence just to play once - I want it to keep going while the mouse is over the button)
View 7 Replies
Nov 26, 2010
I made a game in AS2 where the player rotates towards the mouse, then discovered you need AS3 for 3D things(which I plan to add later) so I re-made the game in AS3. I think I can more or less do the rest of it but the rotation is driving me crazy. This code works fine in AS2 but when I try it in AS3 it completely fails. The player just wobbles about a 90 degree radius.
[Code]....
View 1 Replies
Oct 7, 2009
from various books, I know that to add eventlisenter for mouse click to a movieclip:
movieClipName.addEventListener (MouseEvent.CLICK, clickFunction);
then I define the function
function clickFunction(event:MouseEvent)
{ bla bla bla }
My questions are (as silly as they might sound!),
a) why do we need a parameter (i.e. event:MouseEvent) for clickFunction??
b) since we have a parameter for clickFunction, when we feed this function into addEventListener, why didn't we write movieClipName.addEventListener (MouseEvent.CLICK, clickFunction() );
View 3 Replies
Jan 28, 2010
In Flash/ActionScript2, is it possible to capture the mousemove, buttonup and down event but only within one MovieClip? At present, i can capture mousemove etc. via a listener, but only for the entire stage..I need to draw a rectangle for selecten, and then press a save button. The problem is i save the coordinates on mousedown and up, but when I press on the save button, it saves the coordinates of when you pressed on the save button...I've tried mc.onXY, but that either listened not at all or to the entire stage...
Edit: Code as requested
mc.onMouseDown
should be
mcImageToCrop.onMouseDown
I did change it back to mc when mcImageToCrop didn't work...
import flash.geom.Rectangle;
Create a container by calling the setUpContainer functie wich will return a movieclip with a needed propeties set.
var container:MovieClip = setUpContainer();[code].................
View 1 Replies
Feb 2, 2009
URL...I would like to be able to move the ball by just bumping into it with the mouse (no clicking). How could i do this?
View 0 Replies
Oct 11, 2009
How can I do a movieclip that rotate himself when mouse is over it ?
would be nice there was a acceleration at the beginning and a deceleration to the end.
View 2 Replies
Nov 30, 2005
Im wanting to make a Movieclip budge when my mouse tries to go over it.Sort of a scattering effect.Say on my stage I have a movieclip, which contains a picture of a square.When my cursor goes near Square movieclip, it scatters, and reveals some text which is on the stage
View 2 Replies
Jun 5, 2003
Is there a way to know the speed of a mouse or how long a mouse is over a movieclip?
Coz i have a movieclip that if I rolled over it for a specific period of seconds, it shows a picture but if the movieclip was just passed over a second, it won't show the picture.
View 2 Replies
Mar 19, 2009
I'm loading an image into a thumbnail button in flash from an XML file.
The button will scale up when it is mouse-over'd (is this a word?)
Here is the loading of the image into the movieclip
Code:
imageLoader = new Loader();
//imageURLArray[i] = "image.jpg"
imageLoader.load(new URLRequest(imageURLArray[i]));
[Code]....
Without the image loaded in it works fine. But with the image loaded in, the image is on top of the button so the scale event triggers the Loader object to scale ( instead of the button it is parented to). Is there a way to make the Loader object or the moveiclip it's parented to (imageHolder) unresponsive to a mouse over so only the thumbnail will scale (and its children as a result of course).
Here is the parenting if you need help visualizing it:
[ thumnail:MovieClip ] --child--> [ imageHolder:MovieClip ] --child--> [ Loader:dont know]
View 8 Replies
Mar 28, 2009
Can anyone tell me how could I be able to move a movieClip in opposite direction of the _xmouse?That means when I move the mouse pointer to right side, my movieClip would move some distance to the left side. And when I move the mouse to the left ,the movieClip should also move to right.I have done something in the attached file but i dont want to continue the movieClip's movement when the mouse movement stops.
View 6 Replies