0

This question if a bit off topic, I just wanted feedback from most ActionScript/Flex developers out there.

So would you use a Vector. rather than an Array when you're expecting a collection of the same "type" of objects (and publishing for fp10)

Let me clear that out :

I'm defining a method in a class that expects one parameter of type "Array"

Let's say the method's signature looks like this :

public function doSomethingWithChildren(selectedChildren:Array):void;

I'm expecting that all the elements in the "selectedChildren" Array are of type "DisplayObject" (even thought it seems quite logical), so I thought that it would be a bit smarter to re-write this function this way :

public function doSomethingWithChildren(selectedChildren:Vector.<DisplayObject>):void;

So, basically the only thing I'd like to know is if you think this is the way to go

Thanks for yer feedback

2

1 Answer 1

1

yes, this would be the way to go because now you have the extra static type checking and information. I believe typed vectors are also faster than arrays.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Cookie, it's always nice getting someone else's advice

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.