RSS

Category Archives: Mobile Technology

Flash Player 11 and AIR 3 Now Available

Flash Player 11 and AIR 3 are now available for download.

For additional information including detailed information on new features, please see this release notes.


http://blogs.adobe.com/flashruntimereleases/2011/10/04/flash-player-11-and-air-3-now-available/

 

How to use Flash Player 11 & AIR 3 with Flash Professional CS5.5

Issue : VerifyError: Error #1014: La classe flash.display3D::Context3D could not be found.

Stage3D will work with web browser. For remove this above issue, set  wmode=”DIRECT” in HTML 

—————————————————————-

Download Adobe AIR 3 SDK from here 

Download the PlayerGlobal.swc to target the 11.0 APIs(for FlashPlayer 11) from here

http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/playerglobal11_0.swc


Targeting Adobe Flash Player 11 Release Candidate for Desktops.

1.- Download the Flash Player 11 Release Candidate.
First things first go to the Adobe Labs site and download the Adobe Flash Player 11 Release Candidate for Desktops. Download the proper player for Your system ( Is important that You download and install the runtime on Your browser otherwise you won’t be able to test your SWFs as there is no Standalone RC1 version). You need to download the Flash Player 11 Release Candidate Global SWC “playerglobal.swc” as well.

2.- Once You installed Flash Player in the browser and renamed the swc file from flashplayer11_rc1_playerglobal_090611 to “playerglobal.swc” go to “/Applications/Adobe Flash CS5.5/Common/Configuration/ActionScript 3.0″ and create a new folder i named mine FP11_RC1 and copy your playerglobal.swc file inside the folder you just created.

3.- Now You need a new player profile so You can choose the Flash Player 11 RC1 from the available player versions when working with Flash, go to “ /Applications/Adobe Flash CS5.5/Common/Configuration/Players/”  duplicate the FlashPlayer10_2 2.xml and give it a new name to the file You just copy I named mine FlashPlayer11_RC1.xml.

4.- Open that file in a text editor and change the id and version in the player tag for id give it the name You wish to be displayed in the Player panel inside of Flash I named mine “FlashPlayer11_RC1″ and change the version to “13″.

6.- Save the file open Flash CS5.5 and You’re good to go.

Targeting Adobe AIR 3 Release Candidate.

1.- Download the AIR 3.0 Release Candidate.
First thing You need is the Adobe AIR 3 SDK Release Candidate.

2.- Unzip Your AIR SDK if You’re on Mac the file will be named ” air3_rc1_sdk_mac_090611.tbz2″

3.- Close Flash Professional CS5.5 and browse o the AIR 2.6 folder, on Mac it will be in the following location
“/Applications/Adobe Flash CS5.5”

4.- Change the AIR2.6 folder name to something like AIR2.6_old.

5.- Rename the folder You previously unzipped to AIR2.6 and place it on the Flash Professional CS5.5 folder “/Applications/Adobe Flash CS5.5”.

6.- Browse to the AIR2.6/frameworks/libs/air/ folder and copy the airglobal.swc.

7.- Paste the SWC file in the folder “/Applications/Adobe Flash CS5.5/Common/Configuration/ActionScript 3.0/AIR2.6” it wil replace your copy of  the airglobal.swf file.

8.- Browse to the “/Applications/Adobe Flash CS5.5/Common/Configuration/Players” folder and open the following files with a text editor:  AdobeAIR2_6.xml, AiriPhone.xml, or Android.xml.

9.- Change the version attribute in the player tag from 11 to 13 and save the files:

On the Android xml file: <player id="android_0" version="13" asversion="3" minasversion="3"></player>

On the AdobeAIR2_6 xml file: <player id="AdobeAIR2_6" version="13" asversion="3" minasversion="3"></player>

10.- Browse to the “/Applications/Adobe Flash CS5.5/AIR2.6/samples/” and open the descriptor-sample.xml file.

11.- Change the “http://ns.adobe.com/air/application/2.6&#8221; namespace URL to “http://ns.adobe.com/air/application/3.0&#8221;.

<application xmlns="http://ns.adobe.com/air/application/3.0" minimumpatchlevel="0"></application>

12.- Save the file and open Flash.

—————–

Testing time: Click Here for Read More

 

audio and video streaming with StageWebView and html5

The StageWebView object  is a powerful way to integrate the elements that AIR is lacking today. Do you need a list with perfect scrolling ? AAC audio streaming ? H.264 streaming ? Well you can use a StageWebView to load “HTML5″ code inside the AIR app and integrate this kind of content. Let’s do a simple example:

var webView = new StageWebView();
webView.stage = this.stage;
webView.viewPort = new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight);
var path:String = new File(new File("app:/html/service.htm").nativePath).url;
webView.loadURL(Path);

This code will open a fullscreen instance of the native browser (without UI) and load a locally stored .html file (notice that it is necessary in iOS to use some hack like that at line 4 to obtain a valid url to access local html). Now you can easily understand that the best is to mix AIR UI and this windowed browser to exploit HTML5 capabilities especially for media streaming. A simple <video> tag inside the html code can do the job and offer perfect H.264 progressive and streaming playback to your AIR apps both in window and at fullscreen.

Link

 

ActionScript APIs specific to mobile AIR applications

The following APIs are available only in AIR applications on mobile devices. They are not currently functional in Flash Player or desktop versions of AIR.

Screen orientation API

The screen orientation API lets you work with the orientation of the stage and the iPhone:

  • Stage.autoOrients— Whether the application is set to have the stage automatically reorient when the device is rotated. This property is set to true when the Auto Orientation option is selected in the Flash Professional CS5 iPhone Settings dialog box. (You can also set the autoOrients element to true in the application descriptor file.) See iPhone application settings. You can cancel the automatic reorientation by adding anorientationChanging event listener for the Stage object. Calling the preventDefault() method of this event object cancels the automatic reorientation.

    When using auto-orientation, for best results set the align property of the Stage to the following:

    stage.align = StageAlign.TOP_LEFT; 
    stage.scaleMode = StageScaleMode.NO_SCALE;
  • Stage.deviceOrientation—The physical orientation of the device. The StageOrientation class defines values for this property.
  • Stage.orientation—The current orientation of the stage. The StageOrientation class defines values for this property.
  • Stage.supportsOrientationChange—Set to true on the iPhone, and false in an AIR application.
  • Stage.setOrientation()—Sets the orientation of the stage. This method has one parameter, which is a string defining the new stage orientation. The constants in the StageOrientation class define possible values for the parameter.
  • StageOrientation—Defines stage orientation values. For example, StageOrientation.ROTATED_RIGHT indicates a stage that is rotated right relative to the default orientation of the device.
  • StageOrientationEvent—Defines events that the Stage dispatches when the orientation of the screen changes. This event occurs when the user rotates the iPhone. There are two types of events. The Stage dispatches theorientationChanging event as the device is being rotated. To prevent the stage from reorienting, call the preventDefault() method of the orientationChanging event object. The Stage dispatches theorientationChange event once the stage reorientation is complete.

Currently, the screen orientation API is only useful in AIR applications on mobile devices. If a mobile AIR application and a desktop AIR application share source code, use the Stage.supportsOrientationChange property to check if the API is supported.

The following example shows how to respond to the user rotating the device:

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, 
            onOrientationChange); 

function onOrientationChange(event:StageOrientationEvent):void 
{ 
    switch (event.afterOrientation) { 
        case StageOrientation.DEFAULT: 
            // re-orient display objects based on 
            // the default (right-side up) orientation. 
            break; 
        case StageOrientation.ROTATED_RIGHT: 
            // Re-orient display objects based on 
            // right-hand orientation. 
            break; 
        case StageOrientation.ROTATED_LEFT: 
            // Re-orient display objects based on 
            // left-hand orientation. 
            break; 
        case StageOrientation.UPSIDE_DOWN: 
            // Re-orient display objects based on 
            // upside-down orientation. 
            break; 
}

In this example, in the case of different stage orientations, there are comments instead of functional code.

You can change the orientation of the stage by calling the setOrientation() method of the Stage object. Setting the orientation is an asynchronous operation. You can check when the orientation is complete by listening for theorientationChange event. The following code shows how to set the stage to the right-hand orientation:

stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, 
            onOrientationChange); 
stage.setOrientation(StageOrientation.ROTATED_RIGHT); 

function onOrientationChange(event:StageOrientationEvent):void 
{ 
    // Code to handle the new Stage orientation 
}

As the Stage rotates it resizes, and the Stage object dispatches a resize event. You can resize and reposition display objects on the Stage in response to the resize event.

NativeApplication.systemIdleMode and SystemIdleMode

The NativeApplication.systemIdleMode property lets you prevent the iPhone from going into idle mode. By default, an iPhone goes into idle mode if there is no touch screen interaction for some period. Idle mode can cause the screen to dim. It can also cause the iPhone to go into lock mode. This property can be set to one of two values:

  • SystemIdleMode.NORMAL—The iPhone follows the normal idle mode behavior.
  • SystemIdleMode.KEEP_AWAKE—The application attempts to prevent the iPhone from going into idle mode.

This functionality is only supported on mobile devices. It is not supported in AIR applications running on desktop operating systems. In an application running on the desktop, setting the NativeApplication.systemIdleModeproperty has no effect.

The following code shows how to disable the iPhone idle mode:

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

CameraRoll

The CameraRoll class lets you add an image to the iPhone camera roll. The addBitmapData() method adds an image to the iPhone camera roll. The method has one parameter, bitmapData. This parameter is the BitmapData object containing the image to add to the camera roll.

CameraRoll functionality is only supported on mobile devices. It is not supported in AIR applications running on desktop operating systems. To check at runtime whether your application supports the CamerRoll functionality, check the static CameraRoll.supportsAddBitmapData property.

After you call the addBitmapData() method, the CameraRoll object dispatches one of two events:

  • complete—The operation completed successfully.
  • error—There was an error. For example, perhaps there is not enough free space on the iPhone to store the image.

The following code adds an image of the stage (a screen capture) to the camera roll:

if (CameraRoll.supportsAddBitmapData) 
{ 
    var cameraRoll:CameraRoll = new CameraRoll(); 
    cameraRoll.addEventListener(ErrorEvent.ERROR, onCrError); 
    cameraRoll.addEventListener(Event.COMPLETE, onCrComplete); 
    var bitmapData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight); 
    bitmapData.draw(stage); 
    cameraRoll.addBitmapData(bitmapData); 
} 
else 
{ 
    trace("not supported."); 
} 

function onCrError(event:ErrorEvent):void 
{ 
    // Notify user. 
} 

function onCrComplete(event:Event):void 
{ 
    // Notify user. 
}

DisplayObject.cacheAsBitmapMatrix

The cacheAsBitmapMatrix property is a Matrix object that defines how a display object is rendered when cacheAsBitmap is set to true. The application uses this matrix as a transformation matrix when rendering the bitmap version of the display object.

With cacheAsBitmapMatrix set, the application retains a cached bitmap image rendered using that matrix, instead of the display matrix. (The display matrix is the value of the transform.concatenatedMatrix of the display object.) If this matrix does not match the display matrix, the bitmap is scaled and rotated as necessary.

A display object with cacheAsBitmapMatrix set is only rerendered when the value of cacheAsBitmapMatrix changes. The bitmap is scaled or rotated as appropriate to conform to the display matrix.

Both CPU- and GPU-based rendering benefit from the use of the cacheAsBitmapMatrix property, although GPU rendering typically benefits more.

Note: To use the hardware acceleration, set the Rendering to GPU in the General tab of the iPhone Settings dialog box in Flash Professional CS5. (Or set the renderMode property to gpu in the application descriptor file.)

For example, the following code uses an untransformed bitmap representation of the display object:

matrix:Matrix = new Matrix(); // creates an identity matrix 
mySprite.cacheAsBitmapMatrix = matrix; 
mySprite.cacheAsBitmap = true;

The following code uses a bitmap representation that matches the current rendering:

mySprite.cacheAsBitmapMatrix = mySprite.transform.concatenatedMatrix; 
mySprite.cacheAsBitmap = true;

Usually, the identity matrix (new Matrix()) or transform.concatenatedMatrix suffices. However, you can use another matrix, such as a scaled-down matrix, to upload a different bitmap to the GPU. For example, the following example applies a cacheAsBitmapMatrix matrix that is scaled by 0.5 on the x- and y-axes. The bitmap object that the GPU uses is smaller, however the GPU adjusts its size to match the transform.matrix property of the display object.:

matrix:Matrix = new Matrix(); // creates an identity matrix 
matrix.scale(0.5, 0.5); // scales the matrix 
mySprite.cacheAsBitmapMatrix = matrix; 
mySprite.cacheAsBitmap = true;

Generally, choose a matrix that transforms the display object to the size that it will appear in the application. For example, if your application displays the bitmap version of the sprite scaled down by a half, use a matrix that scales down by a half. If your application will display the sprite larger than its current dimensions, use a matrix that scales up by that factor.

There is a practical limit to the size of display objects for which the cacheAsBitmapMatrix property is set. The limit is 1020 by 1020 pixels. There is a practical limit for the total number of pixels for all display objects for which the cacheAsBitmapMatrix property is set. That limit is about four million pixels.

There are many considerations when using cacheAsBitmapMatrix and hardware acceleration. It is important to know which display objects should have that property set, and which ones should not. For important information on using this property, see Hardware acceleration.

You can use the GPU rendering diagnostics feature to diagnose GPU usage in debug builds of your application. For more information, see Debugging an iPhone application.

Networking notes

Using the following URL schemes with the nativigateToURL() function causes a document to open in an external application:

URL scheme Result of call to nativeToURL() Example
mailto: Opens a new message in the mail application.
str = "mailto:test@example.com"; 
var urlReq:URLReq = new URLRequest(str); 
navigateToURL(urlReq);
sms: Opens a message in the text message application.
str = "sms:1-415-555-1212"; 
var urlReq:URLReq = new URLRequest(str); 
navigateToURL(urlReq);
tel: Dials a phone number on the phone (with user approval).
str = "tel:1-415-555-1212"; 
var urlReq:URLReq = new URLRequest(str); 
navigateToURL(urlReq);

An iPhone application may rely on installed self-signed root certificates for server authentication during a secure transaction, such as an https request. A server should send not just the leaf certificate but also all intermediate certificates chaining to the root certificate.

Link

 
Leave a comment

Posted by on September 11, 2011 in Adobe Air, Android, flash, iPhone, Mobile Technology

 

Geolocation AS3 API for iPhone

I thought I’d share a spot of code with you, a new API in the flash.sensors package called Geolocation. The package itself is enabled for iPhone applications (created with Flash Pro Cs5), FL4 and AIR in the future enabling you to create context-aware applications with ease.

The coolest thing is that you can test your applications that feature Geolocation in Device Central Cs5, very cool.
//——————————————–
import flash.sensors.Geolocation;
import flash.events.GeolocationEvent;

var locale:Geolocation = new Geolocation();
locale.setRequestedUpdateInterval(5000);
locale.addEventListener(GeolocationEvent.UPDATE, onlocationHandler);

function onlocationHandler(e:GeolocationEvent):void{

lastLat = e.latitude;
lastLon = e.longitude;
gpsIcon_mc.visible = !gpsIcon_mc.visible;

}

//—————————

Original Link

 
 

Create views with flash builder 4.5

Tutorial

In this tutorial, you create an additional application view to display employee details. This view will be displayed when the user selects an employee in the home view.

Because of the smaller screen sizes typical on mobile devices, mobile applications follow very different design patterns from web and desktop applications. When developing for mobile applications, you typically break down the content to a series of views that can be displayed on the mobile device. Each view should contain components focused on a single task or set of information. The user typically “drills down” from one view to another for details, using a back button or touch swipe to return to the more general information.

 

Read More

 
2 Comments

Posted by on July 3, 2011 in Flash Builder 4.5, Mobile Technology

 

PhoneGap tutorials for All Platforms

http://wiki.phonegap.com/w/page/35501397/Tutorials