Publishing to iOS devices using Director 12

Overview

You can now publish Adobe Director movies for the Apple iOS platform. The Publishing dialog box contains new options (iOS Projector option and iOS tab) that lets you create an application that can run on the iOS platform.

The Shockwave Player runtime is embedded within the iOS application. The embedded runtime interprets the dir/dcr files that are also embedded within the application.

Prerequisites

  • Mac OSX 10.7.3
  • Xcode 4.2 or later

If you have multiple Xcode installations on your machine, use the switch command to select the Xcode root path:

sudo /usr/bin/xcodeselect -switch <xcode-developer-folder-path>

Publish Adobe Director movies as iOS apps

To publish an Adobe Director movie as an iOS application, do the following:

  • In Publish Settings, click the Formats tab, and select iOS Projector.

  • Click the iOS tab, and specify the details.
    • iOS App Name: The name of the application as you want it to appear on iOS devices.
    • iOS App Bundle Identifier: Unique identifier for the app as registered in the iTunes store. This ID is used by Apple to detect upgrades and newer versions of the app.
    • Info Plist Path: Path to the info.plist file that needs to be embedded along with the app. You can use the template info.plist from the /Configuration/Publish iOS Resources/ folder and make changes to it as needed by your app. The values for the following fields are picked up from the iOS tab at the time of publishing, overwritten by Adobe Director before the file is published:
      • app name
      • bundle identifier
      • app orientation

Any values that you have specified for these fields earlier in the info.plist file will be overwritten with the values you provide in the iOS tab.

  • Provisioning File Path For Signing The App and: Create the mobile Provisioning file path by referring to the information at https://developer.apple.com/ios/manage/distribution/index.action. Download the mobile Provisioning file path after creating it and then point the file to the "Provisioning file path for signing the app" field.
  • App Signing Identity Name: Create the Developer/Distribution certificate by referring to the information at https://developer.apple.com/ios/manage/distribution/index.action. After creating the certificate, include the certificates in your Keychain by double-clicking the certificate. When you do so, the "App signing Identity name" is populated with the list of installed certificates and you can select the required certificates.
  • iOS App Orientation: Select an orientation for the app from the list.

  • Click Publish.

Accessing iOS accelerometer and gyroscope values from Lingo

The accelerometer object

The accelerometer values for an iOS device can be accessed from lingo using the _accelerometer object. _accelerometer has three properties x, y, and z that represent x, y, and z axes of device's accelerometer respectively.

&nbsp;One can either assign _accelerometer to a variable, or use the _accelerometer property directly to access the accelerometer object’s properties.

objAccelerometer = _accelerometer

xvalue = objAccelerometer.x

yvalue = objAccelerometer.y

zvalue = objAccelerometer.z

OR

xvalue = _accelerometer.x

yvalue = _accelerometer.y

zvalue = _accelerometer.z

The gyroscope object

The gyroscope values for and iOS device can be accessed from lingo using the _gyroscope object. _gyroscope has three properties x, y, and z that represent x, y, and z axes of a device's gyroscope respectively.

One can either assign _gyroscope to a variable, or use the _gyroscope property directly to access the gyroscope object’s properties.

objGyroscope = _gyroscope

xvalue = objGyroscope.x

yvalue = objGyroscope.y

zvalue = objGyroscope.z

OR

xvalue = _gyroscope.x

yvalue = _gyroscope.y

zvalue = _gyroscope.z
Note:

The Accelerometer and Gyroscope functionalities are available only with Lingo, and not with JavaScript.

Multi-touch properties

Property

Description

_touches.alltouches

Maintains a list of all current touch objects.

_touches.allTouches.count

Returns the total number of touches at the current time, which will be equal to the size of allTouches list. _touches.count can also be used for the same purpose.

_touches.lastMoved.count

Returns the total number of objects that have been moved which will be equal to the size of lastMoved list.

touch.x

Returns the 'X' location of the touch.

touch.y

Returns the 'Y' location of the touch.

touch.id

A unique read-only ID that can be used to track the touches.

touch.state

Returns which state the current touch object is in (Begin/moved/cancelled).

Example

touchCount = _touches.alltouches.count

if touchCount > 0  then 

  repeat with i=1 to touchCount 

    touchObj = _touches.alltouches[i]

    case touchObj.state of

      #begin:

        ----- touch has been begin (default)

      #moved:

        ----- touch has been moved         

     #cancelled:

       ----- touch has been cancelled

    end case

  end repeat

end if
Note:

The Multi-touch properties are available with Lingo only, and not with JavaScript.

Gestures

Lingo Developers may register for any Gesture supported by Adobe Director using the "registerGesture" call on the "_touches" object.

The "registerGesture" call takes two parameters:

  •  Symbol for the gesture
  • User-defined callback to handle the Gesture.

The supported Gestures and their corresponding symbols are:

  • Swipe Right: swipeRightGesture
  • Swipe Left: swipeLeftGesture
  • Swipe Up: swipeUpGesture
  • Swipe Down: swipeDownGesture
  • Long Press:longPressGesture
  • Tap: TapGesture
  • Double Tap: doubleTapGesture
  • Pinch: pinchGesture
  • Rotate: rotateGesture

For example:

_touches.registerGesture([#swipeRightGesture:#handleSwipeRight]) 
  on handleSwipeRight

--code to handle Right Swipe 

end

First parameter "swipeRightGesture" is the Symbol and "handleSwipeRight" is the user defined callback.

For Pinch & Rotate, Lingo returns a value that can be handled in the callback function.

For example:

_touches.registerGesture([#pinchGesture:#pinch])

 on pinch val

 -- val will hold a value which can be used in the handler

 end
Note:

Gesture recognition functionality is available with Lingo only, and not with JavaScript.

Support for custom URL scheme

An application can be bound to a custom URL scheme on iOS. This allows the application to be launched from either a browser or any another application on the same device (iPhone/iPad).

Director 12.0 allows you to set custom URL schemes for applications via publishing to iOS feature. It means that you can have a custom URL link such as “myApp://goto.url.com/reference” and on accessing the link, the application is launched.

How does this work?

The iOS SDK natively supports custom URL Schemes for its applications. The Shockwave application of Director 12.0 for iOS leverages this feature to facilitate custom URL Schemes.

How to implement this in your Adobe Director movie?

Allow your Adobe Director movie to use the new event handler "on handleOpenURL". Then use "_movie.openURL" attribute to access the incoming URL scheme. This is a persistent attribute which you can refer anywhere in the movie and also across application instances.

Finally you need to register your app with iOS for the custom URL scheme by editing the Info.plist file of the application. Director provides options to choose the modified Info.plist file in the Publish Settings iOS dialog. On the Publish Settings dialog, you need to add "CFBundleURLTypes" key with its attributes "CFBundleURLSchemes" and "CFBundleURLName".

  1. Open the info.plist in Xcode
  2. Right click and add a row named ‘URLTypes’ (you can select it from the drop down)
  3. Enter a unique value for URL identifier
  4. Add a row within the URLTypes named ‘URLSchemes’(you can select it from the drop down)
  5. Enter your specific URL scheme value for item 0

For more information, see this link.

Support for displaying text

You can now display text for Adobe Director iOS apps. Currently, only the fonts available on the device are supported.&nbsp; Classic toolbar tools such as buttons, radio buttons, and check boxes will display text and can be used for basic functionality.

  • All font styles on the iOS devices are supported. If a specific font is not available on a device, the closest match to the font on the device or the default font is applied.
  • Various text properties such as color, background, and size are supported.
  • Formatting of text, such as, Bold and Italic are supported.
  • Paragraph styles (Alignment, Line Spacing, Indents, and Custom tab spaces) are supported.
  • For non-editable text, individual formatting for every character is supported. A text box can now contain text with a combination of text formatting such as fonts, colors, and styles.
  • Scrollable text is supported. The scrollbar shown on the desktop versions are replaced with a temporary scrollbar that only appears when scrolling (dragging) the text.
  • Textures can be generated from text cast members. Here’s an example where textMember is a text cast member:

Member(“flower”).image = member(“textMember”).image

Known limitations

  • For editable text members, formatting of the first character is applied to the whole text box.
  • When you apply a style to an editable text member, the text member is not rendered immediately. The text member is rendered with the applied style only when you edit it.
  • Kerning/Character spacing is not supported in paragraph styles.
  • Hyperlinks are supported. However, hyperlink is applied to entire text boxes and not ranges of text within the boxes. For example, if a single word is hyperlinked in a text member, clicking on any word in the textbox will direct the user to the link.
  • charPosToLoc(), locToCharPos(), locVToLinePos() and similar functions will not work.
  • Field members are not working as expected.
  • Underline and strikethrough styles are not supported.
  • 3D Text is not supported.

Support for High Resolution Retina Display

Adobe Director 12 extends support for High Resolution Retina Display. You can enable High Resolution mode for Movies or games created using Director.

Use the following read-only property to enable retina display mode.

_player.screenScale

If the iOS device you are publishing to supports Retina Display, then Director enables Retina Display mode by default (sets screenScale to 2.0). To explicitly disable it, add a Info.plist value of YES (Boolean) for the key DIR_disable_retina. In this case, even if the device supports retina display, the app will be run in non-retina mode and the screenScale value reads as 1.0.

Note:

Read the value of _player.screenScale using Lingo and assign appropriate images and textures to support Retina Display in the movie. It means that if the screenScale value is 2.0, use a high resolution image.

Changes in the Physics engine

Physics for iOS (Dynamiks Xtra) uses PhysX SDK v3.2.0 from Nvidia while the current desktop version uses PhysX SDK v2.7.2. Since there are slight changes in the interfaces in the newer version of PhysX SDK, we are providing a new version of Dynamiks Xtra for Mac.

Two versions of Dynamiks Xtra have been enabled for use on MAC, Dynamiks.xtra and Dynamiks_320.xtra.

The Dynamiks_320.xtra can be used while authoring movies for iOS platform to preview how the end result looks on idevices.

Note: Dynamiks_320 uses latest PhysX engine which supports iOS. Movies with old physics cast member will throw errors when played on iOS. To ensure that physics created using Director 11.5 to play on iOS:

  1. Delete the old physics cast member
  2. Import the new physics cast member from Insert-> Media Element > Physics_320
  3. Republish the movie

The following are the iOS-specific changes in the Physics engine:

For rigid body methods such as applyForce(vector vForce, vector vPosition), you may have to manipulate the vForce vector and specify higher values to generate the same effect as the previous builds.

Sample Code:

--Earlier Director Builds                                                                  
                
        rb.applyForce(200,200,200)

--Current Director 

Build                                                                                 
                
        rb.applyForce(1000,1000,1000)

Flash Xtra Support for iOS

SWF output files created for Flash 10 or earlier are supported. Avoid using Flash components from the Tools menu.

Note: As Flash Xtra support is still in progress, you may observe that for some movies the colors do not render properly.

Support for iAds Manager Xtra

Director 12 extends support for iAds Manager Xtra, thereby allowing you to invoke and display ads within games. Take advantage of this feature to display relevant banner ads retrieved from the Apple iAds server. For more information, refer to this link.

Instantiating iAds Manager Xtra

It is necessary that you instantiate iAds Manager Xtra before using any of the the following methods. For example:

global  iAdsManagerXtraRef
on PrepareMovie
iAdsManagerXtraRef= new Xtra("iAdsManager")
End

InitBanner(point HideInLocation, point ShowInLocation)

Initializes a banner at the HideInLocation point within a game. On loading the Ad, the ad is moved to the ShowInLocation point. Using two different points to initialize and display the ad allows you to display ads that have animations or interactivity. You may choose to set HideInLocation and ShowInLocation values as the same if the Ad does not contain any animation or interactivity.

Usage

hideInLocation = point(0,0)
showInLocation=point(0,0)
iAdsManagerXtraRef.InitBanner(hideInLocation,showInLocation)

Properties

  • HideInLocation – Initial Location (point) of the ad before loading
  • ShowInLocation – Final position (point)of the ad after loading

getBannerSize()

Returns the size of the Banner View as a point data type.

Usage

Banner_Size = iAdsManagerXtraRef.getBannerSize()

setBannerPosition(point hideInLocation, point ShowInLocation)

Allows you to modify the position of the ad banner. The ad is moved to the ShowInLocation point. Using two different points to initialize and display the ad allows you to display ads that have animations or interactivity. You may choose to set HideInLocation and ShowInLocation values as the same if the Ad does not contain any animation or interactivity.

Usage

Banner_Size = iAdsManagerXtraRef.getBannerSize()
hideInLocation = point(0,0)
showInLocation=point(0,768- Banner_Size.locV)
iAdsManagerXtraRef. setBannerPosition (hideInLocation,showInLocation)

Properties

  • HideInLocation: Initial Location (point) of the ad before loading or if the ad fails to load
  • ShowInLocation: Final position (point)of the ad after loading

shouldExecuteBannerAction(Boolean shouldExecute)

Restricts BannerAdView action that is called when banner ad is clicked. It is set to true by default.

Usage

iAdsManagerXtraRef.shouldExecuteBannerAction(true)

Callbacks for iAds Manager Xtra

bannerViewActionShouldBegin

Is called back when a user clicks the ad banner.

Usage

on BannerViewActionShouldBegin

pauseGame()

end

bannerViewActionDidFinish

Is called back when a user finishes viewing the ad.

Usage

On bannerViewActionDidFinish

resumeGame()

end

bannerViewDidLoadAd

Is called back on successfully loading the ad.

Usage

On BannerViewDidiLoadAd

--do something

end

didFailToReceiveAdWithError errorMsg

Is called back when an ad fails to load.

Usage

on didFailToReceiveAdWithError errorMessage

displayError(erroMessage)

end

Enable in-app purchasing

Adobe Director 12 extends support for the iOS Store Kit. Store Kit communicates with the App Store on behalf of your application. Your application uses Store Kit to receive localized information from the App Store about products you want to offer in your application.

Instantiating iOSStoreKitXtra

It is necessary that instantiate iOSStoreKitXtra before executing any of the following methods to enable in-app purchasing. For example:

global  StoreKitXtra
on PrepareMovie
StoreKitXtra = new Xtra("IOSStoreKit")
End

RequestProductDetails(ProductDetailsHandler)

Retrieves available product details asynchronously. The ProductDetailsHandler method is called with the result list that contains the following information:

  • LocalizedTitle: Localized title as specified in the iTunesConnect (string)
  • Price: Price in local currency (float)
  • LocalizedDescription: Localized description as specified in iTunesConnect (string)
  • ProductIdentifier: Product identifier as specified in iTunesConnect (string)
  • CurrencyString: Price in local currecy format (string). For example, $25.

SetTransactionHandler(TransactionStatusHandler)

Store Kit Xtra needs a callback function that can inform lingo about the status or result of purchase transactions. The SetTransactionHandler method allows you to implement the same.

The TransactionStatusHandler is called by Store Kit Xtra with a property list as argument.

  • TransactionState: State of the current transaction and can read purchased (SKPaymentTransactionStatePurchased), failed (#SKPaymentTransactionStateFailed), restored, (SKPaymentTransactionStateRestored) or purchase in progress (SKPaymentTransactionStatePurchasing)
  • TransactionIdentifier: Unique identifier for the transaction (string)
  • ProductIdentifier: Unique identifier for the current product (string)

Usage

on HandlerTransactions plist
//process plist
end
StoreKitXtra.SetTransactionHandler(#HandlerTransactions)

MakePurchase(ProductIdentifier)

Allows you to purchase any In-App product. Note that this is an asynchronous call. The result will be returned to Transaction Handler set using SetTransactionHandler call.

Usage

StoreKitXtra.MakePurchase("SHOCKWAVE_TEST_PRODUCT")

RestoreTransactions()

Restores transactions for non-consumable products, auto-renewable subscriptions and free subscriptions. This method allows a user to add the product to other devices or, if the original device was wiped, to restore the transaction on the original device.

Usage

StoreKitXtra.RestoreTransactions()

How to handle Save & Load events for Director iOS App

Event handlers onActivateApplication and onDeactivateApplication are now supported on iOS also.

onActivateApplication handler will be called when the iOS Director APP comes to the foreground and onDeactivateApplication handler will be called when the iOS APP goes to the background.

These handlers must be called from a MovieScript . For more information, see this article in Adobe Director help.

Known limitations

  • There is no auto-download of Xtras because iOS does not support code download and execution at runtime. That is, all Xtras used by the movie should be embedded within the application.
  • Normal map and Parallax map effects are not yet supported in 3D Xtra.
  • Bitmap palettes and Transitions are not working.
  • Users can open the existing Adobe Director 11.X movies and create the iOS version. However, if the movies use Havok Xtra or are created using Adobe Director version 10.x or lower, you cannot create the iOS apps out of such movies.
  • 8-bit and 16-bit Bitmap images are not supported.
  • 24-bit and 32-bit audio files are not supported.
  • (Physics) Value of property contactTolerance is not supported.
  • (Physics) Rigid body properties, angularMomentum and linearMomentum, are not supported.
Adobe logo

Sign in to your account