Esato

Forum > Sony Ericsson / Sony > Software, Firmware and Drivers > How to make auto-rotate function in Flash Lite 2.0 (K850i)

Author How to make auto-rotate function in Flash Lite 2.0 (K850i)
Duran
K850 Blue
Joined: Aug 25, 2006
Posts: > 500
From: Netherlands
PM
Posted: 2007-12-16 23:35
Reply with quoteEdit/Delete This PostPrint this post

On 2007-12-14 20:39:40, LCARS-Expert wrote:
@Dewgel, are you referring to something like this:
http://www.youtube.com/watch?v=c8j4bXQSdHY

(My latest project, btw)

thats awesome:O should be implented in the default browser.
also you could make it change when tilting/rotating the phone for 1 sec:o
LCARS-Expert
K850 Green
Joined: Aug 24, 2007
Posts: 194
From: Croatia
PM, WWW
Posted: 2007-12-17 13:33
Reply with quoteEdit/Delete This PostPrint this post

On 2007-12-16 23:35:13, Duran wrote:

On 2007-12-14 20:39:40, LCARS-Expert wrote:
@Dewgel, are you referring to something like this:
http://www.youtube.com/watch?v=c8j4bXQSdHY

(My latest project, btw)

thats awesome:O should be implented in the default browser.
also you could make it change when tilting/rotating the phone for 1 sec:o


When phone is on its side the X axis is 990 (thats 9.81m/sē). When shaking X exceeds that value, thats why it reacts only on shake. If I set it to tilt it would change image when you are putting your mobile to your pocket.

I need some help from ActionScript know-hows. How to make Flash animation load external images (jpg & png) but with any name? (anything.jpg and anything.png).

One more thing about the shake controlled wallpaper I'm working on: unfortunately I can make it go only in one direction. When you shake your phone X axis goes >990 and <-990 later on so 2 directions get applied at once and that messes up the picture.
Dewgel
K850 Blue
Joined: Dec 13, 2007
Posts: 14
PM
Posted: 2007-12-18 00:57
Reply with quoteEdit/Delete This PostPrint this post
Would you mind awfully if you uploaded that so I can have a look at it, along with the fla file.

I just want to tinker with a couple of things on it, I'll re-upload it for you to look at though so don't worry about theft ^_^


Also, I wasn't referring to that actually, but that's very awesome.. I was just simply referring to how the iPhone's Auto Rotate features are animated smoothly, all I done was made the jpeg imagine in flash a "Movie Clip" and animated it spinning.

Good work, I'm desperate for you to send this.
Stud
Satio Black
Joined: Nov 19, 2007
Posts: 62
From: Dominican Republic
PM
Posted: 2007-12-18 01:34
Reply with quoteEdit/Delete This PostPrint this post
WOW !!

I saw the video on Youtube and that's AMAZING. You say that right now you only have one direction. So, please, when you finish developing this software/application or whatever it is please post it here so we can get it too. It looks really cool.

Thanks in advance

[ This Message was edited by: Stud on 2007-12-18 00:35 ]
Duran
K850 Blue
Joined: Aug 25, 2006
Posts: > 500
From: Netherlands
PM
Posted: 2007-12-18 13:01
Reply with quoteEdit/Delete This PostPrint this post

On 2007-12-17 13:33:44, LCARS-Expert wrote:

On 2007-12-16 23:35:13, Duran wrote:

On 2007-12-14 20:39:40, LCARS-Expert wrote:
@Dewgel, are you referring to something like this:
http://www.youtube.com/watch?v=c8j4bXQSdHY

(My latest project, btw)

thats awesome:O should be implented in the default browser.
also you could make it change when tilting/rotating the phone for 1 sec:o


When phone is on its side the X axis is 990 (thats 9.81m/sē). When shaking X exceeds that value, thats why it reacts only on shake. If I set it to tilt it would change image when you are putting your mobile to your pocket.


Ye but who's watching pics on the k850 while its in your pocket=p?
of course it should only activate when watching pictures
Krzysiecw
K850 Green
Joined: May 23, 2006
Posts: 218
From: Poland/UK
PM
Posted: 2007-12-20 10:28
Reply with quoteEdit/Delete This PostPrint this post
Is it possible to give us a link to file swf where You use "shake control" like on your movie on YouTube ?
LCARS-Expert
K850 Green
Joined: Aug 24, 2007
Posts: 194
From: Croatia
PM, WWW
Posted: 2007-12-20 13:53
Reply with quoteEdit/Delete This PostPrint this post
I'm rather busy this week. I won't share source files in development. When I finish them I'll share them.
Swf file isn't finished yet, I don't have enough time to work on it. Unfortunately its impossible to make 2 directions because when you shake your phone acceleromoter gets pulled in 2 directions so it detects both.
notice
T68 gold
Joined: Dec 22, 2007
Posts: 2
PM, WWW
Posted: 2007-12-22 02:06
Reply with quoteEdit/Delete This PostPrint this post
Hi all!
Thanks a lot for these treads. I've done some simple bg for sonyericsson w910 or k850.
it's based on the automatic rotation example.

link to this file:
http://www.sulikereso.hu/watermeter.swf

Marcell
wopstickle
K850 Blue
Joined: Dec 19, 2007
Posts: 8
PM
Posted: 2007-12-29 00:04
Reply with quoteEdit/Delete This PostPrint this post
Forgive me if this isn't possible.. but I've never actually worked with actionscript..

Assuming that there's no available 'event' style system for a change in accelerometer data... only polling.. I figured it might be possible to get your shake left / shake right code working...

If you notice when you shake the fone to the right, the arrow will drag to the left then as you stop instantly shoot towards the right.. hopefully faster than 990/-990...

So have one 'control' thread... polling the hell out of those vars.. as fast as possible
Lets use.. say.. a 0.5 sec window ... in which the fone can be shook left->right..

If we're shaking the fone to the right, then the accelerometer will register
< -990, at this point set Shookleft = True ... allow it to stay 'true' for
no more than 0.5 secs.. before resetting it


Now while shookleft = true.. wait for the fone to come to a stop, whereby the accelerometer will fly to the right causing a >900 ...

At this point you'll know that the fone's been shook left -> right?


Lemme know if you have any joy with this idea.. not really paying much attention as I type it, but it seems to make sense..
wopstickle
K850 Blue
Joined: Dec 19, 2007
Posts: 8
PM
Posted: 2007-12-29 08:19
Reply with quoteEdit/Delete This PostPrint this post
Forgive the double postage.. but I figured it was worth splitting this..

First, a little treat..
http://www.wopstick.com/bouncystars_test.swf



It's a little rough around the edges, but I started learning actionscript a grand total of 4 hours ago.. so give me some credit here..
The stars will fall to the bottom of the screen and bounce around and off the edges etc... but shake the fone and they'll shoot off in whichever direction you shook..

While doing this I realised I accidentally solved the shake left / shake right problem..

Immagine an image... with x/y pos in one array, and x/y velocity in another.. (initial pos 100,100, vel 0,0 )

shake the fone to the right, triggering the left side of the accelerometer... which adds say 10 to the velocity, the image's position then has the velocity added, i.e in pseudocode.

if (accX < -990) { Xvelocity += 14; }
if (accX > 990) { Xvelocity -= 14; }

Xposition += Xvelocity;

Xvelocity *= 0.5;
if (Xvelocity < 0.1 && Xvelocity > -0.1) { Xvelocity = 0; }

Thus over the course of 12 frames/sec, the velocity should have hit 0 again, but your image will have shaken either right or left...

It's all a matter of balancing the numbers I guess, but after your image has traveled say 10/20 pixels, you can put it back to the center and reset it's position..


Now just remove the image and use the numbers themselves
nivo22
W910 Black
Joined: Dec 26, 2007
Posts: 72
PM
Posted: 2007-12-29 13:12
Reply with quoteEdit/Delete This PostPrint this post
now that was c00l... thx
can anyone post how do i add script in my flash ..?
(i am using flash cs3)
W910 Owner
M2 2 GB CARD
wopstickle
K850 Blue
Joined: Dec 19, 2007
Posts: 8
PM
Posted: 2007-12-29 15:15
Reply with quoteEdit/Delete This PostPrint this post
Generally, I guess you'll make a layer for your scripts first, to control the flow..
then another layer for the pictures themselves..

Select the frame you want in the scripts layer, then hit F9 and it should pop up the actions/scripts window.

Try LCARS' example, or
http://www.lukamaras.com/tuto[....]oving-rotating-movie-clip.html

This is the page I learned from
nivo22
W910 Black
Joined: Dec 26, 2007
Posts: 72
PM
Posted: 2007-12-29 15:46
Reply with quoteEdit/Delete This PostPrint this post
ok thanx:D
Cool site but not uses autorotate
_________________
W910 Owner
M2 2 GB CARD


[ This Message was edited by: nivo22 on 2007-12-29 14:48 ]
nivo22
W910 Black
Joined: Dec 26, 2007
Posts: 72
PM
Posted: 2007-12-29 16:24
Reply with quoteEdit/Delete This PostPrint this post
Lcars dont know ifa already mentioned but you made a mistake
on frame 3
Frame 3:
fscommand2("ExtendBacklightDuration");
fscommand2("FullScreen");

loadVariables("accelerometer://data", _root);
if ((accX < 400) && (accY > 800)) {
gotoAndPlay(3);
}

the mistake is gotoplay(3) instead of 3- 1right? gotoAndPlay(1);
W910 Owner
M2 2 GB CARD
LCARS-Expert
K850 Green
Joined: Aug 24, 2007
Posts: 194
From: Croatia
PM, WWW
Posted: 2007-12-29 17:40
Reply with quoteEdit/Delete This PostPrint this post
@nivo22, indeed. I made it while adding font styles to make the font look like the actual ActionScript. Thank you for your report!

Btw, I'm making my project page that will contain all K850i Accelerometer related Flash animations and other animations too along with their source files. Please be patient. When I finish the page I'll put the link to my sig.
Access the forum with a mobile phone via esato.mobi