Sony Ericsson / Sony : Software, Firmware and Drivers : K850i Accelerometer + Flash Lite 2.0
>
New Topic
>
Reply<
Esato Forum Index
>
Sony Ericsson / Sony >
Software, Firmware and Drivers
> K850i Accelerometer + Flash Lite 2.0
Bookmark topic
Every one who owns K850i noticed that wallpapers in Laster Precision and Crystal themes react depending on which side is the phone turned to.
I managed to extract those Flash files and obtain their ActionScript but, unfortunately, only partial.
It's missing how the animation gets accelometer data from the phone. If you test those animations on your computer you will notice they react on position of your cursor when it's above the animation. It interprets "that side up" for where the cursor is.
I guess

will never answer what's the ActionScript for accessing the Accelometer.
If you have any ideas please post them!
--
Posted: 2007-12-08 14:49:17
Edit :
Quote
Could you possibley post the action script / swf / fla (depending on which of these you have) so I (and any others who are interested) can see what action script you have found so far and how this changes the view of the theme on the computer.
Cheers
--
Posted: 2007-12-08 15:01:57
Edit :
Quote
Of course!
Here is a RAR archive, it contains original flash wallpapers from theme files and directory where I converted them to FLA with Flash Decompiler.
Link
When publishing those FLA to SWF the result doesn't match the original SWF, as you will notice. That means the SWF wasn't converted back to FLA completely.
--
Posted: 2007-12-08 17:13:10
Edit :
Quote
Thanks for uploading those files, I've had a look at them. Some of the code in there is above my ability in action script and rather confusing although I do understand sections of the script which seem to read accelerometer data. I have found in the
Precision_standby.swf.flp file there is
accelerometer.as which contains the following code:
_root.onEnterFrame = function ()
{
if (classes.AccelerometerManager.mMode == "phone")
{
loadVariables("accelerometer://data", _root);
this.accX = Number(this.accX);
this.accY = Number(this.accY);
this.accZ = Number(this.accZ);
var __reg3 = undefined;
This code seems to be reading an accelerometer variable and setting X, Y and Z possitions although more of the code after this uses code I can't really understand, but the above section would be my best guess for reading the accelerometer data

.
[ This Message was edited by: zaxan on 2007-12-09 12:03 ]
--
Posted: 2007-12-09 13:01:02
Edit :
Quote
Good thing that you started this thread, I never noticed that the standby flash animation moves according to the phone's position. It's so useless, but also very cool.
Good luck cracking the code.
--
Posted: 2007-12-09 13:51:34
Edit :
Quote
so soon we're getting the "accelerometer-ball-game" just like nokia's?;p
--
Posted: 2007-12-09 13:54:05
Edit :
Quote
On 2007-12-09 13:54:05, Duran wrote:
so soon we're getting the "accelerometer-ball-game" just like nokia's?;p
The w910i already has this.
--
Posted: 2007-12-09 14:11:35
Edit :
Quote
On 2007-12-09 14:11:35, gregface wrote:
On 2007-12-09 13:54:05, Duran wrote:
so soon we're getting the "accelerometer-ball-game" just like nokia's?;p
The w910i already has this.
Yeah, called Marble Madness afaik (I thought the K850 had this aswell?), although I think that game would use java to read the accelerometer data rather than flash actionscript, so either way the data from the accelerometer has to be accessible by external applications / files - just I'm not totally sure how yet lol

[ This Message was edited by: zaxan on 2007-12-09 13:21 ]
--
Posted: 2007-12-09 14:20:07
Edit :
Quote
@zaxan, I was looking at that too... It seems that accelerometer returns a non-numeric value:
if (classes.AccelerometerManager.mMode == "phone")
{
loadVariables("accelerometer://data", _root);
this.accX = Number(this.accX);
this.accY = Number(this.accY);
this.accZ = Number(this.accZ);
var __reg3 = undefined;
That script would say something like "If animation is loaded on the phone load variables from accelometer accX, accY and accZ." If you set the phone to write them you'll get "NaN" in each field which would be Not a Number. That means the each "Number(this.accX)" returns NaN. Since "Number(expression)" converts the parameter expression to a number and returns a value... It gives NaN only "If expression is NaN, the return value is NaN."
This is next:
if (!isNaN(this.accX) && !isNaN(this.accY) && !isNaN(this.accZ))
{
__reg3 = Math.round(Math.atan2(this.accZ, this.accX) * 10000) / 10000 + 3.14159;
this.Alpha = isNaN(__reg3) ? this.Alpha : __reg3;
__reg3 = Math.round(Math.atan2(this.accZ, this.accY) * 10000) / 10000 + 3.14159;
this.Beta = isNaN(__reg3) ? this.Beta : __reg3;
__reg3 = Math.round(Math.atan2(this.accX, this.accY) * 10000) / 10000;
this.Gamma = isNaN(__reg3) ? this.Gamma : __reg3;
var __reg5 = 0 - Math.cos(this.Alpha);
var __reg4 = Math.cos(this.Beta);
classes.Application.mAccManager.updateComponents(__reg5, __reg4);
}
return;
}
So, the script checks "isNaN" which returns true if the variable (accX, accY and accZ) is not a number. Which in this case is true. Now it gets difficult. I don't understand this second part completely but I get that it generates a numeric value, an angle in radians to be exact.
Math.atan2(this.accZ, this.accX) "Computes and returns the angle of the point y/x in radians, when measured counterclockwise from a circle's x axis (where 0,0 represents the center of the circle). The return value is between positive pi and negative pi." Now I got "oh shit, its trigonometry" in my head.
__reg3 = Math.round(Math.atan2(this.accZ, this.accX) * 10000) / 10000 + 3.14159;
Now... If I get this correctly, the angle is multiplied by 10000 and then converted to a round number. That number is divided back by 10000 and pi is added to it. I can't get it in my head how does __reg3 number look like after that. And what is this:
this.Alpha = isNaN(__reg3) ? this.Alpha : __reg3;
--
Posted: 2007-12-09 18:14:50
Edit :
Quote
WOOHHOOOH!!! Just got numbers out of it!
http://www.trekker-reactor.isq-networks-server.com/forum/acc-data.zip
Unpack this and put it on your phone! You'll see it reacts on the side you turn it to.
--
Posted: 2007-12-09 18:36:53
Edit :
Quote
New Topic
Reply