Re: Re: [Flashcoders] ObjectCopy wackiness

2006-10-13 Thread nelson ramirez

It's really of odd. look at the weird thing that happens with the trace:
check this out:

var A:Object = new Object({banner:0, templateType:sub, dated:false,
cHome:true});
//A.test = TEST A;
var B:Object = new Object();
B.test = mx.utils.ObjectCopy.copy(A);
//B.test = TESTB;
trace( A object :+A);
trace(B.test+ wtf?);
trace(B.test);
for (i in B.test) {
trace(i+inside B.test[i]: +i+ : +B.test[i]);
}


//output
A object :[object Object]
undefined wtf? 
[type Object]
cHomeinside B.test[i]: cHome : true
datedinside B.test[i]: dated : false
templateTypeinside B.test[i]: templateType : sub
bannerinside B.test[i]: banner : 0


How come if you trace a string with it it makes it undefined? i've
never seen trace do that before 0.o

On 10/13/06, Josh Santangelo [EMAIL PROTECTED] wrote:

I've never gotten ObjectCopy to work properly. I've tried using it in
a bunch of different projects and never get anything back but
undefined. I'm not sure why though -- looking at the class, the code
seems sound.

-josh

On Oct 10, 2006, at 7:41p, grimmwerks wrote:

 I've done the dstObj[i] = copy( srcObj[i] );


 Here's the weirdness: the test code:

 tPage = new Object({banner : 0,templateType : sub,dated :
 false,cHome :
 true})
 trace(trace 1:  + tPage);

 tObj = new Object();
 tObj.page = mx.utils.ObjectCopy.copy(tPage);
 trace( trace 2 : page:  + tObj.page);
 for(i in tObj.page){trace(inside tObj.page[i]:  + i +  :  +
 tObj.page
 [i])};


 
 I get this:

 trace 1: [object Object]
 trace 2 : page: undefined
 inside tObj.page[i]: cHome : true
 inside tObj.page[i]: dated : false
 inside tObj.page[i]: templateType : sub
 inside tObj.page[i]: banner : 0


 --

 Now I ask you - how can tObj.page be UNDEFINED when it has
 variables like
 tObj.page.cHome = true?

 I've got an app that I've got these 'screen templates' that on the
 first
 save, they work; but when someone re-opens and re-saves, it kills
 everything. What gives?
 ___
 Flashcoders@chattyfig.figleaf.com
 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


___
Flashcoders@chattyfig.figleaf.com
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


___
Flashcoders@chattyfig.figleaf.com
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


Re: Re: [Flashcoders] ObjectCopy wackiness

2006-10-13 Thread Jim Kremens

Hey,

Darron Schall solved this a while back.  If you replace the first line in
ObjectCopy.copy() with this:

var result:Object = new (Function(refObj.__proto__.constructor))();
it should work.

Jim Kremens



On 10/13/06, nelson ramirez [EMAIL PROTECTED] wrote:


It's really of odd. look at the weird thing that happens with the trace:
check this out:

var A:Object = new Object({banner:0, templateType:sub, dated:false,
cHome:true});
//A.test = TEST A;
var B:Object = new Object();
B.test = mx.utils.ObjectCopy.copy(A);
//B.test = TESTB;
trace( A object :+A);
trace(B.test+ wtf?);
trace(B.test);
for (i in B.test) {
   trace(i+inside B.test[i]: +i+ : +B.test[i]);
}


//output
A object :[object Object]
undefined wtf? 
[type Object]
cHomeinside B.test[i]: cHome : true
datedinside B.test[i]: dated : false
templateTypeinside B.test[i]: templateType : sub
bannerinside B.test[i]: banner : 0


How come if you trace a string with it it makes it undefined? i've
never seen trace do that before 0.o

On 10/13/06, Josh Santangelo [EMAIL PROTECTED] wrote:
 I've never gotten ObjectCopy to work properly. I've tried using it in
 a bunch of different projects and never get anything back but
 undefined. I'm not sure why though -- looking at the class, the code
 seems sound.

 -josh

 On Oct 10, 2006, at 7:41p, grimmwerks wrote:

  I've done the dstObj[i] = copy( srcObj[i] );
 
 
  Here's the weirdness: the test code:
 
  tPage = new Object({banner : 0,templateType : sub,dated :
  false,cHome :
  true})
  trace(trace 1:  + tPage);
 
  tObj = new Object();
  tObj.page = mx.utils.ObjectCopy.copy(tPage);
  trace( trace 2 : page:  + tObj.page);
  for(i in tObj.page){trace(inside tObj.page[i]:  + i +  :  +
  tObj.page
  [i])};
 
 
  
  I get this:
 
  trace 1: [object Object]
  trace 2 : page: undefined
  inside tObj.page[i]: cHome : true
  inside tObj.page[i]: dated : false
  inside tObj.page[i]: templateType : sub
  inside tObj.page[i]: banner : 0
 
 
  --
 
  Now I ask you - how can tObj.page be UNDEFINED when it has
  variables like
  tObj.page.cHome = true?
 
  I've got an app that I've got these 'screen templates' that on the
  first
  save, they work; but when someone re-opens and re-saves, it kills
  everything. What gives?
  ___
  Flashcoders@chattyfig.figleaf.com
  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
 

 ___
 Flashcoders@chattyfig.figleaf.com
 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

___
Flashcoders@chattyfig.figleaf.com
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





--
Jim Kremens
___
Flashcoders@chattyfig.figleaf.com
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