Re: [Flashcoders] object passed to function has values undefined

2009-02-02 Thread Matt McKeon
Hi,

I'll try to break the problem out, but its pretty embedded in our code.
So I'm not sure the problem will follow out of this context.
I did however find out that passing primitives such as a string or int
into the second function works fine, but objects won't work.

Any suggestions, even shots in the dark are most welcome.
Thanks!

Hans Wichman wrote:
> Hi,
>
> can you reproduce the problem and put up some fla for download for us to
> test?
>
> greetz
> JC
>
> On Fri, Jan 30, 2009 at 10:07 PM, Matt McKeon  wrote:
>
>   
>> Hi all,
>>
>> I've got some code in AS2, and a function that has one parameter of type
>> Object. That function gets called from a callback function from an
>> event; basically its just passing along the object.
>>
>> The crazy thing is in the callback function I can loop through the
>> object parameter and see all the properties and values, but in the other
>> function looping through the object only displays the property names and
>> *not* the values (values all say "undefined"). Very bizarre.
>>
>> // in class A
>> // this is the callback for an event
>> // say o is the object:
>> var o:Object = {}
>> o.param1 = 'val1';
>> o.param2 = 'val2';
>>
>> public function onObjectReceivedHandler(o:Object) : Void  {
>>// this prints the object with all values
>>for(var d in o) {
>>trace(d + " :: " + o[d]);
>>}
>>
>>mc.classb.testobjectparam(o);
>>}
>> }
>>
>> // in class B
>> public function testobjectparam(myobj:Object) : Void {
>>// this only prints the property name, no value
>>for(var d in myobj) {
>>trace(d + " :: " + myobj[d]);
>>}
>> }
>>
>> Both classes extend MovieClip and are in separate SWF's. So class B is
>> in a dynamically loaded SWF if that makes any difference.
>>
>> Has anyone seem something like this happen? I'm hitting my head here and
>> not sure what to try next. Any advice would be great!
>>
>> Thanks.
>> 
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] object passed to function has values undefined

2009-01-30 Thread Matt McKeon
Hi all,

I've got some code in AS2, and a function that has one parameter of type
Object. That function gets called from a callback function from an
event; basically its just passing along the object.

The crazy thing is in the callback function I can loop through the
object parameter and see all the properties and values, but in the other
function looping through the object only displays the property names and
*not* the values (values all say "undefined"). Very bizarre.

// in class A
// this is the callback for an event
// say o is the object:
var o:Object = {}
o.param1 = 'val1';
o.param2 = 'val2';

public function onObjectReceivedHandler(o:Object) : Void  { 
// this prints the object with all values
for(var d in o) {
trace(d + " :: " + o[d]);
}
 
mc.classb.testobjectparam(o);  
}
}

// in class B
public function testobjectparam(myobj:Object) : Void {
// this only prints the property name, no value
for(var d in myobj) {
trace(d + " :: " + myobj[d]);
}
}

Both classes extend MovieClip and are in separate SWF's. So class B is
in a dynamically loaded SWF if that makes any difference.

Has anyone seem something like this happen? I'm hitting my head here and
not sure what to try next. Any advice would be great!

Thanks.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders