Introduction to AS3Signals
Peter Elst - Flex@Beach ’10
Who am I?	
Freelance Flash Platform consultant
Founding Partner of Project Cocoon Multimedia
Author to “Object-Oriented Ac...
What is AS3Signals?
Open source project by Rob Penner
Alternative way to working with events in AS3
Inspired by C# events ...
Lets get back to basics

 > flash.events.EventDispatcher
 > flash.events.Event
EventDispatcher Demo
What is wrong with this?
 Requires inheritance to dispatch events
 Need to subclass Event to pass around data
 String refe...
What does AS3Signals do?
Uses composition over inheritance
Doesn’t require subclassing to pass arguments
Listeners subscri...
Signal
 Most lightweight Signal class
 Passes any number of arguments
 Supports optional strong typing for arguments



 o...
Signal Demo
DeluxeSignal
Does everything Signals does
Adds support for target and signal that dispatched it
Passes GenericEvent to lis...
DeluxeSignal Demo
NativeSignal
 Uses Signal to wrap around native Events
 Requires object, event type and event class arguments
 Uses IEvent...
NativeSignal Demo
NativeRelaySignal
Similar to the NativeSignal class
Extends DeluxeSignal
Has its own dispatch code rather than IEventDispa...
Integration with frameworks
 Robotlegs
 http://bit.ly/robotlegs-as3signals
 Swiz
 http://bit.ly/swignalz
Useful features
 removeAll - removes all listeners to a signal
 addOnce - fires a signal event only the first time
 numListe...
How well does it perform?




  zero listeners   one listener
Where can you get it?
github.com/robertpenner/as3-signals



More information


Blog      robertpenner.com/flashblog
Forum ...
Questions? Thoughts?


Feel free to get in touch!

Twitter   @peterelst
Email     peter@project-cocoon.com
Blog      www.p...
!"க ந%&!
Upcoming SlideShare
Loading in …5
×

Introduction to AS3Signals

3,108 views

Published on

Published in: Technology
1 Comment
6 Likes
Statistics
Notes
No Downloads
Views
Total views
3,108
On SlideShare
0
From Embeds
0
Number of Embeds
432
Actions
Shares
0
Downloads
59
Comments
1
Likes
6
Embeds 0
No embeds

No notes for slide

Introduction to AS3Signals

  1. 1. Introduction to AS3Signals Peter Elst - Flex@Beach ’10
  2. 2. Who am I? Freelance Flash Platform consultant Founding Partner of Project Cocoon Multimedia Author to “Object-Oriented ActionScript 3.0” Certified geek
  3. 3. What is AS3Signals? Open source project by Rob Penner Alternative way to working with events in AS3 Inspired by C# events and Signals/Slots in QT Lightweight, easy and fast to use
  4. 4. Lets get back to basics > flash.events.EventDispatcher > flash.events.Event
  5. 5. EventDispatcher Demo
  6. 6. What is wrong with this? Requires inheritance to dispatch events Need to subclass Event to pass around data String references as events rather than objects Misses basic functionality (remove all listeners etc.)
  7. 7. What does AS3Signals do? Uses composition over inheritance Doesn’t require subclassing to pass arguments Listeners subscribe to Objects not a String reference Can hook up to native Events
  8. 8. Signal Most lightweight Signal class Passes any number of arguments Supports optional strong typing for arguments org.osflash.signals.Signal
  9. 9. Signal Demo
  10. 10. DeluxeSignal Does everything Signals does Adds support for target and signal that dispatched it Passes GenericEvent to listener org.osflash.signals.DeluxeSignal
  11. 11. DeluxeSignal Demo
  12. 12. NativeSignal Uses Signal to wrap around native Events Requires object, event type and event class arguments Uses IEventDispatcher to dispatch org.osflash.signals.natives.NativeSignal
  13. 13. NativeSignal Demo
  14. 14. NativeRelaySignal Similar to the NativeSignal class Extends DeluxeSignal Has its own dispatch code rather than IEventDispatcher org.osflash.signals.natives.NativeRelaySignal
  15. 15. Integration with frameworks Robotlegs http://bit.ly/robotlegs-as3signals Swiz http://bit.ly/swignalz
  16. 16. Useful features removeAll - removes all listeners to a signal addOnce - fires a signal event only the first time numListeners - returns how many listeners for a signal There is experimental event bubbling support
  17. 17. How well does it perform? zero listeners one listener
  18. 18. Where can you get it? github.com/robertpenner/as3-signals More information Blog robertpenner.com/flashblog Forum groups.google.com/group/as3-signals Twitter @robpenner
  19. 19. Questions? Thoughts? Feel free to get in touch! Twitter @peterelst Email peter@project-cocoon.com Blog www.peterelst.com Website www.project-cocoon.com
  20. 20. !"க ந%&!

×