1 Reply Latest reply on Oct 30, 2009 5:17 AM by satoshi.ara

    HorisontalScrollPosition Attribute of a HTML-component does not work. Why?

    satoshi.ara

      Hello there,

       

      I would like to synchronize scroll-events of a HTML-component and a Canvas-component.

      I thought it schould be easy, and I wrote it like below....

       

      <mx:Script>

           <![CDATA[

       

                private function onCanvasScrollHandler(e:ScrollEvent):void

                {

                     if(e.direction == "vertical")

                     {

                          myHTML.verticalScrollPosition = e.position;

                     }

                     else if(e.direction == "horizontal")

                     {

                          myHTML.horizontalScrollPosition = e.position;

                     }

                }

       

           ]]>

      </mx:Script>

       

      <mx:HTML   id="myHTML"   width="300" height="300" horizontalScrollPolicy="on" verticalScrollPolicy="on" />

      <mx:Canvad id="myCanvas" width="300" height="300" horizontalScrollPolicy="on" verticalScrollPolicy="on" scroll="onCanvasScrollHandler(event)" />

       

      ....this Script does kind of work. When I scroll "myCanvas" vertially, the "myHTML" is also scrolled vertical as much.

      However this only works for vertical scrolling, but not for horizontal one. "myHTML" is not be scrolled horizontal, when the value is substituted in horizontalScrollPosition-attribute of "myHTML".

      Does anyone have a clue for this Problem?

       

      Thanks.

       

      Satoshi