SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Building Desktop RIAs with
PHP, HTML & Javascript
in AIR
Ed Finkler, php|tek 2008, May 22 2008
funkatron.com / funkatron@gmail.com
What is AIR?

For the desktop
Not a browser plugin
Build desktop apps with web technologies
AIR architecture
   A flash player + special AIR-specific APIs
      HTMLLoader control
         Uses WebKit – like Safari 3


                         Flash
                                              Zee Cloud
    OS                                         web server
Win/Mac/Linux            Webkit
                      (HTMLLoader)
Building apps

Flex (XML + Actionscript → SWF)
Flash (the authoring tool → SWF)
HTML (HTML + JS + CSS)
  open standards!
  just like regular web pages
The bare essentials

 Application descriptor (.xml)
 Initial content (.swf or .html)
   If .html detected, auto-creates Flash wrapper with
   HTMLLoader control
App descriptor
 <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
 <application xmlns=quot;http://ns.adobe.com/air/application/1.0quot;>
     <id>book.csv</id>
     <filename>Book-CSV</filename>
     <version>1.0.0</version>
     <initialWindow>
         <content>example-csv.html</content>
         <visible>true</visible>
         <width>400</width>
         <height>600</height>
         <x>100</x>
         <y>100</y>
     </initialWindow>
 </application>
Initial content
<!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Transitional//ENquot;
  quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdquot;>

<html xmlns=quot;http://www.w3.org/1999/xhtmlquot; xml:lang=quot;enquot; lang=quot;enquot;>
<head>
  <meta http-equiv=quot;Content-Typequot; content=quot;text/html; charset=utf-8quot;/>

  <title>csv-example</title>
  <script src=quot;assets/AIRAliases.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script>
  <script src=quot;assets/AIRIntrospector.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script>
  <script src=quot;assets/jquery-1.2.3.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script>
  <script src=quot;assets/json2.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script>

  <script src=quot;assets/dojo/dojo/dojo.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script>
  <script type=quot;text/javascriptquot; charset=quot;utf-8quot;>
    $().ready( function() {
       var csvstring = '';
       csvstring += '1997,Ford,E350,quot;ac, abs, moonquot;,3000.00n';
       csvstring += '1999,Chevy,quot;Venture quot;quot;Extended Editionquot;quot;quot;,,4900.00n';
       csvstring += '1996,Jeep,Grand Cherokee,quot;MUST SELL! air, moon roof, loadedquot;,4799.00n';
       $('#name').text(csvstring);
    });
  </script>
</head>
<body>
  <textarea name=quot;Namequot; rows=quot;8quot; cols=quot;80quot; id=quot;namequot;></textarea>
</body>
</html>
JavaScript in AIR
 Can use (almost) any available JS libs/frameworks
   No cross-domain restrictions
   security restrictions in app sandbox ( eval() )
 Access AIR APIs
 Access standard Flash APIs
 Use compiled AS3 libs
PHP vs JavaScript
JavaScript is fundamentally different
JS is a functional language
  functions are objects
  anon functions
  define functions inside functions
Object model is totally different
  Prototype model – not “classic” Java/PHP5 model
PHP vs JavaScript
Everything in JS is an object
Arrays are not associative – objects serve as
associative array equivalents
No include/require statements available
Event-driven model/asynchronous actions

     Further reading:
      – JavaScript: The Definitive Guide, David Flanagan
      – JavaScript: The Good Parts, Douglas Crockford
JavaScript frameworks

Some stuff is a huge pain without the help of a
framework
Lots of choices
Must play well with AIR
  eval usage
jQuery pwnz yoo

jQuery is teh awesome
lightweight, powerful, terse (esp DOM)
plays well with others
easily extensible
large dev community
decent docs

              but you really can use almost anything…
PHP is your server-side buddy

        PHP
    tubby jedi master




                  AIR
              hyper frontman



 Use 5.2 at least
   adds native JSON encoding/decoding
 Framework choices
Example 1:
PHP duz yer math
Async calls using jQuery AJAX methods
Communicate via JSON



            Flash
                                   Zee Cloud
                                    web server

            Webkit
Example 2:
PHP shops yer pics
Uploading via Flash APIs
JSON based communication



             Flash
                           Zee Cloud
                            web server

             Webkit
Additional resources

 Developing Adobe® AIR™ Applications with HTML and
 Ajax – http://livedocs.adobe.com/air/1/devappshtml/
 Adobe AIR Developer Center for HTML and Ajax Quick
 Starts – http://www.adobe.com/devnet/air/ajax/
 quickstart/
 Spaz source code – http://code.google.com/p/spaz/
Questions?

Contenu connexe

Tendances

"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap
Christian Rokitta
 
Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014
Ashwin Date
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
Mohammed Safwat
 

Tendances (20)

HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile design
 
Browser Developer Tools
Browser Developer ToolsBrowser Developer Tools
Browser Developer Tools
 
Flex vs. HTML5 for RIAS
Flex vs. HTML5 for RIASFlex vs. HTML5 for RIAS
Flex vs. HTML5 for RIAS
 
"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap"Native" Apps with APEX and PhoneGap
"Native" Apps with APEX and PhoneGap
 
jQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchAppsjQuery Conference Boston 2011 CouchApps
jQuery Conference Boston 2011 CouchApps
 
Ionic
IonicIonic
Ionic
 
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
 
Cordova and PhoneGap Insights
Cordova and PhoneGap InsightsCordova and PhoneGap Insights
Cordova and PhoneGap Insights
 
Frontend State of the union
Frontend State of the unionFrontend State of the union
Frontend State of the union
 
Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014
 
Modern Web Development
Modern Web DevelopmentModern Web Development
Modern Web Development
 
Single page application and Framework
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
How To be a Backend developer
How To be a Backend developer    How To be a Backend developer
How To be a Backend developer
 
Back to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web DevelopmentBack to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web Development
 
PhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JSPhoneGap: Building Mobile Applications with HTML/JS
PhoneGap: Building Mobile Applications with HTML/JS
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical Writing
 

En vedette

Securing the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfoSecuring the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfo
funkatron
 
馬桶修好了!
馬桶修好了!馬桶修好了!
馬桶修好了!
Visit1992
 
Billandtedpowerpoint
BillandtedpowerpointBillandtedpowerpoint
Billandtedpowerpoint
dklm09
 
Joomla gran
Joomla granJoomla gran
Joomla gran
carlesr
 
Bunnysharerevised
BunnysharerevisedBunnysharerevised
Bunnysharerevised
Carla Lopes
 

En vedette (7)

InglêS
InglêSInglêS
InglêS
 
Securing the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfoSecuring the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfo
 
Animals
AnimalsAnimals
Animals
 
馬桶修好了!
馬桶修好了!馬桶修好了!
馬桶修好了!
 
Billandtedpowerpoint
BillandtedpowerpointBillandtedpowerpoint
Billandtedpowerpoint
 
Joomla gran
Joomla granJoomla gran
Joomla gran
 
Bunnysharerevised
BunnysharerevisedBunnysharerevised
Bunnysharerevised
 

Similaire à Building Desktop RIAs with PHP, HTML & Javascript in AIR

Building Desktop RIAs with PHP, HTML & Javascript in AIR
Building Desktop RIAs with  PHP, HTML & Javascript  in AIRBuilding Desktop RIAs with  PHP, HTML & Javascript  in AIR
Building Desktop RIAs with PHP, HTML & Javascript in AIR
funkatron
 
Building Desktop RIAs With PHP And JavaScript
Building Desktop RIAs With PHP And JavaScriptBuilding Desktop RIAs With PHP And JavaScript
Building Desktop RIAs With PHP And JavaScript
funkatron
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Frank La Vigne
 

Similaire à Building Desktop RIAs with PHP, HTML & Javascript in AIR (20)

Building Desktop RIAs with PHP, HTML & Javascript in AIR
Building Desktop RIAs with  PHP, HTML & Javascript  in AIRBuilding Desktop RIAs with  PHP, HTML & Javascript  in AIR
Building Desktop RIAs with PHP, HTML & Javascript in AIR
 
Building Desktop RIAs With PHP And JavaScript
Building Desktop RIAs With PHP And JavaScriptBuilding Desktop RIAs With PHP And JavaScript
Building Desktop RIAs With PHP And JavaScript
 
Building Desktop RIAs with JavaScript and PHP - ZendCon09
Building Desktop RIAs with JavaScript and PHP - ZendCon09Building Desktop RIAs with JavaScript and PHP - ZendCon09
Building Desktop RIAs with JavaScript and PHP - ZendCon09
 
Adobe® Flex™
Adobe® Flex™Adobe® Flex™
Adobe® Flex™
 
What is Adobe Flex ?
What is Adobe Flex  ?What is Adobe Flex  ?
What is Adobe Flex ?
 
orcreatehappyusers
orcreatehappyusersorcreatehappyusers
orcreatehappyusers
 
orcreatehappyusers
orcreatehappyusersorcreatehappyusers
orcreatehappyusers
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and LibrariesJavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and Libraries
 
echo-o & Adobe Air App Dev - BarCamp Saigon 1
echo-o & Adobe Air App Dev - BarCamp Saigon 1echo-o & Adobe Air App Dev - BarCamp Saigon 1
echo-o & Adobe Air App Dev - BarCamp Saigon 1
 
Adobe Air
Adobe AirAdobe Air
Adobe Air
 
A I R Presentation Dev Camp Feb 08
A I R  Presentation  Dev Camp  Feb 08A I R  Presentation  Dev Camp  Feb 08
A I R Presentation Dev Camp Feb 08
 
Yes, you can do that with AIR 2.0
Yes, you can do that with AIR 2.0Yes, you can do that with AIR 2.0
Yes, you can do that with AIR 2.0
 
Adobe Flex
Adobe FlexAdobe Flex
Adobe Flex
 
Introduction To Adobe Flex And Semantic Resources
Introduction To Adobe Flex And Semantic ResourcesIntroduction To Adobe Flex And Semantic Resources
Introduction To Adobe Flex And Semantic Resources
 
DIY Flex
DIY FlexDIY Flex
DIY Flex
 
DIY Flex
DIY FlexDIY Flex
DIY Flex
 
A Microsoft primer for PHP devs
A Microsoft primer for PHP devsA Microsoft primer for PHP devs
A Microsoft primer for PHP devs
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
 
Html5
Html5Html5
Html5
 
Adobe AIR Programming to Desktop and Mobile
Adobe AIR Programming to Desktop and MobileAdobe AIR Programming to Desktop and Mobile
Adobe AIR Programming to Desktop and Mobile
 

Plus de funkatron (7)

Building mobile apps with JavaScript and PHP
Building mobile apps with JavaScript and PHPBuilding mobile apps with JavaScript and PHP
Building mobile apps with JavaScript and PHP
 
JavaScript for PHP Developers
JavaScript for PHP DevelopersJavaScript for PHP Developers
JavaScript for PHP Developers
 
Building RIAs with CodeIgniter and JavaScript
Building RIAs with CodeIgniter and JavaScriptBuilding RIAs with CodeIgniter and JavaScript
Building RIAs with CodeIgniter and JavaScript
 
Secure PHP Development with Inspekt
Secure PHP Development with InspektSecure PHP Development with Inspekt
Secure PHP Development with Inspekt
 
JavaScript for PHP Developers
JavaScript for PHP DevelopersJavaScript for PHP Developers
JavaScript for PHP Developers
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
Securing the PHP Environment with PHPSecInfo - OSCON 2008
Securing the PHP Environment with PHPSecInfo - OSCON 2008Securing the PHP Environment with PHPSecInfo - OSCON 2008
Securing the PHP Environment with PHPSecInfo - OSCON 2008
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Building Desktop RIAs with PHP, HTML & Javascript in AIR

  • 1. Building Desktop RIAs with PHP, HTML & Javascript in AIR Ed Finkler, php|tek 2008, May 22 2008 funkatron.com / funkatron@gmail.com
  • 2. What is AIR? For the desktop Not a browser plugin Build desktop apps with web technologies
  • 3. AIR architecture A flash player + special AIR-specific APIs HTMLLoader control Uses WebKit – like Safari 3 Flash Zee Cloud OS web server Win/Mac/Linux Webkit (HTMLLoader)
  • 4. Building apps Flex (XML + Actionscript → SWF) Flash (the authoring tool → SWF) HTML (HTML + JS + CSS) open standards! just like regular web pages
  • 5. The bare essentials Application descriptor (.xml) Initial content (.swf or .html) If .html detected, auto-creates Flash wrapper with HTMLLoader control
  • 6. App descriptor <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <application xmlns=quot;http://ns.adobe.com/air/application/1.0quot;> <id>book.csv</id> <filename>Book-CSV</filename> <version>1.0.0</version> <initialWindow> <content>example-csv.html</content> <visible>true</visible> <width>400</width> <height>600</height> <x>100</x> <y>100</y> </initialWindow> </application>
  • 7. Initial content <!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Transitional//ENquot; quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdquot;> <html xmlns=quot;http://www.w3.org/1999/xhtmlquot; xml:lang=quot;enquot; lang=quot;enquot;> <head> <meta http-equiv=quot;Content-Typequot; content=quot;text/html; charset=utf-8quot;/> <title>csv-example</title> <script src=quot;assets/AIRAliases.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script> <script src=quot;assets/AIRIntrospector.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script> <script src=quot;assets/jquery-1.2.3.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script> <script src=quot;assets/json2.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script> <script src=quot;assets/dojo/dojo/dojo.jsquot; type=quot;text/javascriptquot; charset=quot;utf-8quot;></script> <script type=quot;text/javascriptquot; charset=quot;utf-8quot;> $().ready( function() { var csvstring = ''; csvstring += '1997,Ford,E350,quot;ac, abs, moonquot;,3000.00n'; csvstring += '1999,Chevy,quot;Venture quot;quot;Extended Editionquot;quot;quot;,,4900.00n'; csvstring += '1996,Jeep,Grand Cherokee,quot;MUST SELL! air, moon roof, loadedquot;,4799.00n'; $('#name').text(csvstring); }); </script> </head> <body> <textarea name=quot;Namequot; rows=quot;8quot; cols=quot;80quot; id=quot;namequot;></textarea> </body> </html>
  • 8. JavaScript in AIR Can use (almost) any available JS libs/frameworks No cross-domain restrictions security restrictions in app sandbox ( eval() ) Access AIR APIs Access standard Flash APIs Use compiled AS3 libs
  • 9. PHP vs JavaScript JavaScript is fundamentally different JS is a functional language functions are objects anon functions define functions inside functions Object model is totally different Prototype model – not “classic” Java/PHP5 model
  • 10. PHP vs JavaScript Everything in JS is an object Arrays are not associative – objects serve as associative array equivalents No include/require statements available Event-driven model/asynchronous actions Further reading: – JavaScript: The Definitive Guide, David Flanagan – JavaScript: The Good Parts, Douglas Crockford
  • 11. JavaScript frameworks Some stuff is a huge pain without the help of a framework Lots of choices Must play well with AIR eval usage
  • 12. jQuery pwnz yoo jQuery is teh awesome lightweight, powerful, terse (esp DOM) plays well with others easily extensible large dev community decent docs but you really can use almost anything…
  • 13. PHP is your server-side buddy PHP tubby jedi master AIR hyper frontman Use 5.2 at least adds native JSON encoding/decoding Framework choices
  • 14. Example 1: PHP duz yer math Async calls using jQuery AJAX methods Communicate via JSON Flash Zee Cloud web server Webkit
  • 15. Example 2: PHP shops yer pics Uploading via Flash APIs JSON based communication Flash Zee Cloud web server Webkit
  • 16. Additional resources Developing Adobe® AIR™ Applications with HTML and Ajax – http://livedocs.adobe.com/air/1/devappshtml/ Adobe AIR Developer Center for HTML and Ajax Quick Starts – http://www.adobe.com/devnet/air/ajax/ quickstart/ Spaz source code – http://code.google.com/p/spaz/