using 'adding data to arraycollection'

cjsteury
cjsteury used Ask the Experts™
on
I am writing a class with a functioun as specified but can't seem to find the right staetment to import to use getitemat() function keep getting message....

I am using flex 3

1061: Call to a possibly undefined method addItemAt through a reference with static type Class.      VT2/src/com/steury/baseClasses      CombAC.as      line 22      1248117854154      1456

// ActionScript file
package com.steury.baseClasses
{
	import DTO.Exits.*;
	import DTO.OrdExt.*;
	import mx.collections.IList;
	import mx.collections.*;
	import mx.collections.ICollectionView;
	import mx.collections.ListCollectionView;
	import mx.collections.ArrayCollection;
		
	public class CombAC extends ArrayCollection
	{	
		public function CombAC()
		{	
			var curExtObj:Object;
			var curOrdExtObj:Object;
 
			for each( curExtObj in Exits ) {
   				for each( curOrdExtObj in OrdExt ) {
      				if( curExtObj.Ticker == curOrdExtObj.Ticker ) {
         				Exits.addItemAt( curOrdExtObj, Exits.getItemIndex(curExtObj) + 1 );
     					}
     				}
   				}
   		}
	}
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You are using the static methods on the Exits object and I think the addItemAdd is not static, that means you need to create an instance of Exits to use this function.

Sorry, I don't know the Exits object but try to do the following:




// ActionScript file
package com.steury.baseClasses
{
        import DTO.Exits.*;
        import DTO.OrdExt.*;
        import mx.collections.IList;
        import mx.collections.*;
        import mx.collections.ICollectionView;
        import mx.collections.ListCollectionView;
        import mx.collections.ArrayCollection;
                
        public class CombAC extends ArrayCollection
        {       
                public function CombAC()
                {       
                        var curExtObj:Object;
                        var curOrdExtObj:Object;
                        var myex: Exits;
 
                        for each( curExtObj in myex ) {
                                for each( curOrdExtObj in OrdExt ) {
                                if( curExtObj.Ticker == curOrdExtObj.Ticker ) {
                                        myex.addItemAt( curOrdExtObj, myex.getItemIndex(curExtObj) + 1 );
                                        }
                                }
                                }
                }
        }
}

Open in new window

Author

Commented:
This was the answer I think but I can't remember exactly this was a while ago.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial