setting up FDT for Flex 4 SDK & Flash Player 10.1

Aiden Tailor wrote a great blog post on how to set up the Flex 4 SDK with FDT. You can check it out here

Read what he says, and follow the instructions, I did it and it works perfect, any problems just ask!

The point to this post is to take this one step more to configure the Flex 4 SDK to work with the Flash Player 10.1

Download Adobe Flash Player 10.1 beta 3 at Adobe Labs here

In the flex 4 SDK that you just set up from Aiden’s blog:

{SDKFolder}/frameworks/libs/player/10

replace the playerglobal.swc with the flash 10.1 that you just downloaded

open the flex-config.xml replace line 16 to read

 <target-player>10.1.0</target-player>

restart FDT

Now create a new project, “Flex 4 Test”
create a Main class

package {
	import flash.display.Sprite;
	import flash.events.AccelerometerEvent;
	import flash.sensors.Accelerometer;
	import flash.text.TextField;

	public class Main extends Sprite {
		private var myText:TextField = new TextField();
		private var acc:Accelerometer = new Accelerometer();
		private var isSupported:Boolean = Accelerometer.isSupported;

		public function Main() {
			myText.width = 200;
			addChild(myText);
			checksupport();
		}

		private function checksupport():void {
	    	if (isSupported) {
		    	myText.text = "Accelerometer feature supported";
			    acc.addEventListener(AccelerometerEvent.UPDATE, getInfo);
			} else {
			    myText.text = "Accelerometer feature not supported";

			}
		}

		private function getInfo(evt:AccelerometerEvent):void {
	    	myText.text = String("at: " + evt.timestamp + "n" + "acceleration X: " + evt.accelerationX + "n" + "acceleration Y: " +   evt.accelerationY + "n" + "acceleration Z: " + evt.accelerationZ);

		}
	}

}

Run file. I do get the following warning

This compilation unit did not have a factoryClass specified in Frame metadata to load the configured runtime shared libraries. To compile without runtime shared libraries either set the -static-link-runtime-shared-libraries option to true or remove the -runtime-shared-libraries option.

UPDATED
To fix this warning is an easy fix as it turns out, I had to search the flex-config.xml file to find it, but if you open the flex-config.xml file on line 385, you will see

<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>

make sure this property is set to true! it is set to false by default. This will get rid of the compiler warning when you run your projects using the Flex 4 SDK.

 

For some reason the text below in the swf file is very small, this is not the case! If you could like to see a version with larger text, lease go here.
The final swf
[kml_flashembed publishmethod=”static” fversion=”10.0.0″ movie=”http://blog.hawaiiflash.org/wp-content/uploads/2010/03/Main.swf” targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]

4 thoughts on “setting up FDT for Flex 4 SDK & Flash Player 10.1”

  1. Pingback: getinfo

Leave a Reply