Flex not including ArrayCollection collection passed to PHP

First of all, I use Flex Builder 3, Wamp with 5.2.9 - 2 PHP and MySQL 5.1.33.  I also use the Zend Framework to retrieve data from MySQL.

I have Flex using an HTTPService to send a request; the server is running then some PHP that reads a database MySQL, written each row in a table, all rows in a table.  Although I changed the actual data, here's what my returns a call on my MySQL database:

SELECT  *
FROM  `table1`
LIMIT 0 , 30

1 video filename.flv

otherDescription 2 filename2.flv

thirdDescription 3 filename3.flv

The names of the columns are 'id', 'title', and 'source', respectively.

Arrays in php seem to work very well, because in PHP,

Print($result[1]['title']);

We will give "otherDescription", and we can see that easily in Flex.

The problem is I don't want "otherDescription; I want the whole table passed to Flex as a collection of table.

I am able to pass the array from php, and then it's just a 'table' that I can't do anything with.  No matter what I trace him, he always says "Array", or it just doesn't work... Why is this?  Why can't I get anything out of it?  The thing is useful I can switch from PHP to Flex is a string, and it's awkward for what I do.

Here is my PHP code:

<? PHP

require('Zend/DB/adapter/PDO/MySQL.php');

$arr = array ('host' = > '127.0.0.1', 'username' = > 'root', 'password' = > ", 'database_name' = > 'videolist');

$db = new Zend_Db_Adapter_Pdo_Mysql ($arr);

$db-> getConnection();

$sql = ' SELECT * FROM 'table1' LIMIT 0, 30';

$result = $db-> fetchAll ($sql, 2);

$resultArray = array();

{foreach ($result as $resultItem)

{foreach ($resultItem as $itemFragment)}

[] $resultArrayFragment = $resultItem;

}

$resultArray [] = $resultArrayFragment;

}

echo $result;  or else, to illustrate how the collection of table, we can put "$result [1] ["title"]; ', in which case, Flex will show «otherDescription»

to the traces below

? >

Here are my relevant ActionScript:

private function onResult (): void {//this is drawn, we get a result after calling the HTTPService send()

var result = userRequest.lastResult;

trace ("trace 1 =" + String (userRequest.lastResult));     product: 'table '.

trace ("trace 2 =" + result [1] ["title"]);                           product: 'table '.

trace ("trace 3 =" + result [1] ["title"] [0] [0] [0] [0]);            Product ALWAYS just: 'table '.

var someDataProvider:ArrayCollection = new ArrayCollection (userRequest.lastResult.valueOf ());

trace ("trace 4 =" + result [0]);                                     product: "RangeError: Index '1' specified is out of range...". »

.

.

.

}

XML is fine for small amounts of data, you can use the object of the authority which is fast and lightweight. In my opinion, by far the simplest is Jason.

PHP can encode and decode Jason, you can load a library in flex jason and decode and coded.

Works perfectly, is now my main way to communicate with PHP.

Google flex and jason there are tons of projects there.

Tags: Flex

Similar Questions

  • How to check whether or not the arraycollection collection is initialized

    Hi all

    I am bit new to use the collection arraycollection in flex. I'm having this particular scenario, where I get Server data in a table. So I have to check if the arracollection I created is initialized or not. If it is not initialized I need to initialize it or other wise, just add collection from table to table. Here is the code snippet

    currentTrajectory = new collection ArrayCollection (event.result as Array);

    var _multiTrajectoryEvent:MultiTrajectoriesEvent;

    _multiTrajectoryEvent = new MultiTrajectoriesEvent (MultiTrajectoriesEvent.DRAW_AUTO_TRAJ);

    If (!) (_multiTrajectoryEvent.trajectories.source is nothing))

    {

    _multiTrajectoryEvent.trajectories.addItem (currentTrajectory);

    }

    else

    {

    _multiTrajectoryEvent.trajectories = new ArrayCollection ([currentTrajectory]);

    }

    But unfortunately the above code does not work for me, because the arraycollection collection is not initialized first, there is no way of checking me if it is initialized later or not as the compiler gives me the error checking to null...

    Can any Walter suggest how can I check if the table collection is initialized or not?

    I would appreciate any suggestions and thouhgts for the same

    Thank you

    Akshay

    Sorry to say, but it's not the right approach...

    I'm abt don't know what is exactly done so I'll give a generic example...

    I have an ArrayCollection collection...

    private var arrC:ArrayCollection;

    Maybe it's getting used internally in several places, so you be sure if she be initialized already or not. Then use a code something like that...

    If (arrC! = null & arrC.length > 0)

    {

    ...

    ...

    }

    If you are using

    If (arrC.Length > 0)

    {

    ...

    ...

    }

    and it is not initialised it will give exceptional at the time to compile...

    For a logic if(a && b) be true both a and b must be true, so if same first one (a) is false it will not evaluate the second logic (b).

    Thus, the previous logic works.

    concerning

    Nishant

  • Variable HTTService and ArrayCollection collection

    First of all - thanks for these turorials - great they´re.
    But as a beginner is easy to do something wrong.
    If I always appreciate the code source, so we can accelerate the learning one curve don't fight
    with small details like many empty spaces on etc...

    I ve done the exercise with HTTService again and again.
    I have debugging and all this, disable all firewall but still cant able to load the xml file into the DataGrid.
    Files and directories are accurate as in your tutorials.
    But only a blank page, I posted

    Here´s that the debbuger says:
    ".. Cannot convert mx.utils::ObjectProxy@29d1ee1 in mx.collections.ArrayCollection. »

    Probably what could be wrong?


    Here´s code:

    Hello highlander_1,

    I managed to get your example working with a few changes. I datatyped employeeData as XMLListCollection and adds the resultFormat property in the HTTPService e4X. The collection and E4X XMLList will allow you easily fill the dataGrid control. To see in the code below, I used

    Quote:

    The dataField property is the tag in the XML file. The headerText property is what is called the column. You can add several of them. In the example, I have edited for you, I see that three (firstname, lastname, email).

    You receive the data type ObjectProxy in castant don't not the ArrayCollection collection. For example:

    Quote:
    myDataStuff = event.result.employee as ArrayCollection collection;

    In this application, I copied your XML file in my project in a folder of data, here is the file of the application:

    Quote:

    http://www.Adobe.com/2006/mxml"layout ="absolute ".
    creationComplete = "init ()" > "


    Import mx.collections.ArrayCollection;
    Import mx.collections.XMLListCollection;
    Import mx.rpc.events.ResultEvent;

    [Bindable]
    private var employeeData:XMLListCollection = new XMLListCollection();

    private function init (): void
    {
    employeeService.send ();
    }

    private void resultHandler(event:ResultEvent):void
    {
    We're going to wrap the source with the XMLList.
    var employeeResultData:XMLList = new XMLList();
    employeeResultData = event.result.employee;
    employeeData.source = employeeResultData;
    }

    ]]>



    result = "resultHandler (Event)" resultFormat = "e4x" / > "



    dataProvider = "{employeeData}.
    Width = "480" >






    Hope this helps you,

    Ryan

  • Type was not found or was not a compilation constant: ArrayCollection collection

    I've never seen this type of error before. I was running the asdoc tool when I arrived at the Office:

    package adventureGame.util
    {
         import mx.collections.ArrayCollection;
    
         public class ACConvertor
         {
              public function toAC(array:Array):ArrayCollection
              {
                   var arrayObject:Array = new Array();
                   var ac:ArrayCollection = new ArrayCollection();
                   
                   return ac = arrayObject as ArrayCollection;
              }
         }
    }
    

    Why I get:

    ACConvertor.as (31): col: 37 error: Type was not found or is not a constant of compilation: ArrayCollection collection.

    public void toAC(array:Array):ArrayCollection

    Collection ArrayCollection and any class that starts with mx... is that the Flex code. You work in an IDE Flex or Flash?

  • my flash reads the xml, but does not include the php tag...

    my flash reads the xml, but does not include the tag php. I want to read my xml dynamically, Please help me.

    Code:

    Stop();

    function randomOrder (targetArray)

    {

    var _loc2 = targetArray.length;

    var _loc3 = [];

    for (var _loc1 = 0; _loc1 < _loc2; ++ _loc1)

    {

    _loc3 [_loc1] = _loc1;

    } / / end of for

    var _loc4 = [];

    for (var _loc1 = 0; _loc1 < _loc2; ++ _loc1)

    {

    _loc4 [_loc1] _loc3.splice = (Math.floor (Math.random () * _loc3.length), 1);

    } / / end of for

    var _loc5 = [];

    for (var _loc1 = 0; _loc1 < _loc2; ++ _loc1)

    {

    _loc5 [_loc1] = targetArray [_loc4 [_loc1]];

    } / / end of for

    return (_loc5);

    } / / End of the function

    var randomNUM = '? '. n ="+ random (9999);

    _root. LAN = 1;

    var homehead;

    HomeLink var;

    var homelinkwindow;

    var homebg;

    var homeflash;

    lamp var = Array();

    promo var = Array();

    var promobottom = Array();

    var headimg = Array();

    f_xmlwork2 = new XML();

    f_xmlwork2.ignoreWhite = true;

    f_xmlwork2. Load ("banner.php");

    f_xmlwork2. OnLoad = {function (success)}

    If (success) {}

    trace ("XML loaded!');

    f_xmlItemx2 = parseInt(this.firstChild.childNodes[0].firstChild);

    f_totalx2 = f_xmlItemx2.length;

    trace (f_totalx2);

    var _loc12 = 0;

    declarar a fundo imagem

    homebg = this.firstChild.childNodes [0].firstChild.nodeValue;

    f_headimg = this.childNodes [1];

    for (var _loc2 = 0; _loc2 < f_headimg.childNodes.length; ++ _loc2) {}

    Juju = f_headimg.childNodes [_loc2];

    JJ = headimg.push ({headimg: f_headimg.childNodes [_loc2].attributes.headimg, bgimg: f_headimg.childNodes [_loc2].attributes.bgimg, msgimg: f_headimg.childNodes [_loc2].attributes.msgimg, leftthrow: f_headimg.childNodes [_loc2].attributes.leftthrow, rightthrow: f_headimg.childNodes [_loc2].attributes.rightthrow});

    }

    end for

    allpromo = this.childNodes [2];

    jjpromo = allpromo.childNodes;

    for (var _loc2 = 0; _loc2 < allpromo.childNodes.length; ++ _loc2)

    {

    trace (jjpromo, [_loc2],.attributes.title);

    JJ = promo.push ({img:. attributes.img jjpromo [_loc2], title: jjpromo [_loc2].attributes.title, url: jjpromo [_loc2].attributes.url, window: jjpromo [_loc2].attributes.window, info: jjpromo [_loc2] Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue});

    }

    end of for

    allpromobottom = this.childNodes [3];

    jjpromobottom = allpromobottom.childNodes;

    for (var _loc2 = 0; _loc2 < allpromobottom.childNodes.length; ++ _loc2)

    {

    trace (jjpromo, [_loc2],.attributes.title);

    JJ = promobottom.push ({url: jjpromobottom [_loc2].attributes.url, window: jjpromobottom [_loc2].attributes.window, info: jjpromobottom [_loc2] Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue});

    } / / end of for

    If (f_xmlwork2.loaded is true)

    {

    headimg = randomOrder (headimg);

    for (var _loc2 = 0; _loc2 < f_headimg.childNodes.length; ++ _loc2)

    {

    trace (headimg, [_loc2], .headimg);

    } / / end of for

    play ();

    } / / end if

    }

    }

    trace (f_xmlwork2);

    Stop();

    PHP code:

    <?

    $link = mysql_connect("localhost","rnpac_eco","123");

    @mysql_select_db ("rnpac");

    $dir = "' banner /"; "

    Dir1 $= "" products/img_pro / ";"

    Dir2 $= "" universo/activities / ";"

    $sql = ' SELECT tbl_produto.id_produto, tbl_produto.produto, tbl_produto.legenda, tbl_produto.detalhe, tbl_produto.preco, tbl_produto.produto_cat_id, tbl_detalhe_produto.proprietario, tbl_detalhe_produto.local, tbl_detalhe_produto.qualidade, tbl_detalhe_produto.alcool, tbl_detalhe_produto.acidez, tbl_detalhe_produto.ph, tbl_detalhe_produto.informacao, tbl_detalhe_produto.gestor, tbl_detalhe_produto.condicionamento, tbl_detalhe_produto.detalhe_t, tbl_detalhe_produto.interesse, tbl_detalhe_produto.transporte, tbl_detalhe_produto.produto_id, tbl_imagem_produto.id_imagem tbl_imagem_produto.imagem1, tbl_imagem_produto.imagem2, tbl_imagem_produto.imagem3, tbl_imagem_produto.imagem4, tbl_imagem_produto.imagem5, tbl_imagem_produto.imagem6

    OF tbl_cat_produto, tbl_produto, tbl_detalhe_produto, tbl_imagem_produto WHERE tbl_produto.id_produto = tbl_detalhe_produto.produto_id AND tbl_produto.id_produto = tbl_imagem_produto.produto_id ORDER OF RAND()';

    $resultado = mysql_query ($sql)

    or die ("Nao faith possible realize a consulta.');

    $row1 = mysql_fetch_array ($resultado);

    $sql = "SELECT tbl_sub_universo.id_subuniverso, tbl_sub_universo.subuniverso, tbl_sub_universo.universo_id, tbl_actividade.id_actividade, tbl_actividade.entidade, tbl_actividade.legenda, tbl_actividade.subuniverso_id, tbl_actividade.det, tbl_actividade.preco, tbl_actividade.data, tbl_detalhe_actividade.actividade_id, tbl_detalhe_actividade.periodo, tbl_detalhe_actividade.descricao, tbl_detalhe_actividade.programa, tbl_detalhe_actividade.informacoes, tbl_detalhe_actividade.actividades, tbl_detalhe_actividade.localizacao, tbl_detalhe_actividade.locais, tbl_detalhe_actividade.servicos, tbl_imagem_produto.id_imagem. tbl_imagem_produto.imagem1, tbl_imagem_produto.imagem2, tbl_imagem_produto.imagem3, tbl_imagem_produto.imagem4, tbl_imagem_produto.imagem5, tbl_imagem_produto.imagem6, tbl_sub_universo tbl_imagem_produto.actividade_id, tbl_actividade, tbl_detalhe_actividade, tbl_imagem_produto WHERE the tbl_actividade.id_actividade = tbl_imagem_produto.actividade_id AND tbl_actividade.id_actividade = tbl_detalhe_actividade.actividade_id ORDER OF RAND() ';

    $resultado = mysql_query ($sql)

    or die ("Nao faith possible realize a consulta.');

    $row2 = mysql_fetch_array ($resultado);

    ' $query ='SELECT * FROM tbl_banner ORDER OF RAND() ';

    $resultado = mysql_query ($query);

    echo "<?" XML version=\"1.0\"? " >

    < home_left_headline >

    < bgimg > '. $dir2. ". $row1 ['imagem1'].' < / bgimg >

    < / home_left_headline >

    < home_flash > ';

    While ($row = {mysql_fetch_array ($resultado))}

    "" echo "< swf headimg =" ' bgimg = "" msgimg = "" leftthrow = "" rightthrow = "" > < / swf > '; "

    }

    echo "< / home_flash > ';"

    echo "< promotop >

    "< img class =" "title =" "" url = "" > <! " [CDATA []] > < / promo >

    "< img class =" "title =" "" url = "" > <! " [CDATA []] > < / promo >

    < / promotop > ';

    mysql_close ($Link);

    you would not see this trace php if your php has been setup correctly.  Upload your files and repeat the test.

  • 'Include' and 'Require' functions in PHP documents does not not in DW CS5 - need help

    In Dreamweaver CS4 when you typed include (" or require ()" in a PHP document, it would cut you off and give you the choice of manually enter the location of the file or choose to look for it.) It looked like the picture below:

    info.jpg

    In Dreamweaver CS5, which I've recently updated also, when include (" or require ()" is typed this function no longer occurs.) Dreamweaver does not have the ability to search for a file and create the path for you as before. It's embarrassing because I need a field of PHP and typing the relative path of hand is tedious and risky.

    Using of Insert > object PHP > Include also does not allow me to search for the file as before.

    Did I miss something in the new version? And is anyone know how to solve the problem? I thought (and I know its possible, but I don't know how to do it) that we could use the code in DW CS4, who previously managed and add it to the DW CS5 - because it seems that they out took it or forgotten.

    .. .it seems that it was the dynamic nature of the addition of the

    code hinting that caused code indicator of travel do not work,

    or his forced removal.

    I went back and found the old rules static Code Hint of CS4 and tried adding them to the CS5, and they no longer work. I suspect they are under substitution by the new dynamic feature added in CS5.

    Sorry for the inconvenience. We are aware of the bug and will try to get it fixed.

    Kind regards

    Randy Edmunds

    Dreamweaver development

    Adobe Systems, Inc..

  • ArrayCollection collection do not fill after calling first Data Services

    I am filling a collection ArrayCollection using a call for data by the following code:

    [
    Bindable]
    
    public var srv:RemoteObject;
    
    var acCountries:ArrayCollection; 
    
    if
    
    
     (srv == null){srv = 
    new RemoteObject();srv.destination = 
    
    "trip"; }
    acCountries = srv.getAllCountries.lastResult;
    srv.getAllCountries();
    
    
    
    

    ArrayList is not populted during the first call.  The java backend data service method is called, but the ArrayCollection collection is not populated until the time of the second (or third) the code is executed.

    I tried to walk through the debugger, but it is unclear what I does not initialize correctly.

    Hello

    Try to use the below approach instead of the adopted approach.

    [

    Bindable]

    public var srv:RemoteObject;

    private function getAllCountries():void

    {

    var acCountries:ArrayCollection;

    if (srv is Nothing)

    {

    SRV =

    new RemoteObject;

    SRV.destination =

    'journey';

    }

    srv.addEventListener (ResultEvent.RESULT, countriesResultHandler);

    srv.addEventListener (FaultEvent.FAULT

    countriesfaultHandler);

    srv.getAllCountries ();

    }

    private function countriesResultHandler(result:ResultEvent)

    {

    Check here the result by debugging object and replace the threshold accordingly

    acCountries = result.countries;

    }

    private function countriesfaultHandler(fault:FaultEvent)

    {

    Alert.Show)

    "Error: ' + fault.message);

    }

    In the approach you used you bind the data to the ArrayCollection collection by making use of the lastResult object.

    But you use the below line and send the result at the same time...

    acCountries = srv.getAllCountries.lastResult;

    srv.getAllCountries ();

    Here you don't know when the acCountries arraycollection collection will be linked to the lastResult object. Given that it is an asynchronous operation for the first time that you control the acCountries arraycollection collection you have all the data. Her approach always better and good use of event handlers in response as the way I used so that you will know exactly when took place the answer/result and if no fault or so.

    If this post answers your question or assistance, please mark it as such.

    Hope this will make things clear...

    Thank you

    Jean Claude Chari

  • Flex 3: syntax to power the ArrayCollection collection in loop

    Hi, I'm a newb. I can't find an example how to do that. Examples would be greatl appreciated.

    I want to draw some technical data by filling the dataprovider for my chart with a collection of table (so far no problem). I want to poulate collection table by looping through a mathematical expression, and I can't understand the syntax for this. For example...

    [Bindable]
    private var myChartData:ArrayCollection = new ArrayCollection([)
    {vertNum:100, horizNum:100}
    ]);

    I want to browse and add more points by program, so if I loop 5 times I find myself with...

    [Bindable]
    private var myChartData:ArrayCollection = new ArrayCollection([)
    {vertNum:100, horizNum:100},

    {vertNum:110, horizNum:110},

    {vertNum:43, horizNum:120},

    {vertNum:88, horizNum:130},

    {vertNum:140, horizNum:140},

    etc...
    ]);

    The number of variables horizontal to draw ould be several hundred, so I don't want to set up a huge collection of static array with expressions in each location. I'd rather solve the expression as a loop iterates and populate the collection of table as he goes. But I don't have any idea how "word" which.

    Thank you!

    Here's an example of adding a simple formula data points using a random number generator and amplify the randomness. The process is just to create a new object for each iteration of the loop and add the object to your ArrayCollection collection. You can assign as many properties to the object you need, which can be useful to use an ArrayCollection collection that appears in several charts.


    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete =" build_model () ">"
       
            Import mx.collections.ArrayCollection;
               
    private function build_model (): void {}
    var obj:Object;
    var chartAC:ArrayCollection = new ArrayCollection();
                   
    for (var i: uint = 0; i< 100;="" i++)="">
    obj = new Object();
    obj.horizNum = 100 + 10 * i;
    obj.vertNum = i * Math.Random ();
    chartAC.addItem (obj);
    }
    linechart1. DataProvider = chartAC;
    }

    ]]>
       
       
           
               
           

       

       

    Chris

  • Labelling of records in an array or arrayCollection collection

    Many of the Tour de Flex examples use a table in a way that is not familiar to me. For example: var array: Array = [{Profit: 2000}, {Profit: 2400}];

    I want to put my data in the table as follows: var array1:Array = [2000,2400];

    but I still want to be able to access the property of 'Profit' when I use an ArrayCollection collection as in the example below.

    So, I have 2 questions:

    First of all, what is the name given to filling a table like: var array: Array = [{Profit: 2000}, {Profit: 2400}];

    and

    Second, how to tag my data with "Profit" when I add it to an array or ArrayCollection collection?

    Thanks for your time.

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "creationComplete ="init ()">
    < mx:Script >
    <! [CDATA]
    Import mx.collections.ArrayCollection;
    private function init (): void {}
    var array: Array = [{Profit: 2000}, {Profit: 2400}];
    var ac0:ArrayCollection = new ArrayCollection (array);
    areachart.dataProvider = ac0;
    //
    var array1:Array = [2000,2400];
    var ac1:ArrayCollection = new ArrayCollection (array1);
    areachart1. DataProvider = ac1;
    }
    []] >
    < / mx:Script >
    < mx:Panel >
    < mx:AreaChart id = "areachart" color = "0 x 323232" height = "100" >
    < mx:series >
    < mx:AreaSeries yField = "Profit" / >
    < / mx:series >
    < / mx:AreaChart >
    < / mx:Panel >
    < mx:Panel >
    < mx:AreaChart id = "areachart1" color = "0 x 323232" height = "100" >
    < mx:series >
    < mx:AreaSeries yField = "Profit" / >
    < / mx:series >
    < / mx:AreaChart >
    < / mx:Panel >
    < / mx:Application >

    Hi SiHoop,

    You need to defenitely label it when you're assiging the data for the table itself.

    var array: Array = [{Profit: 2000}, {Profit: 2400}];

    That the above is equivalent to creating an object and pushing data to a table.

    You can use the above statement as... goes

    var array: Array = new Array();

    var obj:Object = new Object();

    obj. Profit = 2000;

    Array.push (obj);

    obj:object = new Object();

    obj. Profit = 2400;

    Array.push (obj);

    In fact {Profit: 2000} represnts an object... including the benefit's label (property of the object) to the value.

    var array: Array = [{Profit: 2000}, {Profit: 2400}]; is the easiest way to initialize the array. You need to label it until then only you can access it with the label.

    Thank you

    Jean Claude

  • Extract information from the arrayCollection collection

    Hello world

    I have a very simple problem, but I'm a new flex developer and I have no idea what to do.

    that I extracted information from a database by using a Web service in coldfusion.

    in flex, I recovered my query result in an arrayCollection collection

    private var tabInfosDriver:ArrayCollection

    Private function driverInfoHandler(event:ResultEvent):Sub

    tabInfosDriver = event.result as ArrayCollection; collection

    and if I give {tabInfosDriver} as a dataprovider to a DataGrid, the result of the query is displayed correctly, something like that.

    Header1 By tete2 Header3 Header4 Header5
    someValuevalue2someValue3someValue4someValue5


    now, I want to use header1 someValue to fill a textField instance.

    I tried:

    Label1.text = tabInfosDriver.getItemAt (1.0) m:System.NET.SocketAddress.ToString)

    but it wrong: the index table out of range and in any case, I want to use the name of the header field, which is the database table to call its value

    Label1.text = tabInfosDriver.getItemAt("header1").value.toString)

    What can I do? I don't know that it is easy to solve. I looked at all the methods of the collection arrayCollection object, but I can't understand wich one to use.

    Please forgive me of my language, I do not speak English very often.

    Dominic

    Often you can either return the data to the Flex application in standard object notation, or to reconfigure the data in this way once he returns to the Flex application in the result handler. The standard notation, to which I am referring is:

    {

    {key1: 'value 1', key2: "Value2", key3: "Value3"},

    {key1: 'value 1', key2: "Value2", key3: "Value3"},

    {key1: 'value 1', key2: "Value2", key3: "Value3"},

    {key1: 'value 1', key2: "Value2", key3: "Value3"}

    }

    So in this way the data is structured, already as an associative array, because such a table is really just an ActionScript object.

    If these data should be accessible in two ways:

    var tempVar:String = myObject.key1;

    var tempVar:String = myObject ["key1"];    (maybe myObject ["key1"])

    Moreover, this "standard object notation" is also known under the name of JSON and there are libraries for handling JSON to the format of the data in Flex, PHP, etc if you have not necessarily to treat it as JSON, which comes, which makes it a little more formal and provides additional APIs:

    http://code.Google.com/p/AS3corelib/

  • Of HTTPService for ArrayCollection collection

    Hi all

    I practiced on Flex for several weeks, and I really appreciate it. I use it mainly to view BD MySQL data. One thing I can not clearly know is how to transfer data from an XML (accessed by a HTTPService) to an ArrayCollection collection. I tried several methods, it never works.

    This is my last try:


    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "absolute" >

    < mx:Script >
    <! [CDATA]
    Import mx.collections.ArrayCollection;
    Import mx.utils.ArrayUtil;
    []] >
    < / mx:Script >

    "" < mx:HTTPService id = "Liste_XML" url = " http://www.hereismyXMLfile.com/file.php" useProxy = "false" method = "POST" / >

    < mx:ArrayCollection id = source = "{mx.utils.ArrayUtil.toArray (Liste_XML.lastResult.liste.affiche)"arrayfilms"}" / > "

    < mx:DataGrid dataProvider = "{arrayfilms}" creationComplete = "Liste_XML.send ()" width = "500" / > "
    < / mx:Application >

  • How to raise an event from the arrayCollection collection?

    I'm passing data from a model to a view in the following files. It works fine, but I want to send a message on the screen when an arrayCollection collection is filled. I know that I could create a custom event, but I do not understand why the eventhandler I created will not work. Please tell me what I'm doing wrong.

    Thank you.

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"creationComplete =" init () "> "
    < mx:Script >
    <! [CDATA]
    Import mx.collections.ArrayCollection;
    Import mx.events.CollectionEvent;
    Import mx.rpc.events.ResultEvent;
    [Bindable] private var databaseDataArrayCollection:ArrayCollection = new ArrayCollection collection;
    [Bindable] private var: model = new modele();
    [Bindable] private var: controller = new Controller();
    private function init (): void {}
    model.databaseDataArrayCollection.addEventListener (CollectionEvent.COLLECTION_CHANGE, chan ge)
    model = Model.createInstance ();
    controller.getData ();
    }
    private void change(e:Event):void {}
    trace ("changed in sight")
    }
    []] >
    < / mx:Script >
    < mx:DataGrid dataProvider = "{model.databaseDataArrayCollection}" > "
    < mx:columns >
    < mx:DataGridColumn id = "first name" dataField = "first name" headerText = "FIRSTNAME" / >
    < mx:DataGridColumn id = "lastName" dataField = "lastName" headerText = "LAST NAME" / >
    < / mx:columns >
    < / mx:DataGrid >
    < / mx:Application >

    Model.As

    package {}
    Import mx.collections.ArrayCollection;
    [Bindable]
    public class {model
    public var databaseDataArrayCollection:ArrayCollection = new ArrayCollection();
    private static var: model = new model;
    private static var num:Number = 0;
    public void modele() {}
    }
    Public Shared function createInstance (): model {}
    NUM ++
    if(Model == null) {}
    model = new modele();
    }
    return the template;
    }
    }
    }

    Controller.As

    package {}
    import com.simon.cms.UrlString;

    import flash.events.Event;

    Import mx.collections.ArrayCollection;
    Import mx.events.CollectionEvent;
    Import mx.rpc.events.ResultEvent;
    Import mx.rpc.http.HTTPService;
    Import mx.utils.StringUtil;

    [Bindable]
    public class {controller
    private var: model = new modele();
    public var httpService:HTTPService = new HTTPService;
    private var login_string:UrlString = new UrlString();
    public void Controller() {}
    model = Model.createInstance ();
    }
    public void getData (): void {}
    var params: Object = new Object();
    httpService.url = login_string.login;
    httpService.method = "GET";
    httpService.addEventListener (ResultEvent.RESULT, extractData);
    httpService.send (params)
    }
    private void extractData(event:ResultEvent):void {}
    httpService.removeEventListener (ResultEvent.RESULT, extractData);
    model.databaseDataArrayCollection.addEventListener (CollectionEvent.COLLECTION_CHANGE, chan ge)
    model.databaseDataArrayCollection = event.result.student.task;
    }
    private void change(e:CollectionEvent):void {}
    trace ("Changed in the collection")
    }
    }
    }

    You use "=" this is a reversal/replacement.  There is no chip

    assignment that will update.

    You could do

    model.databaseDataArrayCollection.source =

    Event.Result.Student.Task.source;

    That should translate into a CollectionEventKind.RESET in original HQ as it

    now a new set of data.

  • setItemAt on the ArrayCollection collection

    I'm changing the value of any element in an arrayCollection collection. For example...

    private var productArray:ArrayCollection = new ArrayCollection ([] collection
    {result: 'Red', count: 32},.
    {fruit: 'Blue', count: 47},.
    {result: 'Yellow', count: 62}.
    ([{result: 'Green', count: 35}]) ;

    productArray.setItemAt ({fruit: "Purple", count: 20}, 0);  This gives an error of access of undefined property productionArray

    Can't seem to understand the setitemAt() after looking at the manual and search for examples.  How can I change the values in an existing ArrayCollection collection?

    Thank you.

    Check your spelling, the error complained of productionArray not productArray.  Or maybe just clean and re - build.

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • Condition in the ArrayCollection collection

    I have an ASP application that retrieves the files form a MS SQL Server db.

    My flex application the user can select the desired file to download. It search the name of the file as it is written in my flex application which is worng because the actual name in the SQL Server db is different.

    So now I'm trying to solve this problem with an ArrayCollection collection that has the file name time as Flex knows it and the name of the SQL Server.

    var sdeName:ArrayCollection = new ArrayCollection([)
    {label: "labelInFlexApp", data: 'labelInSQL'}
    ]);

    If (sdeName [label] == item.label) {}
    Item.label = sdeName [data];
    var url: String = " " http://Server/getMetaData/metadata.aspx?sdeFeatName= " "+ item.label +"&"+"outFormat = ISO";

    }

    I do not know how to find the value in my ArrayCollection collection and compare it with the real one.

    Thank you

    Manolo

    Hello

    Try:

    if (sdeName.getItemAt(i)["label"] == item.label) {
    

    Instead of:

    if (sdeName.getItemAt(i).[label] == item.label){
    
  • Binding XML to ArrayCollection collection

    I'm completely stumped. I had an application that worked in Flex Builder 2 beta 3 that brought them a HTTPService and linked to an ArrayCollection collection XML results. Then I could use the ArrayCollection collection as my dataProvider for a DataGrid control. This method allowed me to do a prior sorting the data by sorting the ArrayCollection collection. I've recently upgraded to the latest version of Flex Builder 2 and now it seems that the application does not work. It says I have to go the HTTPService results in table form:

    < mx:ArrayCollection id = source = "{ArrayUtil.toArray (service.lastResult.resultset.result)"myAC"}" / > "

    When I do this, the application is built, but now the DataGrid control is not complete. I tried everything I could think of getting this work. Can anyone show me an example where the XML returned by a HTTPService is bound to a collection that is then bound to a DataGrid control?

    I thought about it. I have no idea why, but I had to make the connection as:

    [Bindable]
    private var xml:ArrayCollection = null;

    private void bind(event:ResultEvent):void {}
    XML = event.result.resultset.result;
    }

    Then for the HTTPService:

    http://localhost"/ >

    Now everything works fine. I can sort, filter, etc. on the ArrayCollection collection.

Maybe you are looking for

  • Dashboard button no longer works since download El Capitan

    I have a "dashboard" button (F4) on my desk that no longer works (to display weather dashboard, itunes, calculator, clock display) since the update to El Capitan. Is there any solution for this?

  • Final Cup Audio improve the Discussion

    I'm curious... Why the Audio improvements in Final Cut, for lack of better words, suck?  How is it that you are 'improvement' of the audio and it ends up sounding as if you were inside a tin can?  I'm just curious, because when you typically add a fi

  • HP Support Assistant tells Me to download and install the same update

    I have a HP Envy 700-027c. Maintaining HP Support Assistant telling me to download and install a Cyberlink PowerDVD to sp63146.exe, even if I downloaded it, installed and rebooted my computer 3 times or more. I don't get no error on installation, the

  • Dynamically change the language in cvi

    Hello I would like to know if it is possible to dynamically change the IUR in English language to Russian? I have a program written in cvi and I need to be able to scwitch English to Russian UI when the user clicks a button... Thanks in advance

  • BlackBerry 10 how update 10.2.1

    For the moment, I have the Version 10.2.0 on my Z10. Is the result of the update 10.2.1 out and some other customers of E-Plus (this is my provider) have already.So I asked E-Plus (which has to do with Medion and Aldi Talk) and everything they said w