0

I have the following issue related to how can i create an Object varible from a String name.

var obj_product:Object              = new Object;
obj_product.product                 = producto.nombre_producto;
obj_product.products_proveedorID    = product.ID;
obj_product.productID               = product.productID;
obj_product.price                   = 0;

if ( _extra_headers.length > 0 && _extra_headers[0].length > 0)
    for (var index:int=0; index < _extra_headers.length; index++ )
        obj_product._extra_headers[index] = 0;

_extra_headers is an Array where I hold new header names in the Datagrid, so for every new name I need to create its variable within the object.

Whats should I do?

0

1 Answer 1

3

I'm not an ActionScript programmer, but on the assumption that it's close enough to JavaScript, replace the last line with this:

obj_product[_extra_headers[index]] = 0
Sign up to request clarification or add additional context in comments.

Comments

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.