# Setting movieclip width from an array value

**URL:** <https://forum.kirupa.com/t/setting-movieclip-width-from-an-array-value/280080>\
**Category:** flash\
**Created:** [January 22, 2009, 12:20pm UTC](https://forum.kirupa.com/t/setting-movieclip-width-from-an-array-value/280080 "2009-01-22T12:20:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AgentOrange](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@AgentOrange](https://forum.kirupa.com/u/AgentOrange)\
**Post date:** [January 22, 2009, 12:20pm UTC](https://forum.kirupa.com/t/setting-movieclip-width-from-an-array-value/280080/1 "2009-01-22T12:20:57Z")

</div>

Hi guys and gals,

I’m having trouble defining the width of an mc based on an entry in an array.

Here’s what I have…

var arr\_obama:Array = new Array();  
arr\_obama[0] = {Name:“mc\_obama1” , Frame:“obama1”, Width:“34”};  
arr\_obama[1] = {Name:“mc\_obama2” , Frame:“obama2”, Width:“143”};  
arr\_obama[2] = {Name:“mc\_obama3” , Frame:“obama3”, Width:“23”};

var len:Number = arr\_obama.length;

for (var n = 0; n \< len; n++)  
{ nme = arr\_obama[n].Name;  
frm = arr\_obama[n].Frame;  
wdth = arr\_obama[n].Width;  
rollover(nme,frm,wdth);  
rollout (nme,frm);  
}

function rollover(nme,frm,wdth)  
{  
\_root[nme].onRollOver = function()

{\_root.mc\_bar.\_width=\_root[wdth];  
\_root.gotoAndStop([frm]);  
this.gotoAndStop(2);

}}

Basically what I want is when you rollover the mc obamaxx it makes the mc\_bar the width as defined in the Width entry in the array.

Any ideas why this isn’t working?

Best  
Steve
