Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Adobe Edge resources /

Bootstrapping Edge compositions with bootstrapCallback

by Josh Hatwich

Josh Hatwich
  • edge.adobe.com
  • blogs.adobe.com/edge

Content

  • Code Example: Playing three compositions in sequence
  • Where to go from here

Created

30 July 2012

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
customization HTML5 integration JavaScript

Requirements

Prerequisite knowledge

Prerequisite knowledge

Some familiarity with Adobe Edge® and HTML markup.

 

Required Adobe products

  • * Adobe Edge preview
  • * An HTML editor, such as Adobe Dreamweaver (Try or Buy) or Brackets (an open-source code editor)

User level

Beginning

Sample files

  • edge-bootstrap-example.zip

We added a small feature with Adobe Edge preview 6 that makes a big difference if you are trying to combine multiple Edge compositions so that they will work together, or if you are integrating an Edge composition into a larger website framework. In this example, you will learn how to use the AdobeEdge.bootstrapCallback API that the Adobe Edge team added to preview 6, so that you can programmatically register a callback function when users land on HTML pages within your website; in short, this allows you and your applications to access event listeners for Symbol and Timeline events without editing an Edge composition xyz_edgeActions.js file directly.  

How does this work? The Edge preloader now defines the AdobeEdge.bootstrapCallback API, which allows you to register a callback function from the context of your HTML page that will be called when your Edge composition is loaded and ready to play. This callback provides a hook to register event listeners for Symbol and Timeline events, something that was previously only possible from within an Edge composition xyz_edgeActions.js file.

Code Example: Playing three compositions in sequence

The following looks at an example that plays a series of compositions in sequence. The example ZIP file that you downloaded from the Requirements section contains three "finished" Edge compositions that allow you to focus on editing the wrapper.html file that combines the three compositions.  The compositions that we’ll use are very simple:

  • page_a.html
  • page_b.html
  • page_c.html

Setting up the project

Edge does not support editing multiple compositions in the same file. You still might want to make edits to a composition after integrating it into a larger site. An emerging practice is to edit the compositions separately via a composition-specific HTML files and then combine then in a single wrapper.html file that your site uses to preview the combined work.

Figure 1. To preview, combine composition files in a single wrapper file. This diagram maps the file structure for a website.
Figure 1. To preview, combine composition files in a single wrapper file. This diagram maps the file structure for a website.

You can place the wrapper and each of the pages in the same directory so that they can share resources.

Including the three compositions

First the wrapper.html must include each of the compositions, as shown in the code in Figure 2.

Figure 2. Add the compositions to the wrapper file.
Figure 2. Add the compositions to the wrapper file.

Adding HTML markup for each stage

For each Edge composition, associate a stage DIV with a class name identical to the Edge composition’s ID.

Figure 3. Associate each Edge composition with an identical DIV class name.
Figure 3. Associate each Edge composition with an identical DIV class name.

Adding CSS to position three stages

Each Edge composition lives inside a stage DIV element. Without a little help from CSS, the three stages flow and display one after another. The stages also all appear when the page loads. In this example, the code hides the second and third stage until the right time in the sequence, as shown in the code for Figure 4.

Figure 4. Hiding the second and third stage until the right time in the sequence.
Figure 4. Hiding the second and third stage until the right time in the sequence.

Bootstrapping with JavaScript

Since Edge loads using a preloader script, very few JavaScript APIs are reliably available from the wrapper HTML page. The preloader downloads Edge and jQuery libraries dynamically; therefore, the HTML page needs a hard signal that indicates when it is safe to call into jQuery and Edge APIs. Add the following code to establish callback -- in other words, indicate -- when it is safe for your page to call jQuery and Edge APIs.

AdobeEdge.bootstrapCallback(function (compId) {   //your function will be called when the composition is ready to play });

Coordinating multiple compositions

Your bootstrap function coordinates three compositions. As each composition loads and becomes ready, each composition calls the callback you’ve registered. Coordinate the compositions by keeping track of loading using the loadedComps variable.

Figure 5. Keep track of loading by using the loadedComps variable.
Figure 5. Keep track of loading by using the loadedComps variable.

Registering Edge-specific callbacks

The Edge composition is ready when the the Edge runtime issues the bootstrap callback. You can safely bind to Edge callback APIs. You can use the same syntax here as is in the xyz_edgeActions.js file. The following code listens for the timeline to complete. When one timeline completes, it hides the related composition and then shows and plays the next one in the sequence.

Figure 6. When the timeline completes: hide what was played, and show and play the next.
Figure 6. When the timeline completes: hide what was played, and show and play the next.

It is pretty simple!

Here is the finished result. (This finished result is more for you to inspect and see the functionality, rather than for your viewing pleasure.)

Where to go from here

There are a host of great resources collected on the Adobe Edge website and the on the Adobe team blogs. If you require help or have suggestions for the Edge team, you can find the core engineering and product management team on the Adobe Edge user forum.

More Like This

  • Beginner's guide to Adobe Edge Preview 3
  • Beginner's guide to Adobe Edge Preview 4

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement