Macromedia Flash Server - Split help

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > April 2005 > Split help





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 Split help
Simon Lord

2005-04-07, 5:50 pm

Morning, I'm passing a shared object back to a flash client but I am
having trouble with the data:

function executeEvent(playSession) {
_root.playhead.text = playSession;
// split the instruction out into an array
var evtexe = new Array();
evtexe = playSession.split();
<etc etc>

.... when I dump playSession to the field var it display the data
correctly. It looks something like this:

simon,27,3,loadProxy

.... however when I create a new array and try to dump it in there
everything comes back undefined. For instance, if after running the
code above I were to run a trace:

trace(evtexe[1]);

.... it comes back "undefined".

Am I just having a brain fart morning? I don't recall ever having
problems like this creating a simple array.

Sincerely,
Simon


=-----------------------------------------------------------
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

Simon Lord

2005-04-07, 5:50 pm

Yeah, brain fart:

FROM: evtexe = playSession.split();
TO: evtexe = String(playSession).split(",");

.... now it works. Someone let me know if I've just done something
horrible. At least it works... :P


On Feb 25, 2005, at 11:21 AM, Simon Lord wrote:

> Morning, I'm passing a shared object back to a flash client but I am
> having trouble with the data:
>
> function executeEvent(playSession) {
> _root.playhead.text = playSession;
> // split the instruction out into an array
> var evtexe = new Array();
> evtexe = playSession.split();
> <etc etc>
>
> ... when I dump playSession to the field var it display the data
> correctly. It looks something like this:
>
> simon,27,3,loadProxy
>
> ... however when I create a new array and try to dump it in there
> everything comes back undefined. For instance, if after running the
> code above I were to run a trace:
>
> trace(evtexe[1]);
>
> ... it comes back "undefined".
>
> Am I just having a brain fart morning? I don't recall ever having
> problems like this creating a simple array.
>
> Sincerely,
> Simon
>
>
> =-----------------------------------------------------------
> 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
>
>

Sincerely,
Simon


=-----------------------------------------------------------
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

Dario De Agostini

2005-04-07, 5:50 pm

Dear Simon,

> function executeEvent(playSession) {
> _root.playhead.text = playSession;
> // split the instruction out into an array
> var evtexe = new Array();
> evtexe = playSession.split();



maybe this is a stupid question, but shouldn't you specify split separator ?
> evtexe = playSession.split();

should be
evtexe = playSession.split(",");

does it default separator to ',' ?

Dario De Agostini


=-----------------------------------------------------------
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

actionscriptcoder

2005-04-07, 5:50 pm

I think it defaults to ","

You dont need to create the array first though .split will do that for
you, I'm guessing that your string has forgotten that it is a string,
try this:

function executeEvent(playSession) {
_root.playhead.text = playSession;
// split the instruction out into an array
var evtexe = (""+playSession).split();
<etc etc>


A

=-----------------------------------------------------------
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

Jake Hilton

2005-04-07, 5:50 pm

You should only have to do something like this:

evtexe =3D playSession.split(",");

You don't even have to declare evtexe as an array first. Is playSession a =
comma delimited string you're passing in?

Jake


Yeah, brain fart:

FROM: evtexe =3D playSession.split();
TO: evtexe =3D String(playSession).split(",");

.... now it works. Someone let me know if I've just done something=20
horrible. At least it works... :P


On Feb 25, 2005, at 11:21 AM, Simon Lord wrote:
[vbcol=seagreen]
> Morning, I'm passing a shared object back to a flash client but I am=20
> having trouble with the data:
>
> function executeEvent(playSession) {
> _root.playhead.text =3D playSession;
> // split the instruction out into an array
> var evtexe =3D new Array();
> evtexe =3D playSession.split();
> <etc etc>
> =09
> ... when I dump playSession to the field var it display the data=20
> correctly. It looks something like this:
>
> simon,27,3,loadProxy
>
> ... however when I create a new array and try to dump it in there=20
> everything comes back undefined. For instance, if after running the=20
> code above I were to run a trace:
>
> trace(evtexe[1]);
>
> ... it comes back "undefined".
>
> Am I just having a brain fart morning? I don't recall ever having=20
> problems like this creating a simple array.
>
> Sincerely,
> Simon
>
>
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com=20
> =3D-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailma...fo/flashcomm=20
>
>

Sincerely,
Simon


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

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

Simon Lord

2005-04-07, 5:50 pm

> You don't even have to declare evtexe as an array first. Is
> playSession a comma delimited string you're passing in?


Yes, and I take the the components of that array and use them in
various functions. Seems to work now so I'll leave it as is until I'm
smart enough to figure out what's really going on... :P

>
> Jake
>
>
> Yeah, brain fart:
>
> FROM: evtexe = playSession.split();
> TO: evtexe = String(playSession).split(",");
>
> ... now it works. Someone let me know if I've just done something
> horrible. At least it works... :P
>
>
> On Feb 25, 2005, at 11:21 AM, Simon Lord wrote:
>
> Sincerely,
> Simon
>
>
> =-----------------------------------------------------------
> 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
>
>

Sincerely,
Simon


=-----------------------------------------------------------
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