ActionScript 3.0 :: Detect One "shake" Movement With Accelerometer?
May 11, 2011How can i detect one "shake" movement with accelerometer?
View 1 RepliesHow can i detect one "shake" movement with accelerometer?
View 1 RepliesI'm moving an HSlider thumb via the accelerometer. The following code works fine. The problem, though, is that as I keep tilting the device, xSpeed continues to increment. This means that when I now tilt it the other way, the thumb doesn't move for a while -- since, depending on how long I was holding tilted in that intial direction, xSpeed has been going up and up.So this works, but with the abovementioned flaw:
private function readAcc(e:AccelerometerEvent):void
{
xSpeed -= e.accelerationX * 4;[code].......
But what I want to do is to stop incrementing xSpeed once the hSlider.value == either the minimum or the maximum. Sounds simple, but when I put in if statements, they prevent the thumb from moving at all:
private function readA(e:AccelerometerEvent):void
{
if(h.minimum < h.value && h.maximum > h.value)[code]........
I was hoping someone might have found a tutorial or done one on how to make a 3d field of infinite stars that can be navigated with mouse movement or the accelerometer..
View 0 RepliesI am looking for a script to detect if the mouse has not moved for say 15 seconds or 30 seconds, and if this is the case then, its plays some movie-clip or follows with the next scene.
View 3 Repliesso in as3 there is a nifty event listener for if the mouse has left the stage area, there is however, nothing of the sort in as2. so, Im trying to figure out how to go about this, Im thinking an onEnterFrame function that listens for eitherA.) no Movementor B.) the same x and y position for an extended period of time.Im thinking the no movement would do the trick but what should I be checking for on the onEnterFrame, and how would I tie setInterval into it? what properties would I check for if I used an IF/THEN statement?
View 1 RepliesI wanna detect the direction of mouse movement. If the mouse moves tpwards the left or right of its currrent position, i want to detect it. Is there anyway to identify such movement. Actually i am implementing a 360 degree rotation of image. That means , if the mouse moves along the left side of its current position, then the image should move along its left side, otherwise it should move along the right side. For example, view this site: [URL]
View 4 Repliesi want to know if it's possible for as3 to detect someone moves the flashplayer window, and if so, get it's new XY coordinates.And, again, if so, change them itself (aka position the flashplayer window)
View 1 RepliesBy biggest problem is that when I hit a wall, my object stops moving, but the mouse arrow still moves, and it is very likely that eventually the mouse cursor will reach the limits of the screen, making it impossible to move the object to the left (assuming the cursor has hit the left side of the screen).I am now using the following scripting:
Code:
function Start()
{
[code]......
I use something like this code to detect the speed of the movement of a dragged object
PHP Code:
if (!go) {
this["position_"+i] = this._y;
i++;[code]....
This way I can find in what direction the mouse vertically has moved and at what speed. The problem is that every once in a while the speed will be in the opposite direction. What do people use to detect the direction of the movement of the mouse?
AS3 script that detect if the mouse has no movement for 1min +no keyboard activity, it will call a function to change the frame in TimeLine.
View 8 Repliesi am building iphone small games, so far using arrows to move right / left, i tried to find code to move object by accelerometer, if the iphone tilts right it goes right..
View 1 Repliesjust started my first theme and stacked..in those 8 little black things is a small picture..all i want to do is that the red one will grow up to the whole screen for 5 seconds with a shake(its a shake-it theme) and then will back to normal..
View 1 RepliesI'm trying to do a pretty simple effect here. What I originally intended to do was to put a simple shaking effect into the over and down states in the button itself on the movieclip that comprises its graphic.
However, Flash doesn't seem to want to have actionscripting within a button.
So what I'm trying to do is to make a button shake by having the actionscripting for it in an actions layer outside of the button.
I have event listeners that call my shaking function on MouseEvents: Roll_Over, Mouse_Move, and Mouse_Over. It shakes just fine unless the mouse is kept still on the button.
Is there a MouseEvent that will constantly call the shaking function I have whenever the cursor is on the button?
I'm using flash builder burrito and wrote this quick class to test the Accelerometer on my phone. It looks very choppy. How I can improve the motion so the sprite is smooth and not so choppy.
Code:
Select allpackage{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.AccelerometerEvent;
import flash.events.Event;
import flash.sensors.Accelerometer;
I need to know how to shake the popup browser window title bar (like in an earthquake) using just action scripting. I found some tutorials on this effect but they involve html which i can't/don't know how to use coz my animation is in a cd rom not web.
View 1 RepliesI added the accelerometer fucntion to my app for android using AS3. It works great. The only issue I am having is the starting orientation of my mobile device. It seems like it has to lay flat in order to center movement. I want it so that I can hold the device in my hand and tilt up and down in landscape mode. Like a 45 degree angle maybe.
View 2 RepliesThe Accelerometer UPDATE event never fires, tho isSupported returns true, when the flash app is running inside the android web browser. How can I make it work?
[Code].....
[url]...
I'm trying to make the text elements (graphics) in the above link shake. Barely, randomly, and sporadically. Just enough to get somebody's attention.
Anyway, I've used flash a couple times, built a couple flash websites, but nothing much with ActionScript. I figure AS would be the best way to do this, since I might repeat this on other elements within this website.
I need to know how to shake the popup browser window title bar (like in an earthquake) using just action scripting. I found some tutorials on this effect but they involve html which I can't/don't know how to use coz my animation is in a cd rom not web.
View 1 Replieshow do i get my pages to shake in browser when loaded.I can't remember where i saw it before but i did see it before i went to the site when the site loaded my entire screen shook like an earthquake it was pretty cool it made me feeel like my monitor was shakin.
View 3 RepliesI have a javascript that will do a browser shake, but how can I get Flash (or the actionscript rather) to trigger the script? I have a client who wants a repetitive shake opening for a site.
View 3 RepliesI have this Accelerometer event, taken from the code snippets, and it works fine, but i would like to know is it possible to turn this off by a button.
[Code]...
I'm working on an application in Flash CS5.5. I've been working with the code snippets, and the template that deals with keeping an accelerometer-controlled movieclip on stage. That works great. However, I'm trying to find a solution having a larger than the stage sized background be controlled by the accelerometer, but stop moving once it reaches the edges of the movieclip. So, it would move all the way to the right until the edge of the movieclip, then stop. Below is the code sample that I've been trying to manipulate (from the included template that keeps the ball movieclip from going off-stage).
import flash.events.Event;
var accelX:Number;
var accelY:Number;
var fl_Accelerometer:Accelerometer = new Accelerometer();
fl_Accelerometer.addEventListener(AccelerometerEvent.UPDATE, fl_AccelerometerUpdateHandler);
function fl_AccelerometerUpdateHandler(event:AccelerometerEvent):void {
[Code] .....
I need an application to test the accelerometer values on my mobile phone. I need the values on my system so that I can manipulate that info for something else.
If I write an Android application, the values will be inside the Mobile phone, which is not what I want.
I have written an app in Flash, n tested in Adobe Device Central. Only catch is that instead of simulator, I need to test it on my mobile. How do i do this?
I have a javascript that will do a browser shake, but how can I get Flash (or the actionscript rather) to trigger the script? I have a client who wants a repetitive shake opening for a site.
View 3 RepliesAnyone know of a place with a sample .fla on how make a browser window shake controlled by Flash.I have tried a few tutorials from other sites and have had no luck. I am wanting to shake the window's x and y when a movie clip reaches a frame in the timeline.
View 5 RepliesI've been playing with carousel code, and was wondering how to change it from circular animation (carousel) to left/right linear (conveyer belt) style animation, how to change the mover code and 't.angle = i * ((Math.PI*2)/numOfItems);'
[Code]....
I have a mc (fStrip) which looks like a piece of filmstrip with thumbnail images in it. I want this mc to move when the users mouse is positioned over it, but I only want it to move only along it's x-axis and in a direction opposite that of the mouse. And I want it to move or flow smoothly.
I've been trying to figure this out (see my lame attempt below) but without much luck.
onClipEvent (mouseMove) {
buffer=20 //movement buffer
mousePos=_root.fStrip._xmouse //store mouse position
if (mymouse!=_root.fStrip._xmouse){ //if the mouse has moved
[Code].....
I wish to get the effect of ants scuttering across the screen or up a tree, I have not decided which direction yet. I started with the tutorial code for the snow effect from kirupa, and changed it around to fit the little vector ant I created. The way I have it now looks pretty good, but the movement is a little too fluid. They obviously move in sinusoidal paths bc the code tells them to. I have about 20 copies of the main obj, and they're all a little different in size and specs (speed, transparency, etc) but what I was wondering was if there is any way I can change the code to make it a little more hectic, or erratic, not so fluid. If there is no way of doing so, it looks pretty good right now. If there is, however, I think it could look awesome. here's the code I'm using for the object.
onClipEvent (load) {
//stage
movieWidth = 850;
movieHeight = 50;
[code]....
how to get the camera to move with a character? At the minute he just moves off screen when i press right rather than the camera following him.
View 3 Replies