Best way of using a Signal to transmits a lot of data?

24 views
Skip to first unread message

damien

unread,
May 15, 2011, 5:14:13 AM5/15/11
to as3-signals
I'm fairly new in using AS3 Signals, what would be the best approach
to use a Signal to transmit a lot of data?

For example I have a ResourceEvent used to load files that transmits
several information like bytes loaded, bytes total, percent, status
message etc. Would it be a good idea to extend the Signal class and
add my own stuff to the sub class or is there another more elegant way
to do this with AS3 Signals?


Small side-question: What is the merit of the NativeSignal? As far as
I understand this it just wraps the native event dispatching with a
signal so basically making the event flow just jump through one more
hoop. I think this could be fine for decoupling native event code but
it also would be a step backwards if performance is important.

simon

unread,
May 16, 2011, 4:42:44 AM5/16/11
to as3-signals
I think the best way to answer your question would be to make a series
of test cases/benchmarks. Having said that I do think that instead of
passing data around, pass the index (to the position in an Array/
Vector/DataCollection/etc) instead of the whole data set. I would
think this would be the most efficient way to do such things. Could be
wrong, so be worth testing.

NativeSignal: if you're going to go and use signals it's best to keep
a consistent API though out your code base. If performance is critical
for your application, test on the device before removing or changing.
Try not to pre-optimise as it can make development a lot harder in the
long run.

Jos Yule

unread,
May 15, 2011, 2:43:38 PM5/15/11
to as3-signals

Wrap all that data into a VO, and pass the VO in the signal is an
option. Since you are using Signals, that VO should be a strongly
typed class.

j

damien

unread,
May 16, 2011, 9:18:43 AM5/16/11
to as3-signals
Thanks for the answers! The data isn't necessarily in an Array or
Vector etc. just several properties that are in the custom event
class. A VO is the way to go then!

Robert Penner

unread,
May 17, 2011, 4:41:10 AM5/17/11
to as3-signals
Even you were sending a huge Array, you're only sending the reference
through the Signal.

"Size matters not." -- Yoda

Robert
Reply all
Reply to author
Forward
0 new messages