Specifying class properties in MXML elements instead of attributes (e.g. DataGridColumns)

Hi there,
In all the examples I've seen so far, specifying the columns
for a
DataGrid is done as follows:
<mx:DataGrid>
<mx:columns>
<mx:DataGridColumn />
<mx:DataGridColumn />
<mx:columns>
</mx:DataGrid>
However, I'm wonder whether there's a way to express the data
grid
columns simply as an _attribute_ value on the
<mx:DataGrid> element?
If not, does anybody know of an explanation of the syntax for
setting
class properties when they are not set as attributes?
For example, since "columns" is a property of the DataGrid
class, but
it is set via an XML element, and not via an XML attribute, I
would
assume you can do something similar for other properties.
However, I
can't seem to find official documentation on this in the Flex
3
Language Reference.
Joubert

This works:
<mx:Array id="theMXMLColumns">
<mx:DataGridColumn headerText="Column 1" />
<mx:DataGridColumn headerText="Column 2" />
</mx:Array>
<mx:DataGrid id="dg2" columns="{theMXMLColumns}" />
However, the "columns" property of DataGrid must be an array,
and arrays are not bindable, so ActionScript updates to the array
would not be shown. e.g. This will not work:
<mx:Script>
<![CDATA[
import mx.collections.*;
import mx.controls.dataGridClasses.*;
private var theASColumns:Array;
private function doCreationComplete():void{
var dgc:DataGridColumn;
theASColumns = new Array();
dgc = new DataGridColumn();
dgc.headerText = "Column 1";
theASColumns.push(dgc);
dgc = new DataGridColumn();
dgc.headerText = "Column 2";
theASColumns.push(dgc);
]]>
</mx:Script>
<mx:DataGrid id="dg" columns="{theASColumns}" />

Similar Messages

  • Class instantiation through mxml - setting properties

    Hi,
    I'm trying to create a reusable component with an actionscript class.
    I'd like to be able to set a handful of the class' properties withmxml attributes. So far, I've had no success doing so.
    I've subset my problem into a separate, simplied project in an attempt to rule out any of the other parts of the real application interfering with what I'm attempting to accomplish. Unfortunately, my simplified project produces the same result.
    In my example, I'm just trying to set value of the property "myValue."  Can anyone tell me what I'm doing wrong? What am I missing?
    Thanks in advance for any help!
    Main application (TestProj.mxml)
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      minWidth="955" minHeight="600"
                      xmlns:pkg="pkg.*">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <pkg:TestClass myvalue="some value" />
    </s:Application>
    Actionscript class (pkg\TestClass.as)
    package pkg
         import mx.controls.Alert;
         import mx.core.UIComponent;
         public class TestClass extends UIComponent
              private var _myvalue:String;
              public function TestClass()
                   Alert.show("myvalue=" + this._myvalue);     
              public function get myvalue():String
                   return _myvalue;
              public function set myvalue(value:String):void
                   _myvalue = value;

    Hi,
    The property gets set correctly, but the constructor of your class will always execute before the attributes - this is because Flex needs to create the instance and execute the c-tor before it can set the values on the instance.  Instead try something like this:
    <pkg:TestClass id="foo" myvalue="some value" initialize="{Alert.show(foot.myvalue)}" />
    This will execute the Alert.show when the component is being initialized.  If you need to put some init code in the component itself and that code relies on values set in MXML, then you can override UIComponent's public function initialize():void.
    -Evtim

  • How to specify class name in environment or system property

    Hi,
    Iam learning ejb. I was practicing the stateless session bean. I wrote a sample hello world application. While executing the client am getting the following error.
    {color:#ff0000}Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at hw.HelloClient.main(HelloClient.java:20){color}
    My Client program:
    {color:#3366ff}package hw;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.*;
    import java.util.*;
    public class HelloClient {
    public static void main(String[] args)throws Exception {
    Properties prop = System.getProperties();
    Context ctx= new InitialContext(prop); {color:#800000}// {color}{color:#800000}(Line no :20) here only error is pointing{color}
    Object obj = ctx.lookup("HelloHome");
    HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
    Hello hello = home.create();
    System.out.println(hello.hello());
    hello.remove();
    }{color}
    please suggest me a solution.
    note: iam using eclipse ganymede and jboss app server
    Edited by: Arun_ece on Mar 10, 2009 1:13 AM

    Hi,
    You need to create a ejb-jar.xml and jboss.xml files to deploy the application on the servers.
    Also, put these lines of codes after getting System Properties.
    prop.put(Context.PROVIDER_URL, "iiop://localhost:[port_no]");Thanks,
    Srikant

  • Unable to find associated SLD for specified class(SAP_XIIntegration Directory)

    Hi All,
    We have installed PI 7.4  dual stack on windows platform. All Post Installation activities were completed succesfully. I am able to succesfully execute transactions: SLDCHECK, SXMB_ADM (check) etc.
    All RFC connections are also configured properly. SXI_CACHE working fine.
    But when I tried to create a communication channel it gives me following warning message:
    " Unable to find associated SLD element for specified class (source element: SAP_XIIntegrationDirectory "., CreationClassName,SAP_XIIntegrationDirectory,string, Name, directory.sxi.ict-vxi-65,string)target element class: SAP_XIIntegrationServer).
    Please suggest what needs to be done to solve this issue.
    Thanks
    Pawan

    Hi Pawan,
    SAP note #764176  should be applied. Before you do that, apply note #1117249 Incomplete Registration of PI components in SLD.
    Hopefully this will resolve the error.
    Regards,
    Naveen

  • Automation interface for specified class cannot be obtained

    I am trying to use a TestStand UI Expression Edit Control in LabVIEW to undertake an Expression.Evaluation, but I feel I must be missing something. I have a TestStand UI ExpressionEdit Control on the LabVIEW front panel, and when i try to evaluate it, or anything else (properties or methods) for that matter, the error is always the same:
    "Automation Interface for the specified class cannot be obtained. Check if the automation refnum type is the correct class for this operation" Error Code 3008; User defined error code.
    Any help tips or pointers would be appreciated.

    Hi
    To help resolve this issue can you post the VI which gives you this error.
    Regards
    Anand Jain
    National Instruments.

  • Mxml elements inside custom component

    Hi all, i'm a flex newbie but i know AS3, i've encountered a problem during the development of a custom component: my custom component is a panel with some buttons, but i want that anyone can insert mxml elements (especially form elements) inside this panel in this way:
    ActionScript Code:
    <custom:myDialogBox >
       <mx:Form ...>
            <mx:TextInput ...>
    </custom:myDialogBox>
    So i created myDialogBox component:
    ActionScript Code:
    <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Metadata>
                 [DefaultProperty("hboxFirstLine")]
            </mx:Metadata>
        <mx:Script>
            <![CDATA[
                import mx.containers.HBox;
                import mx.containers.Panel;
                import mx.controls.Button;
                import mx.controls.Text;
                import mx.core.UIComponent;
            ]]>
        </mx:Script>
        <mx:HBox id="hboxFirstLine" width="100%">
        </mx:HBox>
        <mx:HBox id="hboxSecondLine" width="100%" horizontalAlign="center">
                    <mx:Button label="Conferma" />
            <mx:Button label="Annulla" />
        </mx:HBox>
        <mx:ControlBar id="controllBar" horizontalAlign="right">       
            <mx:Label id="alertFooter" text="sFooter" />
            </mx:ControlBar>
    </mx:Panel>
    I expect that the form goes inside hboxFirstLine... but instead i get this error:
    Error: In initializer for 'hboxFirstLine': type mx.controls.Form is not assignable to target type mx.containers.HBox. 
    Any idea?

    hboxFirstLine has to be a Form, not an HBox.
    Also, if that is all the code of your component, you don't need import statements.
    HTH.

  • Dynamically extensible class properties

    What is a good way to implement dynamically extensible class properties in java in a typesafe manner? The only way I know is to either instrument the bytecode using BCEL or a similar library or to somehow hack it up using dynamic proxies.
    At runtime, I would somehow magically like for the class/interface to have specific methods (as opposed to general getValue("property_name") kind of methods). Just to give you an idea, this is in reference to value objects, so the exact number of properties shall be determined by the number of database columns.
    My first preference is not to instrument the code for reliability reasons. Is there a clean way to approach this problem?
    Thanks in advance.

    I'm going to start by saying that you should give more
    thought to exactly why you want to do this. Typesafe
    accessor methods provide their greatest benefit at
    compile-time, because the code that invokes them
    expects a certain type. To invoke an accessor method
    at runtime, you have to find its name and expected
    type somewhere, then use reflection, then manage the
    returned value. In my opinion, this provides zero
    benefit over simply retrieving the desired property
    from a Map.If I constructed the source and compiled it on the fly as you suggest, then I wouldn't have the extra reflection overhead and would be typesafe. My only point against Map-based properties is that they are inherently type-unsafe and can be a source of bugs for people that would extend the classes who are not exactly seasoned java programmers.
    So, unless there's some trick that I don't know, you
    have to create your class before it gets loaded. One
    way to do this is with BCEL, of course, but that
    requires that you have a very deep understanding of
    the class file format. A better idea, if you really
    want to create classes at runtime, is to generate code
    and compile it before loading it. This is not terribly
    difficult, nor terribly expensive in terms of runtime
    (look at all the app-servers that do it for JSPs).That is not a bad idea. I could use a custom class-loader to load a specified class from some external defintion and altogether bypass my core (by stub) class that I might or might not package up in the same jar.
    Having said that, are you aware of a java compiler that could be packaged as part of our distribution which is not an OSI project. (LGPL or Apache style license)
    But the question remains: what real benefit do you get
    from doing it?This is to provide a better configuration interface to people that would try to extend the existing business classes with their own properties so they can use them in extensible custom code.
    Thanks.

  • Can We Use Multiple Edgehero Classes On The Same Element?

    Does anyone know if it is possible to add multiple Edgehero classes to the same element? More specifically, I would like to use RotateX and RotateY on a rectangle, but it only seems to do one or the other, adding both classes to the element doesn't make it rotate in both directions.

    Maybe check out the Star Wars demo to see if that would help.
    Rob got the idea from the one I made earlier and here is the code:
    sym.$('gradient').css('background', '-moz-linear-gradient(top, rgba(0,0,0,1) 0%, transparent 100%)');
    sym.$('container').css('-moz-transform-origin', '50% 100%');
    sym.$('container').css('-moz-transform', 'perspective(250px) rotateX(25deg)');
    // Chrome and others
    sym.$('gradient').css('background', '-webkit-linear-gradient(top, rgba(0,0,0,1) 0%, transparent 100%)');
    sym.$('container').css('-webkit-transform-origin', '50% 100%');
    sym.$('container').css('-webkit-transform', 'perspective(250px) rotateX(25deg)');
    // Internet Explorer
    sym.$('gradient').css('background', '-ms-linear-gradient(top, rgba(0,0,0,1) 0%, transparent 100%)');
    sym.$('container').css('-ms-transform-origin', '50% 100%');
    sym.$('container').css('-ms-transform', 'perspective(250px) rotateX(25deg)');
    and the orginal file before edgeHero;
    https://app.box.com/s/068vx5x6lj5t2yydrx17

  • How to change the properties of individulal elements in an array?

    Hi all,
    I have an array (size is 25) of string and I want to disable and grayout half of them. But how do I do it? How do I change the properties of individual elements in an array? I have tried to use some of the examples given in the discussion forums, but it didint work for the task mentioned above. Anybody would be able to help me with a suitable example that can be specifically used for disable or enable the individual array  elements?
    Dev

    Telemaque wrote:
    The user will see the first half of the string elements filled-in and the lower half grayed-out (to be filled in later).  Make a test VI, play around.
    ... except that all elements "greyed out" with this method contain the default string for the array element (blank by default, but changeable). There is no way to have meaningful, unique text in the greyed out elements.
    I would suggest to use a listbox as control/indicator. Here elements can easily be disabled programmatically.
    LabVIEW Champion . Do more with less code and in less time .

  • Access class' properties (in _root) from movieclip timeline?

    I'm trying to follow the advice "class properties are better
    then _global variables", but how could I access a class' properties
    (imported in the main timeline) from a movie Clip timeline?
    this code in the main timeline works (and trace the value of
    lang):
    import scripts.StartupSettings
    trace (StartupSettings.lang);
    but if I try to access the lang property from a movie clip
    timeline, with the same:
    trace (StartupSettings.lang);
    I get traced "undefined".
    The only workaround I have found is to import again the class
    inside the clip, but I would like to avoid it in order to keep
    dimensions small.
    Any idea? thanks

    The import statement doesn't really import anything. It's
    used to not have to call a method using the fully qualified class
    name. So, don't worry about 'dimensions'. And, the import statement
    is only 'valid' on the frame it is defined on. On another frame,
    you have to use the import statement again.

  • Using Primay cost element instead of secondary cost element for expenses tr

    Hai  SAP Guru
    WE are developer company, so when a land is acquired we create the project under business development with nomenclature "BD/LG/01" with  corporate  profit centre linked to it (as we are not sure if the project takes of due to various issues.)
    When the project commences we create another project structure with nomenclature "BE/LG/01u201D  with new profit centre.
    So when we transfer the cost lying in u201C BD u201D  project to u201C BE u201C project by giving settlement profile, the cost get transferred using secondary cost element. when we see the statement through CJI3 report the cost would have get transferred but when we
    see the report through Finance Profit Centre report the cost would have not transferred.
    So in order to get the report in profit centre, can we use primary cost element instead of secondary cost element, if we use the primary cost element what the consequence and what care needs to be taken for settlement.
    Thanks.

    Thanks.

  • Failed to load class properties and qualifiers for class BDD_UsePackage in task sequence. 0x80041002

    Following situation. In SCCM we have one Standalone Primray Site Server and two Site Server. The two site server are also SMS Provider. MDT 2012 was installed on all three Servers and the Config Manager Integration was run. When starting the Console
    on any of this server and editing an MDT Task Sequence, it occasionally pops up an error "An error occured when loading the task sequence". TaskSequenceProvider.log File throws a lot of errors:
    [PID: 2824] Invoking method SMS_TaskSequence.LoadFromXml TaskSequenceProvider 20.06.2012 10:28:50 4916 (0x1334)
    Failed to load class properties and qualifiers for class BDD_UsePackage in task sequence. 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:28:50 4916 (0x1334)
    Failed to load node Use Toolkit Package from XML into WMI 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:28:50 4916 (0x1334)
    Failed to load children steps for node "Applikation" from XML 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:28:50 4916 (0x1334)
    Failed to load children steps for node "" from XML 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:28:50 4916 (0x1334)
    Failed to load XML for the task sequence into WMI 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:28:50 4916 (0x1334)
    [PID: 2824] Done with method SMS_TaskSequence.LoadFromXml TaskSequenceProvider 20.06.2012 10:28:50 4916 (0x1334)
    Tried removing the integration on all SMS Provider Machines and readded them. It does not make a differenence. Does anyone know if MDT supports the use of multiple SMS Providers? When I only use one Provider and deinstall the other two, it works ok.

    Some more info from the log files:
    TaskSequenceProvider.log
    [1680680 PID:5228] Initializing provider for namespace root\sms\site_P01 TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    [1680680  PID:5228] Initialization of provider for namespace root\sms\site_P01 succeeded TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    [PID: 5228] Invoking method SMS_TaskSequence.ExportXml TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Failed to load class properties and qualifiers for class BDD_UsePackage in task sequence. 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Failed to export task sequence to XML 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    [PID: 5228] Done with method SMS_TaskSequence.ExportXml TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Setting status complete:  status code = 0x80041002; Failed to load class properties and qualifiers for class BDD_UsePackage in task sequence. TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    [PID: 5228] Invoking method SMS_TaskSequence.LoadFromXml TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Failed to load class properties and qualifiers for class BDD_UsePackage in task sequence. 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Failed to load node Use Toolkit Package from XML into WMI 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Failed to load children steps for node "Applikation" from XML 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Failed to load children steps for node "" from XML 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Failed to load XML for the task sequence into WMI 0x80041002 (2147749890) TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    [PID: 5228] Done with method SMS_TaskSequence.LoadFromXml TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    Setting status complete:  status code = 0x80041002; Failed to load class properties and qualifiers for class BDD_UsePackage in task sequence. TaskSequenceProvider 20.06.2012 10:51:38 4424 (0x1148)
    SMS Provider logs the following:
    CExtUserContext::EnterThread : User=A2\trth1 Sid=0x0105000000000005150000001BB949E9D7F6AADBC3309AA56BAB0000 Caching IWbemContextPtr=0000000005777900 in Process 0x9f8 (2552) SMS Provider 20.06.2012 10:51:47 3008
    (0x0BC0)
    Context: SMSAppName=SMS Administrator Console SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: MachineName=vswlieca2146.A2.loc SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: UserName=A2\trth1 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: ObjectLockContext=fdf8ab87-cf50-43bd-a48a-d5bb99c8034f SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: ApplicationName=Microsoft.ConfigurationManagement.exe SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: ApplicationVersion=5.0.0.0 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: LocaleID=MS\0x409 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: __ProviderArchitecture=32 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: __RequiredArchitecture=0 (Bool) SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: __ClientPreferredLanguages=en-US,en SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: __GroupOperationId=590802 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Context: __WBEM_CLIENT_AUTHENTICATION_LEVEL=6 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    CExtUserContext : Set ThreadLocaleID OK to: 1033 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    CSspClassManager::PreCallAction, dbname=CM_P01 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    ExecMethodAsync : SMS_ObjectLock::ReleaseLocks SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Requested class =SMS_ObjectLock SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    Requested num keys =0 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    CExtProviderClassObject::DoExecuteMethod ReleaseLocks SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    CSspSEDO::ReleaseLocks: ********** Releasing SEDO Lock for object SMS_TaskSequencePackage.PackageID="P010013A" for user A2\trth1. ********** SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)
    CExtUserContext::LeaveThread : Releasing IWbemContextPtr=91715840 SMS Provider 20.06.2012 10:51:47 3008 (0x0BC0)

  • Specifying system properties/security manager for OC4J

    I have a couple of related questions regarding OC4J/orion.jar:
    1. Generically, how can we specify system properties to orion.jar? Being an executable JAR, simply using -D does not work.
    2. Specifically, I need to launch the OC4J app server with a Java security manager (with associated security policies, etc.) Java's way of doing this is via -Djava.security.manager=... but this does not work with executable JARs it seems. I tried specifying these parameters via -D and I got a security exception:
    Exception in thread "main" java.security.AccessControlException: access denied (java.util.PropertyP
    rmission java.protocol.handler.pkgs write)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.System.setProperty(Unknown Source)
    at com.evermind.server.ApplicationServer.initProtocolHandlers(ApplicationServer.java:652)
    at com.evermind.server.ApplicationServer.launchCommandline(ApplicationServer.java:319)
    at com.evermind.server.ApplicationServer.main(ApplicationServer.java:314)
    So, how do I install the Java security manager with orion.jar? Is there any other way to specify system properties to this, or is there any other way to install the Java security manager for OC4J?
    Any help much appreciated.
    ..Hrishi

    Thanks, that seemed to work. However it seems that spawned another little problem. I was using the -Xbootclasspath/a option while firing up orion.jar because I needed to append something to OC4J's default classpath (that is specified in orion.jar's Manifest). Now, when I start OC4J with the -D options for the security policy, it seems to ignore the -Xbootclasspath argument. I have not yet been able to confirm this fact, but based on the ClassNotFoundError I'm running into, that does seem to be the problem.
    So I guess my question is, could specifying the -D options to the executable JAR cause it to ignore any other options you may be passing to it (such as -Xbootclasspath)? Is there any sequence in which these args need to be passed?
    Thanks.
    ..Hrishi
    Hi,
    You can try this :
    - Check if you have a file java2.policy in <OC4J_HOME>\config\policy and check if the permission java.util.PropertyPermission "read,write" is granted to <OC4J_HOME>.
    if there is no file, you can create one based on <JAVA_HOME>\lib\security\java.policy and grant the approriate privileges.
    - Launch OC4J :
    java -Djava.security.manager -Djava.security.policy=<OC4J_HOME>/config/java2.policy -jar orion.jar
    OR java -Djava.security.manager -Djava.security.policy=<PATH_TO_FILE_POLICY>/<YOUR_FILE>.policy -jar orion.jar
    Maher

  • Can we assign "Arrays" as class properties??

    Hi there!
    Is that possible we assign an array as the class properties?
    Code:
    package
              import flash.net.URLLoader;
              import flash.net.URLRequest;
              import flash.events.Event;
              import flash.events.EventDispatcher;
              public class TextToArray
         public var urlLoader:URLLoader = new URLLoader();
         public var dataArray:Array = new Array();
         public var textURL:String = "";
         public var seperator:String = "";
         public function TextToArray(textURL:String,seperator:String)
            this.textURL = textURL;
            this.seperator = seperator;
            urlLoader.load(new URLRequest(textURL));//URL to the text file we need to import to Flash
            urlLoader.addEventListener(Event.COMPLETE, dataArrayLoaded);
         public function dataArrayLoaded(e:Event):void
           this.dataArray = e.target.data.split(seperator);//the seperator such as "\n"
           urlLoader.removeEventListener(Event.COMPLETE, dataArrayLoaded);
           trace(this.dataArray[2]);  // corret Data
         public function getArray():Array{
           trace(this.dataArray[2]);  // undefined
           trace(textURL); // correct Data
           return dataArray;
         public function getArrayLength():int{
            return dataArray.length;
    What am I doing wrong?
    Thanks for your time.

    thanks a lot for your prompt reply! I have called it in another class (Main.as) like this:
    package
              import TextToArray;
              import VerseID;
              import flash.display.MovieClip;
              public class Main extends MovieClip
          var textToArray:TextToArray = new TextToArray("data/connection.txt","\n");
          var quranData:Array = new Array();
                        public function Main()
          this.quranData = textToArray.getArray();
          trace(this.quranData[2]); // undefined

  • Javax.naming.NoInitialContextException: Need to specify class name...

    Hello,
    I am trying to use a Database Connection Pool.
    Here is the test class am using to verify the connection pool:
    public static void main(String[] args) { Connection connection = null; try { InitialContext initialContext = new InitialContext(); DataSource dataSource = (DataSource)initialContext.lookup("jdbc/<alias>"); connection= dataSource.getConnection(); } catch (SQLException e) { //   TODO Auto-generated catch block e.printStackTrace(); } catch (NamingException e) { //   TODO Auto-generated catch block e.printStackTrace(); } Statement stmt = null; try { String query = ""; stmt = connection.createStatement(); ResultSet resultSet = null; query = "SELECT <column> ...'"; resultSet = stmt.executeQuery(query); while(resultSet.next()){ System.out.println(resultSet.getString(<column>)); } stmt.close();   stmt = null; connection.close(); connection = null; } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }finally{ if (stmt != null) {   try {   stmt.close();   } catch (SQLException sqlex) {   // ignore -- as we can't do anything about it here   }   stmt = null;   }   if (connection != null) {   try { connection.close();   } catch (SQLException sqlex) {   // ignore -- as we can't do anything about it here   } connection = null;   } } }
    I get following exception..
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280) at javax.naming.InitialContext.lookup(InitialContext.java:347) at com.internal.test.TestRun.main(TestRun.java:53) java.lang.NullPointerException at com.internal.test.TestRun.main(TestRun.java:66) Exception in thread "main"
    The exception points to
    DataSource dataSource = (DataSource)initialContext.lookup("jdbc/OrderStatus");
    Is this the correct way to test...?
    Thanks
    Srinivas

    java_2006 wrote:
    You can't access a jdbc pool like that (simply with a main method).
    The Database connection pool must be managed by a container (a servlet or application server) like tomcat.
    That is not entirely true but it certainly helps and is generally the only way it is used anyway so one might as well do it.

Maybe you are looking for

  • Newbie needs Help!  How can I protect PART of a form in LiveCycle?

    I have an interactive form that will be completed in 2 stages. The first stage is completed by the Manager.  I can do a password protect to open in Adobe reader, they could input data into 4 fields and then save the document under a customer name.  S

  • Tables for Router number and pcc required in ECC

    Hi, I want to know the Route number created by the system in ECC 1. my input will be material/plant. i need group Number, Group counter . Please let me know which table this is getting stored? 2. I have created product cost collector for this materia

  • CTS+ Configuration for Transporting non-ABAP objects in Portal Landscape using solution manage 7.1 sp8

    Hi, Currently we have cts+ already configured for our portal systems in our landscape through solution manager 7.0. Recently we had setup a new solution manager 7.1 and need to perform cts+ configuration using this new solution manager 7.1 as we are

  • Where are backups stored on my windows pc

    My C: drive is low on space so I moved the library off to an external drive.  My problem is that iTunes does not appear to store backups with the library but is instead using my "low on space" C: drive.  I need iTunes to store backups for my iPad and

  • How do I get rid of "Related Searches"?

    Good Morning, When using IE 10 c column opens up showing some supposedly related searches.  How do I prevent this column from coming up?  I find it annoying, obtrusive and useless. Thanks! Eric