Jul 26 2011

Adobe Flash – bug or feature – No multitouch gestures on android

Tag: Actionscript,Adobe,Adobe Flash - bug or feature,AllgemeinKonstantin Elstner @ 00:09

After I wrote in one of my last posts about the missing stageVideo on Android devices. Today I want to write about another missing feature.

A very nice „gimmick“ of android is the multitouch feature, swipe to left or right to go to another „site“, swipe down to scroll and so on. Adobe write in there actionscript 3.0 api documents, that this feature would be available to all multitouch devices with one exception, the mac os trackpad is not supported:

Note: The Multitouch feature is not supported for SWF files embedded in HTML running on Mac OS.

(source: http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/ui/Multitouch.html)

 

These days we were working on a flash magazine, which we also optimized  for use with tablets. Our client, for whom we has produced successfully an Android AIR magazine demo, asked us if we could integrate swipe gestures for left and right to switch the sites. I said to him, maybe it is possible, I would check it out and call him back. So I adapted our magazine to test the support of multitouch.

The first thing we struggled over is the fact, that Adobe may thought, when developing Flash CS5.5, that there would be no differences between the Flash Player 10.0 and Flash Player 10.1. Very interesting I think 😉

If you are going to try code like this in Flash Player 10.0:

1
2
3
import flash.ui.Multitouch;
[...]
Multitouch.inputMode = MultitouchInputMode.GESTURE
import flash.ui.Multitouch;
[...]
Multitouch.inputMode = MultitouchInputMode.GESTURE

Flash will publish your swf without any problems. But if a user with a flash player > 9.x and < 10.1, the flash player will hang without any visible error to the user.

With hang I mean, totally hang, after excuting this lines of code the complete SWF file will stop working. If you try this code with a 10.0 debugger player you get a General Error, and afterwards the code excution stops. So be sure, that this SWF will be only delivered for users with flash palyer 10.1 or greater.

This problem occurs for all multiouch related events and gestures!

A workarround is very simple implemented … simply check with an if-condition which version of the flash player the user has:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// this function will return true if the flash player version is 10.1 or greater
function get multitouchSupported():Boolean {
var vAr:Array = Capabilities.version.split(",");
 
if( Number( vAr[0].split(" ")[1] ) < 10 ) {
return false;
} else if( Number( vAr[0].split(" ")[1] ) > 10 ) {
return true;
}
 
if( Number( vAr[1] ) > 0 ) {
return true;
}
 
return false;
}
// this function will return true if the flash player version is 10.1 or greater
function get multitouchSupported():Boolean {
var vAr:Array = Capabilities.version.split(",");

if( Number( vAr[0].split(" ")[1] ) < 10 ) {
return false;
} else if( Number( vAr[0].split(" ")[1] ) > 10 ) {
return true;
}

if( Number( vAr[1] ) > 0 ) {
return true;
}

return false;
}

or check which CPU the device has:

1
2
3
if( Capabilities.cpuArchitecture == "arm" ) {
// code to excute
}
if( Capabilities.cpuArchitecture == "arm" ) {
// code to excute
}

 

The second thing I deiscovered for my self, is that it seems, like it is impossible to use multitouch events like the TransformGesture or the general MultiTouch-Actions if your app is running in a browser on an Android device. On my test devices, a Samsung Galxy I9000 (Android 2.3.3) and a Samsung Galaxy Tab 10.1v, there was no multitouch support in the browser. I tested the support with this simple lines of code:

1
2
3
4
5
if( Multitouch.supportedGestures == null || Multitouch.supportedGestures.length == 0 ) {
trace( "no multitouch support");
} else {
trace( "multitouch available");
}
if( Multitouch.supportedGestures == null || Multitouch.supportedGestures.length == 0 ) {
trace( "no multitouch support");
} else {
trace( "multitouch available");
}

The same code traces „multitouch available“ if the code is running as a AIR app on this devices.

I hope, that this will be changed in a feature release of the flash player.

 

In short:

– Take care, that code like the following is only excuted in a flash payler greater or equal to 10.1, otherwise the SWF will stop working

1
2
3
import flash.ui.Multitouch;
[...]
Multitouch.inputMode = MultitouchInputMode.GESTURE
import flash.ui.Multitouch;
[...]
Multitouch.inputMode = MultitouchInputMode.GESTURE

– On Android devices there is at this time no multitouch support available in the browser


Jul 07 2011

Renewing an Adobe AIR Developer Certificate

Tag: Actionscript,Adobe,FlexKonstantin Elstner @ 18:10

If you are glad to support an Adober AIR application with a lifespan of a few years there will came the time point where you have to update developer certificate, because their lifespan is over. It is very important, that you get all necessary information about this step. Also it is important that you mark this date in your calendar. If you don’t want to become in trouble at the moment of update.

If you do not plan this point exactly maybe all your clients or the customers of your client has to manually install this new update, because the auto update will not work.

Maybe Adobe did not believe, that an AIR application would be used over years, otherwise the update process would be even better.

In the first months or years of Adobe AIR it was nearly impossible to change to a new certificate, because if you switched your certificate AIR would not trust your application. So the update process fails and there would come an error code like „Error# 16816“ during the installation.

The background is that with every renew of your certificate your publisher ID (after AIR 1.5 deprecated) is changing, but the shown name of the developer is the same.

Since AIR 1.5 Adobe provides a „solution“, with the „adt“ command line tool you can sign your application with the old certificate after signing it during packaging with the new certificate. Adobe calls this „migration„. It is important to know, that this migration is only possible during the first 6 months, after the lifespan of the old certificate is over. If you have to provide an update after this 6 months, you can not do a „migration signing“ of your app and so Adobe AIR will not allow the user an update of your app. The only way would be an uninstall and afterwards a new install of your app.

Example of the migration commands on mac os:

/Applications/Adobe\ Flash\ Builder\ 4.5/sdks/4.5.1/bin/adt -migrate -storetype pkcs12 -keystore /Users/USER_NAME/PATH_TO_OLD_CERTIFICATE/xxx.p12 /YOUR_APP_FILE.air /YOUR_MIGRATED_APP_FILE_NAME.air

 

In short:

  • mark the date when your certificate expires in your calendar
  • get your certificate as early as possible
  • provide an update immediately after you got the new certificate

More informations about available adt commands:
http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d128fc240122-7ffd.html
http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7f72.html
http://livedocs.adobe.com/flex/3/html/index.html?content=CommandLineTools_5.html


Jul 06 2011

Adobe – bug or feature: No stageVideo on Android 3.0.1 & 3.1?

Tag: Actionscript,Adobe,Adobe Flash - bug or featureKonstantin Elstner @ 21:20

Today I experimented with the new stageVideo, which is available since Flash Player 10.2. It is a very nice technique, where the video is rendered through a pipe by the gpu. So the cpu consumption is quite 10 to 20 percent playing a full HD video instead of 50 percent or more. Even it reduces the energy consumption.
On a mobile chip-set like the Tegra from Nvidia the video playback should be very smooth in theory.
Adobe has announced this technique at the Adobe Max last year. In January Adobe said it would be available with Android 3.0.
So I thought it would be the right time to check it out now on my Galaxy Tab 10.1v.

But surprise:
No stageVideo is available in Flash Player 10.3 on Android 3.0.1.
No stageVideo is available in Adobe AIR 2.6 on Android 3.0.1.
And last but not least no support of stageVideo in Adobe AIR 2.7 on IOS.

What happened?

Adobe has quite updated the release informations for stageVideo.

At this developer FAQ (modified 28 March 2011):
http://www.adobe.com/devnet/devices/articles/optimization_features_fp101.html

And at this site too (modified 4 April 2011):
http://www.adobe.com/devnet/devices/articles/mobile_video_encoding.html

Adobe informs, that stageVideo would be available with Android 3.0.1 …

But at this shortly updated main site (tab mobile features):
http://www.adobe.com/products/flashplayer/features/
Adobe told us, that the stageVideo would be not available until Android 3.1.

Hardware-accelerated video presentation (requires Android 3.1)

Enjoy beautiful, smooth playback of high-definition H.264 video content powered by Adobe® Flash® technology across the web in both embedded and full-screen mode using Android™ tablets with Android 3.1, like the Motorola XOOM. Adobe Flash Player leverages the Stage Video hardware-accelerated video pipeline to provide higher frame rates and less power consumption, building on the efficiency of hardware-accelerated H.264 decoding.

Note: Hardware-accelerated video presentation support will only be available with Android 3.1 and is not supported on earlier versions of Android.

I like the note *irony*.

What a pity and what a great way of communication.

Thanks Adobe.

I hope stageVideo will be truly supported on Android 3.1. At this time I can not test it, because I have no Android 3.1. Playing a h264 video with cpu based rendering is quite a pain.

And by the way: should not Flash Player 11 released in mid 2011?

 

[Update]

Today I updated my Galaxy Tab 10.1v to Android 3.1 with Flash Player 10.3.185.25 … also no stageVideo support. Can somebody confirm this with other devices?

Testlink is:
http://d-ssl.de/svTest/

Player is based on OSMF 1.6.

Code to check stageVideo support:

try {
console.appendText( „availabe stageVideo pipes: „+stage[’stageVideos‘].length+“\n“ );
} catch(e:Error) {
return;
}
for( var i:int; i < stage[’stageVideos‘].length; i++ ) {
if( stage[’stageVideos‘][i].videoWidth > 0 ) {
console.appendText( „pipe „+i+“: video size: „+stage[’stageVideos‘][i].videoWidth+“x“+stage[’stageVideos‘][i].videoHeight+“\n“ );
}
}


Jul 06 2011

Beware of Flash Builder 4.5 and Flex SDK 4.5

Tag: Actionscript,Adobe,FlexKonstantin Elstner @ 08:56

A few weeks ago I did the mistake (?) and upgraded to Flash Builder 4.5. At first to say, the product is nice, but the Eclipse bugs are niggling. But a thing I can do not understand is:

Why Flash Builder 4.5 only supports the Flex SDK 4.5?

For myself as a developer who has some long time projects, this is a frustrating point. If you are working on a big project you can not simply switch to a new SDK, ony why Adobe think it is great. You have to make some pretests to be sure that is working very fine.

Believing in Adobe, which is sometimes the biggest mistake what I can do, I simply upgraded a bigger business project to the 4.5 Flex SDK.

First I was struggling about some changes in the AIR descriptor file. Updating the name space is a simple part, but finding out why it has problems with the version-tag takes some time. Afterwards I was smarter and did know, that with AIR 2.6 the version-tag was changed to „versionNumber“. Really ease to change, but beware of the things behind:

The changing from version to versionNumber is not a simple wording change, it is the evolution to the knew AIR 2.6 update process. A thing, which I did not found at the release notes.

For this new update process you have to update your complete update-implementation, and this is a 2-steps-process, because at first you have to provide an small update, which make it possible for your application to use this new update process. After this step it is possible for you to provide application updates, which are based on Flex 4.5. If a user is not using the app for a long time, they will get two updates short behind.

I think for myself Adobe should make a better communication of ugly problems like this. In the tech-notes, the Adobe technicals for there self wrote, that this process is not simple.

 

http://kb2.adobe.com/cps/873/cpsid_87300.html