That's because the data hasn't loaded yet. Loading external assets is 
asynchronous, so it takes time for them to load.
How long it takes depends on how large the data is and how slow/fast your 
connection is.

To determine when external assets have loaded and are available an event 
mechanism is your best option.
loadVariables and loadVariablesNum don't have such an event mechanism and 
therefor you should no longer use them (unless you're 
publishing to Flash 5).

With Flash 6 a new class was introduced to handle loading external assets, 
LoadVars, which has an event mechanism (onLoad/onData).

http://livedocs.adobe.com/flash/8/main/00002323.html
http://livedocs.adobe.com/flash/8/main/00002331.html

Try the following (not tested):

import mx.utils.Delegate;

var _lv:LoadVars = new LoadVars();

function loadvarsLoadHandler(success:Boolean):Void {
    trace("Application ::: loadvarsLoadHandler");
    trace("    - success: "+success);
    trace("    - myVars: "+ _lv.myVars.split(","));
}

this._lv.onLoad = Delegate.create(this, this.loadvarsLoadHandler);
this._lv.load("FlashMenuLoader.asp");


// asp return value (note there's no spaces between words, just the comma):
&myVars=Corporate,Fund of Funds,Single Manager Funds,Perfomance,Client 
Services&dummy=


regards,
Muzak


----- Original Message ----- 
From: "Claudio M. E. Bastos Iorio" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2007 1:04 PM
Subject: [Flashcoders] String to array


> Sorry for the question, I found some examples on google but I still cannot
> figure out what's worng with my code. I hope you guys can help me.
>
> My original array was:
> var mm_array:Array = ["Corporate", "Fund of Funds",  "Single Manager Funds",
> "Perfomance", "Client Services"];
>
> Now I want to load those values from an .asp file. My asp returns a string
> like:
> mivariable=Corporate, Fund of Funds, Single Manager Funds, Perfomance,
> Client Services
>
> So, Im trying this:
> loadVariablesNum("FlashMenuLoader.asp", 0, "GET");
>
> var mm_array = mivariable.split(",");
>
>
> But I'm getting an undefined value. What's wrong?
>
> Thanks in advance.
>


_______________________________________________
[EMAIL PROTECTED]
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

Reply via email to