Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tourdeflexmobile</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
flex-examples
=============

Mirror of Apache Flex Examples

This is a modified version of the new TourDeFlexMobile application that was uploaded to the ApacheFlexExample.
36 changes: 20 additions & 16 deletions tourdeflexmobile/src/AIRViews/AccelerometerView.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ limitations under the License.

-->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Accelerometer" viewActivate="init()" viewDeactivate="deactivate(event)">
xmlns:s="library://ns.adobe.com/flex/spark"
title="Accelerometer"
viewActivate="init()"
viewDeactivate="deactivate(event)">

<fx:Script>
<![CDATA[
Expand All @@ -28,7 +31,6 @@ limitations under the License.
import flash.sensors.Accelerometer;

import spark.events.ViewNavigatorEvent;
import spark.skins.mobile.TextAreaSkin;

private var ball:Sprite;
private var accelerometer:Accelerometer;
Expand Down Expand Up @@ -77,13 +79,13 @@ limitations under the License.
ball.x = RADIUS;
xSpeed = 0;
}

else if (newX > stage.stageWidth - RADIUS)
else if (newX > this.width - RADIUS)
{
ball.x = stage.stageWidth - RADIUS;
ball.x = this.width - RADIUS;
xSpeed = 0;
}

else
{
ball.x += xSpeed;
Expand All @@ -94,13 +96,13 @@ limitations under the License.
ball.y = RADIUS;
ySpeed = 0;
}

else if (newY > this.height - RADIUS)
{
ball.y = this.height - RADIUS;
ySpeed = 0;
}

else
{
ball.y += ySpeed;
Expand All @@ -120,9 +122,12 @@ limitations under the License.

protected function buttonHandler(event:MouseEvent):void
{
if(currentState == "DemoState"){
if(currentState == "DemoState")
{
currentState = "InfoState";
}else if(currentState == "InfoState"){
}
else if(currentState == "InfoState")
{
currentState = "DemoState";
}
}
Expand All @@ -134,15 +139,14 @@ limitations under the License.
<s:State name="DemoState"/>
<s:State name="InfoState"/>
</s:states>

<fx:Declarations>
<s:MultiDPIBitmapSource id="aboutIcon" source160dpi="@Embed('assets/icons/160/about.png')" source240dpi="@Embed('assets/icons/240/about.png')" source320dpi="@Embed('assets/icons/320/about.png')"/>
<s:MultiDPIBitmapSource id="demoIcon" source160dpi="@Embed('assets/icons/160/dock.png')" source240dpi="@Embed('assets/icons/240/dock.png')" source320dpi="@Embed('assets/icons/320/dock.png')"/>
<s:MultiDPIBitmapSource id="aboutIcon" source160dpi="@Embed('assets/icons/160/about.png')" source240dpi="@Embed('assets/icons/240/about.png')"
source320dpi="@Embed('assets/icons/320/about.png')" source480dpi="assets/icons/480/about.png"/>
<s:MultiDPIBitmapSource id="demoIcon" source160dpi="@Embed('assets/icons/160/dock.png')" source240dpi="@Embed('assets/icons/240/dock.png')"
source320dpi="@Embed('assets/icons/320/dock.png')" source480dpi="assets/icons/480/dock.png"/>
</fx:Declarations>

<s:SpriteVisualElement id="container" includeIn="DemoState"/>

<s:TextArea includeIn="InfoState" skinClass="spark.skins.mobile.TextAreaSkin" left="10" right="10" top="10" bottom="10" editable="false" text="The Accelerometer class dispatches events based on activity detected by the device's motion sensor. This data represents the device's location or movement along a 3-dimensional axis. When the device moves, the sensor detects this movement and returns acceleration data. The Accelerometer class provides methods to query whether or not accelerometer is supported, and also to set the rate at which acceleration events are dispatched.
<s:TextArea includeIn="InfoState" selectable="false" left="10" right="10" top="10" bottom="10" editable="false" text="The Accelerometer class dispatches events based on activity detected by the device's motion sensor. This data represents the device's location or movement along a 3-dimensional axis. When the device moves, the sensor detects this movement and returns acceleration data. The Accelerometer class provides methods to query whether or not accelerometer is supported, and also to set the rate at which acceleration events are dispatched.
&#xd; &#xd;Note: Use the Accelerometer.isSupported property to test the runtime environment for the ability to use this feature. While the Accelerometer class and its members are accessible to the Runtime Versions listed for each API entry, the current environment for the runtime determines the availability of this feature. For example, you can compile code using the Accelerometer class properties for Flash Player 10.1, but you need to use the Accelerometer.isSupported property to test for the availability of the Accelerometer feature in the current deployment environment for the Flash Player runtime. If Accelerometer.isSupported is true at runtime, then Accelerometer support currently exists."/>

<s:actionContent>
Expand Down
106 changes: 106 additions & 0 deletions tourdeflexmobile/src/AIRViews/CameraView.mxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
title="Camera"
viewDeactivate="deactivate(event)"
viewActivate="init(event)">

<fx:Script>
<![CDATA[

import mx.core.UIComponent;

import spark.events.ViewNavigatorEvent;

private var camera:Camera;

private function init(event:ViewNavigatorEvent):void
{
if(Camera.isSupported)
{
camera = Camera.getCamera();
camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
camera.setMode(640, 480, 25);
camera.setQuality(0, 100);
var video:Video = new Video(width,height)
video.attachCamera(camera);
var videoHolder:UIComponent = new UIComponent();
videoHolder.x = 0;
videoHolder.y = 0;
videoHolder.percentWidth = 100;
videoHolder.percentHeight = 100;
videoHolder.addChild(video);
videoDisplay.addElement(videoHolder);
}
}

private function activityHandler(event:ActivityEvent):void
{
trace("activityHandler: " + event);
}

protected function buttonHandler(event:MouseEvent):void
{
if(currentState == "DemoState")
{
currentState = "InfoState";
}
else if(currentState == "InfoState")
{
currentState = "DemoState";
}
}

private function deactivate(event:ViewNavigatorEvent):void
{
camera.removeEventListener(ActivityEvent.ACTIVITY, activityHandler);
}


]]>
</fx:Script>

<s:states>
<s:State name="DemoState"/>
<s:State name="InfoState"/>
</s:states>

<fx:Declarations>
<s:MultiDPIBitmapSource id="aboutIcon" source160dpi="@Embed('assets/icons/160/about.png')" source240dpi="@Embed('assets/icons/240/about.png')" source320dpi="@Embed('assets/icons/320/about.png')"/>
<s:MultiDPIBitmapSource id="demoIcon" source160dpi="@Embed('assets/icons/160/dock.png')" source240dpi="@Embed('assets/icons/240/dock.png')" source320dpi="@Embed('assets/icons/320/dock.png')"/>
</fx:Declarations>
<s:Group width="100%" height="100%" id="videoDisplay"/>

<s:TextArea includeIn="InfoState" selectable="false" left="10" right="10" top="10" bottom="10" editable="false"
text="Use the Camera class to capture video from the client system or device camera. Use the Video class to monitor the video locally. Use the NetConnection and NetStream classes to transmit the video to Flash Media Server. Flash Media Server can send the video stream to other servers and broadcast it to other clients running Flash Player or AIR.
&#xd; &#xd;A Camera instance captures video in landscape aspect ratio. On devices that can change the screen orientation, such as mobile phones, a Video object attached to the camera will only show upright video in a landscape-aspect orientation. Thus, mobile apps should use a landscape orientation when displaying video and should not auto-rotate.

&#xd; &#xd;On iOS, the video from the front camera is mirrored. On Android, it is not.

&#xd; &#xd;On mobile devices with an autofocus camera, autofocus is enabled automatically. If the camera does not support continuous autofocus, and many mobile device cameras do not, then the camera is focused when the Camera object is attached to a video stream and whenever the setMode() method is called. On desktop computers, autofocus behavior is dependent on the camera driver and settings.

&#xd; &#xd;In an AIR application on Android and iOS, the camera does not capture video while an AIR app is not the active, foreground application. In addition, streaming connections can be lost when the application is in the background. On iOS, the camera video cannot be displayed when an application uses the GPU rendering mode. The camera video can still be streamed to a server."/>

<s:actionContent>
<s:Button click="buttonHandler(event)" icon.DemoState="{aboutIcon}" icon.InfoState="{demoIcon}"/>
</s:actionContent>
</s:View>
118 changes: 118 additions & 0 deletions tourdeflexmobile/src/AIRViews/GeolocationView.mxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
title="Geolocation"
viewDeactivate="endGeolocation(event)"
viewActivate="init(event)">

<fx:Script>
<![CDATA[
import flash.sensors.Geolocation;
import spark.events.ViewNavigatorEvent;

private var geo:Geolocation;

protected function init(event:ViewNavigatorEvent):void
{
if (Geolocation.isSupported)
{
geoToggle.enabled = true;
geo = new Geolocation();
geo.setRequestedUpdateInterval(8000);
}
else
{
label.text = "Geolocation not supported";
}
}

protected function geoLocate():void
{
if(geoToggle.selected == true)
{
geo.addEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);
}
if(geoToggle.selected == false)
{
geo.removeEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);
}
}


public function geoUpdateHandler(event:GeolocationEvent):void
{
latitude.text = "latitude : " + event.latitude.toString();
longitude.text = "longitude : " + event.longitude.toString();
heading.text = "heading : " + event.heading.toString();
speed.text = "speed : " + event.speed.toString();
}

protected function buttonHandler(event:MouseEvent):void
{
if(currentState == "DemoState")
{
currentState = "InfoState";
}
else if(currentState == "InfoState")
{
currentState = "DemoState";
}
}

protected function endGeolocation(event:ViewNavigatorEvent):void
{
if(geoToggle.selected == true)
{
geo.removeEventListener(GeolocationEvent.UPDATE, geoUpdateHandler);
}
}

]]>
</fx:Script>
<s:states>
<s:State name="DemoState"/>
<s:State name="InfoState"/>
</s:states>
<fx:Declarations>
<s:MultiDPIBitmapSource source160dpi="@Embed('assets/icons/160/about.png')" id="aboutIcon"
source240dpi="@Embed('assets/icons/240/about.png')"
source320dpi="@Embed('assets/icons/320/about.png')"
source480dpi="@Embed('assets/icons/480/about.png')"/>
<s:MultiDPIBitmapSource source160dpi="@Embed('assets/icons/160/dock.png')" id="demoIcon"
source240dpi="@Embed('assets/icons/240/dock.png')"
source320dpi="@Embed('assets/icons/320/dock.png')"
source480dpi="@Embed('assets/icons/480/dock.png')"/>
</fx:Declarations>
<s:ToggleSwitch includeIn="DemoState" horizontalCenter="0" y="20" id="geoToggle" enabled="false" change="geoLocate()"/>
<s:VGroup width="100%" height="100%" left="10" right="10" top="55" bottom="10" includeIn="DemoState">
<s:Label id="label" left="10"/>
<s:Label id="latitude" left="10"/>
<s:Label id="longitude" left="10"/>
<s:Label id="heading" left="10"/>
<s:Label id="speed" left="10"/>
</s:VGroup>
<s:TextArea includeIn="InfoState" selectable="false" left="10" right="10" top="10" bottom="10" editable="false" text="The Geolocation class dispatches events in response to the device's location sensor.
&#xd; &#xd;If a device supports geolocation, you can use this class to obtain the current geographical location of the device. The geographical location is displayed on the device in the form of latitudinal and longitudinal coordinates (in WGS-84 standard format). When the location of the device changes, you can receive updates about the changes. If the device supports this feature, you will be able to obtain information about the altitude, accuracy, heading, speed, and timestamp of the latest change in the location.
&#xd; &#xd;AIR profile support: This feature is supported only on mobile devices. It is not supported on desktop or AIR for TV devices."/>
<s:actionContent>
<s:Button click="buttonHandler(event)" icon.DemoState="{aboutIcon}" icon.InfoState="{demoIcon}"/>
</s:actionContent>
</s:View>
Loading