Hi there (whoever you are!)
Your problem is that the [1,2,3] initialiser syntax is actually a
short cut for creating a new Array() object, not an ArrayExtension().
So you're replacing the object you just created with new().
What you need to do is to _modify_ your ArrayExtension() object, not replace it.
If you try:
var myArray:ArrayExtension = new ArrayExtension();
myArray.push("Hello");
myArray.push("Goodbye");
myArray.push("World");
That should sort your problem.
HTH,
Ian
On 4/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have created a Class that extends Array, called ArrayExtension. The only
> way that I have found to add
> values to this is array is in the following manner:
>
> -----------------------
> // CODE
> import com.ArrayExtension
>
> var myArray:ArrayExtension = new ArrayExtension("Hello","GoodBye","World")
>
>
> //CLASS
> class com.ArrayExtension extends Array
> {
>
> public function ArrayExtension()
> {
> super()
> for(var i=0; i< arguments.length; i++)
> push(arguments[i])
>
> }
>
> }
> -----------------------
>
> The problem I am running into is if I want to add values to the array after
> initializing it, I get an error message.
> Here is an example:
>
> -----------------------
>
> var myArray:ArrayExtension = new ArrayExtension;
>
> myArray = ["Hello","GoodBye","World"]
>
> -----------------------
>
> How can I add values to the array without generating an error?
>
> Thanks for any and all replies.
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com