SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Flex Book Club: Chapter 5 Learning The Basics of Scripting Part 1
Topics Covered Today… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Today’s Process for Learning ,[object Object],[object Object],ActionScript MXML
As different as these guys are… ,[object Object],ActionScript MXML
Argument 1: id’s are variable names ,[object Object],ActionScript MXML <mx:Button  id=“ myButton ”  /> var  myButton:Button =  new  Button();
Argument 2: Inline ActionScript ,[object Object],ActionScript MXML <mx:Button  id=“ myButton ”  click=“ panel.label = ‘something’ ”/>
Razone Tres (Argument 3): Dot Notation ,[object Object],ActionScript MXML <mx:Panel  id=“ myPanel ” label=“ Something ”  /> myPanel.label = ‘ Something ’;
Argument 4: Assignment ,[object Object],ActionScript MXML <mx:Panel  id=“ myPanel ” label=“ Something ”  /> myPanel.label = ‘ Something ’;
Argument 3/4  Rebuttal : Assignment Operations ,[object Object],ActionScript MXML <mx:Button  id=“ myButton ”  click=“ panel.label = ‘something’ ”/>
Argument 3/4  Rebuttal Rebuttal  : Attributes in  MXML ,[object Object],ActionScript MXML Properties Styles Event Listeners
Question: MXML Yeah, yeah yeah…we get it. “They are the same thing.” But I have a question…If MXML is so much more succinct, so much easier to write, and in general really hella friggin AWESOME. Why would anyone ever write a line of ActionScript?
Answer: ActionScript MXML is  Great  for things like laying out what your app is going to look like. However, when it comes time to take action and DO SOMETHING, MXML looks a lot like the Government in the middle of a credit crisis,  Big Talk, No ACTION. That is why they call is  Action Script afterall…
Getting into ActionScript with Variables ActionScript We’ve already seen examples of variables all over the place used to store information… public var  userName =  “Tom” This is the keyword we use to declare variables This is the variable’s name This is it’s value
Variable Data Types ActionScript You might have noticed in the past we did something like… public var  userName:String =  “Tom” This is the data type of the variable we are declaring is a String That’s just a way of saying what  kind  of data the variable holds See page 54 in “Learning Flex 3” for a reference to all of the fundamental data types.
Functions ActionScript Functions,  are pieces of code we create to re-use code, so we don’t have to write it over again. <mx:Script> <![CDATA[ function  createUser(){ } ]] </mx:Script> If we put code between the brackets that creates a new user, we can re-use that code by calling the method.
Function Parameters ActionScript We can also supply our functions with data to make them more re-usable <mx:Script> <![CDATA[ function  createUser(name){ } ]] </mx:Script> In this case we supply the function with a name to assign to a new user.
Function Parameters ActionScript Furthermore, we can give our function parameters some default values, and give those parameters data types.  function  createUser(name:String = “Sam”){ } In this case we say that the parameter has to be a String. Also if there is no parameter supplied, name will be given the value of “Sam”
Alice…meet the Rabbit Hole ,[object Object],You down with OOP? Yeah you know ME!!!
Objects group together variables and functions. I’m a frog object ActionScript We can make anything an object. Cars, People, Buttons, even frogs! var  frog:Object =  new  Object(); frog.color =  “green” ; frog.name =  “Kermit De Frog” ; We’ll get to grouping in functions later.
A Class is a Blueprint for an object. I’m a frog class ActionScript Think of classes as a way to make objects (or structured data) re-usable Public   class   Frog { var  name:String; var  color:uint; … }
We can even put objects within classes. ActionScript Classes can help us, especially with code completion in the Flex IDE! Public   class   Pond { var  frog:Frog; var  rock:Rock; var  name:String; }
If we didn’t convince you before… ,[object Object],[object Object],[object Object],ActionScript The following facts should illustrate how ActionScript and MXML are related…
References ,[object Object]

Weitere ähnliche Inhalte

Ähnlich wie Flex Book Club Chapter 5

Metaclasses – Python’s Object-Oriented Paradigm and Its Metaprogramming
Metaclasses – Python’s Object-Oriented Paradigm and Its MetaprogrammingMetaclasses – Python’s Object-Oriented Paradigm and Its Metaprogramming
Metaclasses – Python’s Object-Oriented Paradigm and Its MetaprogrammingInexture Solutions
 
Flex 4 components from the firehose
Flex 4 components from the firehoseFlex 4 components from the firehose
Flex 4 components from the firehosemichael.labriola
 
Flex 4 Components
Flex 4 ComponentsFlex 4 Components
Flex 4 Componentspaul51
 
Handout - Introduction to Programming
Handout - Introduction to ProgrammingHandout - Introduction to Programming
Handout - Introduction to ProgrammingCindy Royal
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsSaurabh Narula
 
Building .NET-based Applications with C#
Building .NET-based Applications with C#Building .NET-based Applications with C#
Building .NET-based Applications with C#Umar Farooq
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language PerformanceKevin Hazzard
 
JavaScript Workshop
JavaScript WorkshopJavaScript Workshop
JavaScript WorkshopPamela Fox
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best PraticesChengHui Weng
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
 
VBA for technical writers
VBA for technical writersVBA for technical writers
VBA for technical writersTCUK
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...amit kuraria
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsPatchSpace Ltd
 
Mongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node jsMongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node jsPallavi Srivastava
 
Naming Standards, Clean Code
Naming Standards, Clean CodeNaming Standards, Clean Code
Naming Standards, Clean CodeCleanestCode
 

Ähnlich wie Flex Book Club Chapter 5 (20)

Metaclasses – Python’s Object-Oriented Paradigm and Its Metaprogramming
Metaclasses – Python’s Object-Oriented Paradigm and Its MetaprogrammingMetaclasses – Python’s Object-Oriented Paradigm and Its Metaprogramming
Metaclasses – Python’s Object-Oriented Paradigm and Its Metaprogramming
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
Flex 4 components from the firehose
Flex 4 components from the firehoseFlex 4 components from the firehose
Flex 4 components from the firehose
 
Flex 4 Components
Flex 4 ComponentsFlex 4 Components
Flex 4 Components
 
Handout - Introduction to Programming
Handout - Introduction to ProgrammingHandout - Introduction to Programming
Handout - Introduction to Programming
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
 
Building .NET-based Applications with C#
Building .NET-based Applications with C#Building .NET-based Applications with C#
Building .NET-based Applications with C#
 
Week 9 IUB c#
Week 9 IUB c#Week 9 IUB c#
Week 9 IUB c#
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language Performance
 
JavaScript Workshop
JavaScript WorkshopJavaScript Workshop
JavaScript Workshop
 
Java scriptfunction
Java scriptfunctionJava scriptfunction
Java scriptfunction
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best Pratices
 
XAML and WPF - Dinko Jakovljević
XAML and WPF - Dinko JakovljevićXAML and WPF - Dinko Jakovljević
XAML and WPF - Dinko Jakovljević
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 
VBA for technical writers
VBA for technical writersVBA for technical writers
VBA for technical writers
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & Stubs
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
Mongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node jsMongoose getting started-Mongo Db with Node js
Mongoose getting started-Mongo Db with Node js
 
Naming Standards, Clean Code
Naming Standards, Clean CodeNaming Standards, Clean Code
Naming Standards, Clean Code
 

Kürzlich hochgeladen

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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 WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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 Scriptwesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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.pdfUK Journal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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.pdfsudhanshuwaghmare1
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Kürzlich hochgeladen (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Flex Book Club Chapter 5

  • 1. Flex Book Club: Chapter 5 Learning The Basics of Scripting Part 1
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Question: MXML Yeah, yeah yeah…we get it. “They are the same thing.” But I have a question…If MXML is so much more succinct, so much easier to write, and in general really hella friggin AWESOME. Why would anyone ever write a line of ActionScript?
  • 12. Answer: ActionScript MXML is Great for things like laying out what your app is going to look like. However, when it comes time to take action and DO SOMETHING, MXML looks a lot like the Government in the middle of a credit crisis, Big Talk, No ACTION. That is why they call is Action Script afterall…
  • 13. Getting into ActionScript with Variables ActionScript We’ve already seen examples of variables all over the place used to store information… public var userName = “Tom” This is the keyword we use to declare variables This is the variable’s name This is it’s value
  • 14. Variable Data Types ActionScript You might have noticed in the past we did something like… public var userName:String = “Tom” This is the data type of the variable we are declaring is a String That’s just a way of saying what kind of data the variable holds See page 54 in “Learning Flex 3” for a reference to all of the fundamental data types.
  • 15. Functions ActionScript Functions, are pieces of code we create to re-use code, so we don’t have to write it over again. <mx:Script> <![CDATA[ function createUser(){ } ]] </mx:Script> If we put code between the brackets that creates a new user, we can re-use that code by calling the method.
  • 16. Function Parameters ActionScript We can also supply our functions with data to make them more re-usable <mx:Script> <![CDATA[ function createUser(name){ } ]] </mx:Script> In this case we supply the function with a name to assign to a new user.
  • 17. Function Parameters ActionScript Furthermore, we can give our function parameters some default values, and give those parameters data types. function createUser(name:String = “Sam”){ } In this case we say that the parameter has to be a String. Also if there is no parameter supplied, name will be given the value of “Sam”
  • 18.
  • 19. Objects group together variables and functions. I’m a frog object ActionScript We can make anything an object. Cars, People, Buttons, even frogs! var frog:Object = new Object(); frog.color = “green” ; frog.name = “Kermit De Frog” ; We’ll get to grouping in functions later.
  • 20. A Class is a Blueprint for an object. I’m a frog class ActionScript Think of classes as a way to make objects (or structured data) re-usable Public class Frog { var name:String; var color:uint; … }
  • 21. We can even put objects within classes. ActionScript Classes can help us, especially with code completion in the Flex IDE! Public class Pond { var frog:Frog; var rock:Rock; var name:String; }
  • 22.
  • 23.