feathersui-starling-sdk
feathersui-starling-sdk copied to clipboard
MXML: add implicit data parameter to code-generated Starling event listeners
Edited by @joshtynjala
A second implicit parameter should be available to MXML events. Just like you can reference an event parameter, data would also be available, and you could optionally pass them both to your listener in the Script block. Example:
triggered="buttonGroup_triggeredHandler(event, data)"
Original Post:
Hey,
I have run into something I haven't tried before and just was wonder if I am missing something or it's just not possible.
Adding an event handler for triggered in MXML, there is no way to get that selectedItem in the dataProvider with a one argument event handler the compiler wants.
<f:ButtonGroup id="buttonGroup" direction="vertical" padding="15" width="300" triggered="buttonGroup_triggeredHandler(event)">
private function buttonGroup_triggeredHandler(event:starling.events.Event, data:Object):void { dispatchEventWith(EVENT_BUTTON_TRIGGERED, false, data); }
I get a; Error:(30, 0) [PackageManager]: Error code: 1136: Incorrect number of arguments. Expected 2.
I am only asking because I thought it might just be one of those things IDEA does but, this is an actual compiler error.
So this seems only possible to do in AS right? If so, is there anyway we could make it work in MXML like above?
Err... I am a freaking idiot, to much work today, disregard this and close, I forgot I was working with a Starling Event anyway and I have the data field on the event, HAHAHA!
This should do the trick:
triggered="buttonGroup_triggeredHandler(event, event.data)"
Ah, yeah ok I forgot that black majic as well, thanks. :)
Still, though, you got me thinking that it might be a good idea to have a second implicit parameter with MXML events. Just like you can reference an event
parameter, data
would also be available, and you could optionally pass them both to your listener in the Script block.
That would take a lot of boiler plate code away, I think it's a good idea.
BTW, I have like 5 apps with 10,000 of lines of code with Feathers and FeathersSDK MXML, rock solid man!!! Rock solid. Planning on releasing some stuff In Jan, I will let you know when I do so you can check the apps out.
That's awesome! I'm glad that Feathers is really working well for you, especially with the SDK. 2.3 is right around the corner, and I added a ton of unit tests and bug fixes, so it'll only become more stable going forward.
Yeah, I have said it many times but this framework is such a joy to work with, I really mean it. In 12+ years of this, I am actually having fun.
Based on the success of these apps money wise, I really hope to get into a contributor role with Feathers and custom component creation like we talked about months ago. Once I am making some money I can really dig in and offer the community some advanced stuff.
Maybe we can even work on getting Falcon working with a future SDK, that is what I am talking about, money == freedom to do more experimental stuff with me. :) I will keep you posted.
I'm planning to promote the transpiler from FlexJS in a big way in the coming months, after FlexJS 0.5 is released. Utilities, tutorials, etc. I hope you'll use some of that freedom to help me further improve the transpiler. :)
Yeah, I wish I could make income with HTML/JS type stuff but right now I only have Caustic and Bitwig DAW stuff which I can't use HTML/JS,I have to be on the native level (UDP messages and C++ native calls).
That is the major reason I haven't been active with FlexJS right now, if there are ever any "consulting" opportunities that come a long in that area for income I am all ears. :)
Super excited about the 2.3 Release Josh. We have a pretty significant app just about be promoted soon completely built with the Feathers SDK. - Very happy with the results and early feedback has been amazing.
Absolute joy to develop with it. Thank you so much.