Thanks Jason and Juan,
I tested it out and the splicing works really well. One thing I'm noticing
is when I uncomment and add another index, I get a compile error. I messed
with the splice index number, but received unsuccessful results. Any
thoughts on this?

var workData:Array = new Array();

//workData.push({pm:"Bob", resource:"Anthony", client:"Microsoft",
role:"Developer", job:"XXX-XXXX",  totalHours:40});
workData.push({pm:"Dan", resource:"Anthony", client:"Microsoft",
role:"Developer", job:"XXX-XXXX", totalHours:50});
workData.push({pm:"Bob", resource:"Anthony", client:"Microsoft",
role:"Developer", job:"XXX-XXXX", totalHours:30});
workData.push({pm:"Dan", resource:"Anthony", client:"Microsoft",
role:"Developer", job:"XXX-XXXX", totalHours:50});
trace(workData);
// for each item in the array
for ( var i = workData.length - 1; i >= 0; i-- ){
     // compare to all other array elements
     for ( var j = workData.length - 1; j >= 0; j-- )
     {
         if ( workData[i].pm ==  workData[j].pm && i != j)
         {
            for ( var props in workData[i] )
            {
                workData[i][props] = workData[j][props];
            }
            trace("index: " + j
                  );
            workData.splice(j, 1);
         }
     }
}
trace(workData);

>
> Message: 5
> Date: Fri, 9 May 2008 18:13:04 -0300
> From: "Juan Pablo Califano" <[EMAIL PROTECTED]>
> Subject: Re: [Flashcoders] Data merging problem
> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
> Message-ID:
>        <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1
>
> If you're going to remove elements with a splice, you should loop backwards
> (for var i:Number = array.length - 1;i >= 0; i++), because when you loop
> forward and take out one element, the relative position of the next items
> will change.
>
> Cheers
> Juan Pablo Califano
>
>
> 2008/5/9, Jason Van Pelt <[EMAIL PROTECTED]>:
> >
> > This is untested so it may need a bit of tweaking, but you could do
> > something like this:
> >
> > // for each item in the array
> > for(var i = 0; i < workData.length; i++){
> >
> >      // compare to all other array elements
> >      for(var j = 0; j < workData.length; j++){
> >
> >            // do your comparison(s), making sure not to compare to itself
> >            if(workData[i].pm == workData[j].pm && i != j){
> >
> >                  // overwrite the propeties of the first element with the
> > properties of the second
> >                  for(var props in workData[i]){
> >                        workData[i][props] = workData[j][props];
> >                  }
> >
> >                  workData.splice(1,j);
> >            }
> >      }
> > }
> >
> >
> > Things to consider--
> > Will all elements in your array have the same properties?
> > Do you need more logic involved in figuring out which properties should
> be
> > the ones to keep?
> >
> >
> > Jason Van Pelt
> > Interactive Developer
> > 504.210.1232 (p) / 504.581.2731 (f)
> > Peter A. Mayer Advertising, Inc.
> > www.peteramayer.com
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 9 May 2008 18:31:08 -0400 (EDT)
> From: "Dave Segal" <[EMAIL PROTECTED]>
> Subject: [Flashcoders] as3 namespace question
> To: <flashcoders@chattyfig.figleaf.com>
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain;       charset="us-ascii"
>
> I posted about this before and didn't receive and answer but it is still
> causing me issues so I am trying again. I need to load an swf from one
> server that is a member of some class. For example:
>
>
>
> http://server1.mydomain.com/load_me.swf that uses the Document class
> "com.mydomain.componet.LoadMe.as".
>
>
>
> I want to be able to load this swf from a different server, say
> http://server2.mydomain.com/load_stuff.swf, and cast it to a LoadMe when
> it is done loading. Should this work? I keep getting errors when trying to
> cast in the init handler.
>
>
>
>
>
> import com.mydomain.componet.LoadMe;
>
>
>
> var _req:URLRequest = new
> URLRequest("http://server1.mydomain.com/load_me.swf";);
>
> var _ldr:Loader = new Loader();
>
> var _context:LoaderContext = new LoaderContext();
>
> _context.securityDomain = SecurityDomain.currentDomain;
>
> _context.applicationDomain = ApplicationDomain.currentDomain;
>
> _ldr.contentLoaderInfo.addEventListener(Event.INIT, initHandler, false, 0,
> true);
>
> _ldr.load(_req, _context);
>
>
>
>
>
> private function initHandler($event:Event) () {
>
>                var _lm:LoadMe = LoadMe(_ldr.content);
>
> }
>
>
>
>
>
> ------------------------------
>
> Message: 7
> Date: Fri, 9 May 2008 20:19:51 -0300
> From: "Juan Pablo Califano" <[EMAIL PROTECTED]>
> Subject: Re: [Flashcoders] as3 namespace question
> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
> Message-ID:
>        <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1
>
> I have not tryed this, but check this:
>
> http://livedocs.adobe.com/flex/201/langref/flash/display/LoaderInfo.html
>
>
> "Because the instance of the main class of the SWF file has no Loader
> object, the loaderInfo property is the only way to access the LoaderInfo
> for
> the instance of the main class of the SWF file."
>
> Perhaps this means you have to do something like:
>
> private function initHandler($event:Event) () {
>
>               var _lm:LoadMe = LoadMe(_ldr.loaderInfo.content);
>
> }
>
>
> Cheers
> Juan Pablo Califano
>
>
>
>
>
> 2008/5/9, Dave Segal <[EMAIL PROTECTED]>:
> >
> > I posted about this before and didn't receive and answer but it is still
> > causing me issues so I am trying again. I need to load an swf from one
> > server that is a member of some class. For example:
> >
> >
> >
> > http://server1.mydomain.com/load_me.swf that uses the Document class
> > "com.mydomain.componet.LoadMe.as".
> >
> >
> >
> > I want to be able to load this swf from a different server, say
> > http://server2.mydomain.com/load_stuff.swf, and cast it to a LoadMe when
> > it is done loading. Should this work? I keep getting errors when trying
> to
> > cast in the init handler.
> >
> >
> >
> >
> >
> > import com.mydomain.componet.LoadMe;
> >
> >
> >
> > var _req:URLRequest = new
> > URLRequest("http://server1.mydomain.com/load_me.swf";);
> >
> > var _ldr:Loader = new Loader();
> >
> > var _context:LoaderContext = new LoaderContext();
> >
> > _context.securityDomain = SecurityDomain.currentDomain;
> >
> > _context.applicationDomain = ApplicationDomain.currentDomain;
> >
> > _ldr.contentLoaderInfo.addEventListener(Event.INIT, initHandler, false,
> 0,
> > true);
> >
> > _ldr.load(_req, _context);
> >
> >
> >
> >
> >
> > private function initHandler($event:Event) () {
> >
> >                var _lm:LoadMe = LoadMe(_ldr.content);
> >
> > }
> >
> >
> >
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
>
>
> ------------------------------
>
> Message: 8
> Date: Sat, 10 May 2008 15:09:58 +0200
> From: "jonathan howe" <[EMAIL PROTECTED]>
> Subject: Re: [Flashcoders] Undefined property in one fla, but not in
>        the other.
> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
> Message-ID:
>        <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=UTF-8
>
> Here's my guess:
> The classpath in your work fla is incorrect or the linkage is not actually
> pointing to the original PilotBase.
> Sounds like you copied the symbol, instantiated it, but Flash is using it's
> self-created constructor for a symbol in the library. I would go into the
> linkage properties for the symbol and verify that the path to the class is
> correct (with the little green check). Otherwise, you're just getting the
> "automatically generated in the SWF upon file export" version, which still
> extends movie clip (thus otherwise behaves normally), but lacks your new
> properties.
>
> -jonathan
>
>
> On Thu, May 8, 2008 at 11:43 PM, Chris <[EMAIL PROTECTED]> wrote:
>
> > I have a movie clip symbol 'Pilot', extending a class 'PilotBase'. The
> > movie
> > clip has three clips inside, gX, gY, gZ. I have a class that extends
> > MovieClip. I copy the symbol from the demo fla to the work fla and flash
> > complains:
> >
> > 1120: Access of undefined property gX.�
> > ...
> > ...
> >
> > The clip instance exists. If I copy the symbol into another empty fla, it
> > works fine. I cannot understand why it bombs out in the fla that I need
> to
> > copy it to. Any ideas?
> > Thanks
> > C
> >
> > _______________________________________________
> > Flashcoders mailing list
> > Flashcoders@chattyfig.figleaf.com
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> >
>
>
> --
> -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
>
> ------------------------------
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
> End of Flashcoders Digest, Vol 8, Issue 11
> ******************************************
>



-- 
Anthony Cintron
Flash || Flex Developer
Blog - http://codegasm.blogspot.com/
Portfolio - http://www.sweetiesandgangsters.com
[EMAIL PROTECTED]
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to