Sony Ericsson / Sony : Themes, ringtones, screensavers, games, video clips : Using the accelerometer to rotate
>
New Topic
>
Reply<
Esato Forum Index
>
Sony Ericsson / Sony >
Themes, ringtones, screensavers, games, video clips
> Using the accelerometer to rotate
Bookmark topic
Alright, well I found a wallpaper of a linken park logo that would rotate based on how the phone was held, and I'm trying to create my own version of this, I've managed to get the image to rotate based on my mouse when on the pc, and I've decompiled the original .swf to try to get the code to work but it wont work.
Code:1;
1;
onEnterFrame = function ()
{
displayDevice = substring(eval("/:$version"), 0, 2) == "FL" ? "phone" : "pc";
if (displayDevice == "phone")
{
loadVariables("accelerometer://data", _root);
var angle = Math.round(Math.atan2(_root.accX, _root.accY) * 10000) / 100000;
rotAngle = angle * 57.2958;
var dr = rotAngle - logo._rotation;
if (Math.abs(dr) > 180)
{
dr = dr }
logo._rotation = logo.rotation + dr / 5;
return;
}
var angle = Math.atan2(_root._xmouse - 120, _root._ymouse - 160);
logo.rotation = angle * - 57.2959;
}
;
The code is from Trekker Reactor. That is the code I am using, but the error I get is that var angle is already defined (Which I know it is), but that is how is set out in the original and I can't seem to get it to work, can anybody help me?
[ This Message was edited by: Toeler on 2008-09-23 20:35 ]
--
Posted: 2008-09-23 13:36:48
Edit :
Quote
if you got this from Trekker Reactor , shouldn't you credit him ?
--
Posted: 2008-09-23 14:25:09
Edit :
Quote
Original post edited.
[ This Message was edited by: Toeler on 2008-09-23 20:43 ]
--
Posted: 2008-09-23 21:34:18
Edit :
Quote
New Topic
Reply