Page 1 of 1

AS3 - Extended resolumeCom package

Posted: Tue Apr 01, 2014 19:56
by Conduit
Hello folks,

As my inaugural post on this forum, I'd like to give you all a gift - at least as long as the folks at Resolume don't mind :D. I've been developing an extended version of the resolumeCom package that handles interop between Resolume and Flash. A list of my changes/additions:

MAIN
  • Fully backwards-compatible (afaik - let me know if you run into any issues)
  • Minor behind-the-scenes performance enhancements
  • Availability of ExternalInterface is checked before callbacks are added (no more errors when debugging!)
  • Excessive commenting on Resolume class
  • Resolume class can enforce unique parameter names (i.e. will throw an error if two parameters with the same name are added) which leads to the biggie...
  • Parameter values can be called as properties from the Resolume class when enforcing unique names (i.e. if you have a parameter named 'bass' added to a Resolume instance called 'resolume', then resolume.bass will retrieve the current value of the parameter named 'bass')
ADDED FUNCTIONS
  • Resolume.getParameterIndex: gets the index of a parameter specified by name when enforcing unique names
  • Resolume.getParameterNameAt: gets the name of a parameter specified by index
  • Resolume.getParameterType: gets the type code of a parameter specified by name when enforcing unique names
  • Resolume.getParameterTypeAt: gets the type code of a parameter specified by index
  • Resolume.addParameterListenerTo: adds a parameter listener to a parameter specified by name when enforcing unique names
  • Resolume.addParameterListenerAt: adds a parameter listener to a parameter specified by index
NOTES
  • Several functions have been changed to check variable types at run-time. It's unlikely that this will cause you any problems, but is something to be aware of
  • All the Parameter subclasses' functions are now inherited from the Parameter class (thanks to run-time typing)
  • The p_source property of the ChangeEvent class is now a Parameter, not an Object
The changes made should make coding Flash interop simpler, more flexible, and (if handled properly) slightly faster. It also increases the legibility of your code imo. The altered classes are available as a shared file on my Google Drive. Please feel free to send me a message with questions, comments, or criticism - I don't believe there are any bugs left, but will happily fix any that pop up.

Happy coding!

Re: AS3 - Extended resolumeCom package

Posted: Wed Apr 02, 2014 23:10
by Conduit
A heavily revised version of the resolumeCom package is now available from my Google Drive. Please note that this revision is not backwards compatible. It does, however, strip all the slow parts from the package - I've seen noticeable framerate difference in my ActionScript-heavy Flash animations.

This version removes event listeners entirely, relying on embedded properties to retrieve values for the parameters. When a parameter is added to the Resolume class, its name is added to the class as a property - for example:

Code: Select all

var resolume:Resolume = new Resolume();    //create resolume instance
resolume.addFloatParameter('foo', 0);      //add float parameter 'foo'
resolume.addStringParameter('bar', '');    //add string parameter 'bar'
resolume.foo;                              //call the current value of 'foo'
resolume.bar                               //call the current value of 'bar'
As always, feel free to PM me if anything comes up.

Re: AS3 - Extended resolumeCom package

Posted: Wed Apr 29, 2015 05:35
by robksawyer
Wanted to let you know that I moved this to Github. Haven't had a chance to mess around with it extensively yet, but it looks like some nice work and I want to ensure that it stays alive. Thanks!

https://github.com/robksawyer/resolumeCom

Re: AS3 - Extended resolumeCom package

Posted: Wed Apr 29, 2015 19:17
by Conduit
I don't know if I'll be of much help if you plan on developing/refining it further. I'd been using AS3 as a means to learn object oriented programming, and most of my dev work since then is in C/C++, C#, and Python. Truth told, I barely remember AS3's syntax any more... I do appreciate the accreditation on the GitHub repository, though; it's nice to my early programming work alive and kicking in some capacity. Happy coding!