function mapper needs to return an element of the new vector. In this case, the vector is a vector of uint, so the mapper function needs to return a uint, not a Vector. This makes sense because mapper is called for every item in g. Say you wanted to populate h with the squares of each element in g, you would return item * item.


On 8/19/2011 9:00 AM, wrote:
Message: 3
Date: Fri, 19 Aug 2011 08:36:30 -0400
From: "Mendelsohn, Michael"<>
Subject: RE: [Flashcoders]
To: ""<>, Flash
        Coders List     <>
Content-Type: text/plain; charset="us-ascii"

You're right Kenneth.

var g:Vector.<uint>  = Vector.<uint>([1,2,3,4,5]);
var hh:Vector.<uint>  = g.slice();
var h:Vector.<uint>  =;
var a = 5;
function mapper(item:uint,ind:uint,g:Vector.<uint>):Vector.<uint>{
        return g;

In this case, hh returns the vector, and h still returns null.

- MM

-----Original Message-----
From: Kenneth Kawamoto []
Sent: Thursday, August 18, 2011 5:15 PM
To: Flash Coders List
Cc: Mendelsohn, Michael
Subject: Re: [Flashcoders]

What do you get for h?

Kenneth Kawamoto

On 18/08/2011 21:08, Mendelsohn, Michael wrote:
Hi Kenneth...

This is working for me:

var g:Vector.<uint>   = Vector.<uint>([1,2,3,4,5]);
var h:Vector.<uint>   =;
function mapper(item:uint,ind:uint,g:Vector.<uint>):void{

Hope that helps,
- Michael M.

-----Original Message-----
[] On Behalf Of Kenneth Kawamoto
Sent: Thursday, August 18, 2011 9:27 AM
To: Flash Coders List
Subject: [Flashcoders]

Dear coders, is supposed to return a new Vector but it appears to return
nothing (undefined). Is this working for you?

Flashcoders mailing list

Reply via email to