salim_designer
06-28-2007, 12:33 PM
I can not understand why a simple array.push method is not working
Here is my code;
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Repeater class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private var dp:Array = ["1", "2"];
[B] dp.push("3");
]]>
</mx:Script>
<mx:Panel title="Repeater Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Text width="100%" color="blue"
text="Use the Repeater class to create 9 Button controls in a 3 by 3 Tile container."/>
<mx:Tile direction="horizontal" borderStyle="inset"
horizontalGap="10" verticalGap="15"
paddingLeft="10" paddingTop="10" paddingBottom="10" paddingRight="10">
<mx:Repeater id="rp" dataProvider="{dp}">
<mx:Button height="49" width="50"
label="{String(rp.currentItem)}"
click="Alert.show(String(event.currentTarget.getRepeaterI tem()) + ' pressed')"/>
</mx:Repeater>
</mx:Tile>
</mx:Panel>
</mx:Application>
I am getting the error:
1120: Access of undefined property dp.
Here is my code;
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Repeater class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private var dp:Array = ["1", "2"];
[B] dp.push("3");
]]>
</mx:Script>
<mx:Panel title="Repeater Example" width="75%" height="75%"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Text width="100%" color="blue"
text="Use the Repeater class to create 9 Button controls in a 3 by 3 Tile container."/>
<mx:Tile direction="horizontal" borderStyle="inset"
horizontalGap="10" verticalGap="15"
paddingLeft="10" paddingTop="10" paddingBottom="10" paddingRight="10">
<mx:Repeater id="rp" dataProvider="{dp}">
<mx:Button height="49" width="50"
label="{String(rp.currentItem)}"
click="Alert.show(String(event.currentTarget.getRepeaterI tem()) + ' pressed')"/>
</mx:Repeater>
</mx:Tile>
</mx:Panel>
</mx:Application>
I am getting the error:
1120: Access of undefined property dp.