Macromedia Flash Server - OT - Actionscript difference when debugging

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > November 2005 > OT - Actionscript difference when debugging





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author OT - Actionscript difference when debugging
Johnny Zen

2005-11-02, 8:45 pm

Hi all

I've come across a strange problem.

This code:

var cl_id =3D so.data.order[i];

var somevar =3D somefunction(cl_id)


function somefunction(id) {

returns answer(id)

}

When I run the code, the function returns undefined, but if I flag the
function in debugger, it works?

Any ideas?


Johnny

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

John Grden

2005-11-02, 8:45 pm

I'm not sure what you're trying to do (what is answer? is it a method?).
Have you tried function.apply?

var answer:Array =3D new Array("john", "sally", "frank");
function somefunction(id)
{
return answer[id];
}

var somevar =3D function() { return somefunction.apply(this, arguments); }

trace(somevar(0));

Just a stab in the dark, but this code works.

Hth,

On 11/2/05, Johnny Zen <johnnyzen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hi all
>
> I've come across a strange problem.
>
> This code:
>
> var cl_id =3D so.data.order[i];
>
> var somevar =3D somefunction(cl_id)
>
>
> function somefunction(id) {
>
> returns answer(id)
>
> }
>
> When I run the code, the function returns undefined, but if I flag the
> function in debugger, it works?
>
> Any ideas?
>
>
> Johnny
>
> -----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> -----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>




--
John Grden - Blitz

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Gerald (Woody) Chastain

2005-11-03, 5:45 pm

Do you have a missing semi-colon?

-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of Johnny Zen
Sent: Wednesday, November 02, 2005 6:38 PM
To: FlashComm Mailing List
Subject: [FlashComm] OT - Actionscript difference when debugging

Hi all

I've come across a strange problem.

This code:

var cl_id = so.data.order[i];

var somevar = somefunction(cl_id)


function somefunction(id) {

returns answer(id)

}

When I run the code, the function returns undefined, but if I flag the
function in debugger, it works?

Any ideas?


Johnny

=---------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=---------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Johnny Zen

2005-11-03, 5:45 pm

Resolved this problem.

The problem was due to onSync refreshing before function was executing.

so all fixed now

Thanks for the help

=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com