1 Reply Latest reply on May 2, 2008 11:30 PM by Gregory Lafrance

    using Tilelist:  locating component inside of access variable outside

      I created the following code to create a set of panels to hold a set of XML topics.
      I want to change the size of the panels by a slider, however I found it is difficult to communicate through the Tilelist.

      The codes are here:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="creationCompleteHandler()" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #729AFF]" xmlns:local="*" xmlns:ns1="nl.wietseveenstra.extensions.panel.*">

      import flash.events.MouseEvent;
      import mx.controls.Alert;

      protected function creationCompleteHandler():void {


      //Create and Repeat the post holders
      var sizeWidth:Number = 200;
      var sizeHeight:Number = 100;
      var idName:String = "PL";

      public function changeSize():void{
      sizeWidth = TileSize.value * 2;
      sizeHeight = TileSize.value;

      MyPanel.width = 100;



      <mx:HTTPService id="feedRequest" url=" http://sweb.cityu.edu.hk/50685791/Adv_trialPosts.xml" useProxy="false" />

      <mx:TileList width="1024" height="1000" id="MyTileList" dataProvider="{feedRequest.lastResult.channel.item}" >
      <mx:Tile width="100%" height="100%" borderThickness="1" borderColor="#abcdef">
      <mx:Panel id="MyPanel" width="{sizeWidth}" height="{sizeHeight}" title="{data.title}">



      <mx:ApplicationControlBar width="100%" fillAlphas="[1.0, 1.0]" fillColors="[#FFFFFF, #2F74FF]" bottom="0">
      <mx:Label text="This slider resize all the post boxes" />
      <mx:HSlider id="TileSize" horizontalCenter="0" y="830"
      minimum="0" maximum="100" value="100" allowTrackClick="true" liveDragging="true" change="changeSize();" />


      It return either an "1120:Access of undefined property sizeHeight" error at the ≤mx:Panel≥ tag, or an "1120: Access of undefined property MyPanel" at inside the <mx:Script> tag

      Besides, how can I know which element is selected inside the Tilelist? Thx!!

        • 1. Re: using Tilelist:  locating component inside of access variable outside
          Gregory Lafrance Level 6
          I think the scope of MyPanel is within the <component> tag, thus it is not visible outside that tag.

          You have code in your changeSize function MyPanel.width = 100;, but I don't think you need it, as you have already set up a binding to the Panel width with sizeWidth. Actually you are not yet using the [Bindable] metadata tag. See the attached code, and note the use of the [Bindable] metadata tag, and the changes to the <component> tag, particularly the use of the parentDocument variable to access variables outside the renderer.