0
我试图简单地在文本输入中显示accelerometerX的更新值,但我不知道如何模拟随Flash Builder附带的模拟器上的晃动或微调。以下是我正在使用的代码。在Adobe AIR for Mobile上模拟摇动手势/轻推手势?
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="MainView" creationComplete="onCreationComplete(event)">
<fx:Script>
<![CDATA[
import flash.sensors.Accelerometer;
import mx.events.FlexEvent;
protected function onCreationComplete(event:FlexEvent):void
{
var tShake:Accelerometer = new Accelerometer();
tShake.addEventListener(AccelerometerEvent.UPDATE, onAccelerometerUpdate);
}
protected function onAccelerometerUpdate(event:AccelerometerEvent):void {
sampleDisplay.text = event.accelerationX.toString();
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TextArea id="sampleDisplay" x="14" y="11"/>
</s:View>
这是我令人伤心的尝试使它工作的视频。当然它不。
http://www.youtube.com/watch?v=3uOOLnXd5qA
我正在使用Flash Builder 4.5。和Flex SDK 4.5.1。这对你在给定解决方案中的机会有何评论? – Propeller 2012-02-10 16:13:36
如果您有权访问Device Central(通过安装Flash CS5.5),则可能有可能。尝试从bin-debug文件夹中将swf加载到Device Central中,看看会发生什么。 – 2012-02-10 16:15:56
对不起,听起来很新鲜,但我怎样才能真正加载SWF文件?我要去哪? – Propeller 2012-02-10 16:23:33