Same issue here,

As a moderator of the flexcomponent mailing list, PLEASE do not cross post
on flexcoders and flexcomponents.

I guarantee you half your questions will not be answered when you do this.

If it is a component question dealing with the framework ask on flex
components, if it is anything other ask on flexcoders.

Peace, Mike

On 2/8/07, xmrcivicboix <[EMAIL PROTECTED]> wrote:

  Hi folks. I'm a novice at flex/as3. I ran into this scoping problem. I
want to find a way to store all the data I retrieve into a static class
member and access where ever and whenever I like. However, it seems as
if the static member is not in scope. Here are my codes

----------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" creationComplete="init()">

<mx:Style source="css/stylesheet.css"/>


<mx:Script>
<![CDATA[
import com.UserDataRequest;
import com.UserData;

private var request:UserDataRequest;

private function init(): void
{
request = new UserDataRequest("data.xml");
trace(UserData.userInfo);
}
]]>
</mx:Script>
</mx:Application>

UserDataRequest.as
----------------------------------------------------------
package com
{
import mx.rpc.http.HTTPService;
import mx.rpc.events.ResultEvent;
import com.UserData;
import mx.collections.ArrayCollection;
import mx.rpc.events.FaultEvent;

public class UserDataRequest extends HTTPService
{
public function UserDataRequest(URL:String)
{
super(URL);
this.url = URL;
this.resultFormat = "e4x";
this.addEventListener(ResultEvent.RESULT, resultListener);
this.addEventListener(FaultEvent.FAULT, faultLister);
this.send();
}

public function faultLister(event:FaultEvent): void
{
trace(event.fault.message);
}

public function resultListener(event:ResultEvent): void
{
UserData.userInfo = (event.result.user) as ArrayCollection;
}
}
}

UserData.as
----------------------------------------------------------
package com
{
import mx.collections.ArrayCollection;

public class UserData
{
public static var userInfo:ArrayCollection = new
ArrayCollection;

public function UserData(){}

}
}




--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to