Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex/AS3: Data binding through a refenced property
    primarykey
    data
    text
    <p>I have:</p> <p>class A: with a property "data:ArrayCollection". It's my data source (data provider) and has bitmaps.</p> <p>class B: has an instance of A (called "Ainst") and calls the following method: C.init( Ainst.data). To pass the data provider to Object C.</p> <p>class C: has a reference of the data provider "data" (because of "init" method). It shows the arrayCollection into Images as: Image.source = data.getItemAt(0).</p> <p>But C never updates its images, that is, data binding doesn't work with this scheme. I've put [Bindable] meta-tag in all properties and even classes.</p> <p>class A:</p> <pre><code>public class A{ [Bindable]public var data:ArrayCollection; } </code></pre> <p>class B:</p> <pre><code>public class B{ [Bindable]public var Ainst:A; public var Cinst:C; public function init(){ Cinst = new C(); Cinst.init(A.data) } } </code></pre> <p>class C: An image menu with 3 items (bitmaps)</p> <pre><code> &lt;s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:local="*" horizontalAlign="center" paddingTop="10" paddingBottom="10" gap="10"&gt; &lt;fx:Script&gt; &lt;![CDATA[ [Bindable] public var _images:ArrayCollection; public function init( images:ArrayCollection ):void{ _images = images; } ]]&gt; &lt;/fx:Script&gt; &lt;ms:Image id="PreviousButton" smoothBitmapContent="true" width="55" height="55" source="@Embed(source='/../figures/upArrow.png')"/&gt; &lt;ms:Image id="TopItem" smoothBitmapContent="true" maintainAspectRatio="true" x="12.5" source="{_images.getItemAt(0)}" /&gt; &lt;ms:Image id="MiddleItem" smoothBitmapContent="true" maintainAspectRatio="true" x="12.5" source="{_images.getItemAt(1)}"/&gt; &lt;ms:Image id="BottomItem" smoothBitmapContent="true" maintainAspectRatio="true" x="12.5" source="{_images.getItemAt(3)}"/&gt;&lt;!-- getItemAt(2).image --&gt; &lt;ms:Image id="NextButton" smoothBitmapContent="true" width="55" height="55" source="@Embed(source='/../figures/downArrow.png')"/&gt; &lt;/s:VGroup&gt; </code></pre> <p>Any thought? Thanks. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload