12 Replies Latest reply on Oct 7, 2008 7:18 AM by Newsgroup_User

    Passing XML value to a ScrollingText Component

    almond0517
      Good morning Flex Gurus...

      I just have a simple question. I am trying to pass a value from an ArrayCollection coming from MySQL that was generated into a XML to the ScrollingText Compoment but is not being displayed by the component. However, when pass the value to a mx:Text, the value is actually displayed. The component code is posted below.

      Code to display the Scrolling text Correct:
      <comps:ScrollingText id="myScrollingText" text="Welcome to our Office..." fontSize="40"
      fontStyle="italic" initialize="myScrollingText.start()"
      color="#0053C4" fontWeight="bold" fontFamily="Arial"/>

      I successfully implemented a code to access the other parts of the generated XML to be displayed in my applicaton however when I tried to implement the same with the component and pass the value it did not work.

      Code that is not working:
      <mx:Repeater id="roomMarqueRepeater"
      dataProvider="{rest_service.lastResult.scheds.mrq.msg}" >

      <comps:ScrollingText id="myScrollingText" text="{roomInfoRepeater.currentItem.mrq_msg}"
      fontSize="40" fontStyle="italic" initialize="myScrollingText.start()" color="#0053C4"
      fontWeight="bold" fontFamily="Arial"/>
      </mx:Repeater>

      ScrollingText.MXML
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml"
      width="100%" height="50"
      horizontalScrollPolicy="off" verticalScrollPolicy="off"
      creationComplete="init()" fontSize="20"
      fontFamily="Verdana" color="#2C1FDB">

      <mx:Script>
      <![CDATA[
      import mx.controls.Text;
      private var myTimer:Timer = new Timer(10);

      [Bindable]
      public var text:String;

      public function start():void
      {
      myTimer.start();
      }

      private function init():void
      {
      myTimer.addEventListener(TimerEvent.TIMER, moveLabel);
      }

      private function moveLabel(event:TimerEvent):void
      {
      if (scrollingLabel.x < (0-scrollingLabel.width))
      {
      scrollingLabel.x = this.width;
      }
      else
      {
      scrollingLabel.x --;
      }
      }
      ]]>
      </mx:Script>

      <mx:Label id="scrollingLabel" x="{this.width}" text="{text}"/>
      </mx:Canvas>

      my XML that is Generated:
      <scheds>
      <mrq>
      <msg><mrq_id>1</mrq_id><mrq_msg>Welcome to our Office!!!</mrq_msg></msg>
      </mrq>
      </scheds>

      Hope someone can help. I tried looking for some parameter passing post but I can't find one that fit my needs.

      Thanks and good day to all...

      It really is fun FLEXING...
        • 1. Re: Passing XML value to a ScrollingText Component
          Level 7
          Adobe Newsbot hopes that the following resources helps you. NewsBot is experimental and any feedback (reply to this post) on its utility will be appreciated:

          Flex - Using Item Renderers:
          The second component is a Label in which we display the artist name and song title concatenated ..... I have an array collection that populates a datagrid.

          Link: http://blog.paranoidferret.com/index.php/2007/09/19/flex-using-item-renderers/

          Peter Ent: Flex 2 Archives:
          In Flex 1.5 it was pretty common to use an Array as a dataProvider to a List component, such as the DataGrid. That's because in Flex, the Array class

          Link: http://weblogs.macromedia.com/pent/archives/flex_2/index.html

          Peter Ent: Flex Solutions Archives:
          The UIComponent class is the basis for all visual Flex components .... does not work well for list controls but does perform nicely for a VBox and Repeater.

          Link: http://weblogs.macromedia.com/pent/archives/flex_solutions/index.html



          Disclaimer: This response is generated automatically by the Adobe NewsBot based on Adobe Community Engine.
          • 2. Re: Passing XML value to a ScrollingText Component
            Level 7

            "almond0517" <webforumsuser@macromedia.com> wrote in message
            news:g957an$j14$1@forums.macromedia.com...
            > Good morning Flex Gurus...
            >
            > I just have a simple question. I am trying to pass a value from an
            > ArrayCollection coming from MySQL that was generated into a XML to the
            > ScrollingText Compoment but is not being displayed by the component.
            > However,
            > when pass the value to a mx:Text, the value is actually displayed. The
            > component code is posted below.
            >
            > Code to display the Scrolling text Correct:
            > <comps:ScrollingText id="myScrollingText" text="Welcome to our Office..."
            > fontSize="40"
            > fontStyle="italic" initialize="myScrollingText.start()"
            > color="#0053C4" fontWeight="bold" fontFamily="Arial"/>
            >
            > I successfully implemented a code to access the other parts of the
            > generated
            > XML to be displayed in my applicaton however when I tried to implement the
            > same
            > with the component and pass the value it did not work.

            When you say "it did not work", what actually _did_ happen? did you get any
            errors? Have you set any break points and looked at values? If so, what
            results did you get?


            • 3. Re: Passing XML value to a ScrollingText Component
              almond0517 Level 1
              thanks for the reply.

              there were no errors actually. I havent tried debugging coz when i use the debug my Flex usually hangs up and says that it cant se the flash player.

              there is really no errors and will try debugging it however when i run the application the application works fine but the scrolling text doesnt show. Funny thing is if remove it from the repeater and change the text value of the scrolling text to some that is not coming from the XML or any value of a string it actually works.

              any suggestions thanks in advance for the help...


              • 4. Re: Passing XML value to a ScrollingText Component
                Level 7

                "almond0517" <webforumsuser@macromedia.com> wrote in message
                news:g96kq0$83i$1@forums.macromedia.com...
                > thanks for the reply.
                >
                > there were no errors actually. I havent tried debugging coz when i use the
                > debug my Flex usually hangs up and says that it cant se the flash player.
                >
                > there is really no errors and will try debugging it however when i run the
                > application the application works fine but the scrolling text doesnt show.
                > Funny thing is if remove it from the repeater and change the text value of
                > the
                > scrolling text to some that is not coming from the XML or any value of a
                > string
                > it actually works.
                >
                > any suggestions thanks in advance for the help...

                Try

                <mx:Repeater id="roomMarqueRepeater"
                dataProvider="{rest_service.lastResult.mrq.msg}" >

                <comps:ScrollingText id="myScrollingText"
                text="{roomInfoRepeater.currentItem.mrq_msg}"
                fontSize="40" fontStyle="italic"
                initialize="myScrollingText.start()" color="#0053C4"
                fontWeight="bold" fontFamily="Arial"/>
                </mx:Repeater>

                HTH;

                Amy


                • 5. Re: Passing XML value to a ScrollingText Component
                  almond0517 Level 1
                  Good AM.

                  Just checked your code and noticed that it wont work because of the declaration of the Repeater. If you will check you used the 2 different repeater names.

                  <mx:Repeater id="roomMarqueRepeater"
                  dataProvider="{rest_service.lastResult.mrq.msg}" >

                  <comps:ScrollingText id="myScrollingText"
                  text="{roomInfoRepeater.currentItem.mrq_msg}"
                  fontSize="40" fontStyle="italic"
                  initialize="myScrollingText.start()" color="#0053C4"
                  fontWeight="bold" fontFamily="Arial"/>
                  </mx:Repeater>

                  Also, i already tried this code and still nothing is being displayed in the ScrollingText component, another thing is when i use the repeater code you suggested and use a text not using the ScrollingText component and instead use a Label or text component and then pass the value of the {roomMarqueRepeater.currentItem.mrq_msg} it works and displays the value.

                  Thanks in advance hope someone can point me to the correct way to solve this problemm of ours.



                  • 6. Re: Passing XML value to a ScrollingText Component
                    Level 7

                    "almond0517" <webforumsuser@macromedia.com> wrote in message
                    news:g97jhd$9r5$1@forums.macromedia.com...
                    > Good AM.
                    >
                    > Just checked your code and noticed that it wont work because of the
                    > declaration of the Repeater. If you will check you used the 2 different
                    > repeater names.

                    I just copied your code. The only thing I changed was I took out the root
                    tag from the dataProvider below, since the XML object already _is_ the root
                    tag.

                    HTH;

                    Amy


                    • 7. Re: Passing XML value to a ScrollingText Component
                      almond0517 Level 1
                      Did you had it working???

                      I really don't know why it doesnt display. I tried it again, still doesnt work. Did it work on your side???

                      Hope someone can suggest us how to fix it.

                      thanks in advance once again.
                      • 8. Re: Passing XML value to a ScrollingText Component
                        Level 7

                        "almond0517" <webforumsuser@macromedia.com> wrote in message
                        news:g97r2r$h3c$1@forums.macromedia.com...
                        > Did you had it working???

                        I was just fixing an obvious problem I saw.


                        • 9. Re: Passing XML value to a ScrollingText Component
                          almond0517 Level 1
                          oh ic, hope someone can point us out to a solution to this problem.

                          I have tried multiple numbers of way to solve it but still to no avail...

                          hope someone can help us....calling flex gurus....

                          thanks in advance for the help.
                          • 10. Re: Passing XML value to a ScrollingText Component
                            Gregory Lafrance Level 6
                            Amy said the only thing she changed was she took out the root tag from the dataProvider, since the XML object already is the root tag.

                            So all she did was change

                            dataProvider="{rest_service.lastResult.scheds.mrq.msg}"

                            to this

                            dataProvider="{rest_service.lastResult.mrq.msg}"

                            Often when I am getting no errors I check to see if my dataProvider is defined with the correct level in the data, as Amy has pointed out.


                            • 11. Re: Passing XML value to a ScrollingText Component
                              almond0517 Level 1
                              Hello once again Flex Gurus....

                              Hope someone can help me again.... Problem still related with the threads below regarding the Scrolling Text....


                              <mx:Repeater id="roomInfoRepeater3" dataProvider="{rest_service.lastResult.scheds.mrq.msg}">
                              <mx:Canvas width="100%" height="50" horizontalScrollPolicy="off" verticalScrollPolicy="off">
                              <comps:ScrollingText id="myScrollingText"
                              text="{roomInfoRepeater3.currentItem.mrq_msg.toString()}"
                              fontSize="40" fontStyle="italic" initialize="myScrollingText.start()" color="#0053C4"
                              fontWeight="bold" fontFamily="Arial"/>
                              </mx:Canvas>
                              </mx:Repeater>


                              Now I can see the value from the XML. Now the problem is with the initialize="MyScrollingText.start()".

                              I am getting the error below:


                              TypeError: Error #1006: start is not a function.
                              at VSchedSysScreen2/__myScrollingText_initialize()[C:\Documents and Settings\Mondo\My
                              Documents\Flex Builder 3\VSchedSys\src\VSchedSysScreen2.mxml:139]
                              at flash.events::EventDispatcher/dispatchEventFunction()
                              at flash.events::EventDispatcher/dispatchEvent()
                              .
                              .
                              .
                              .


                              Hope someone can help me.

                              Thanks in advance...

                              almond
                              • 12. Re: Passing XML value to a ScrollingText Component
                                Level 7

                                "almond0517" <webforumsuser@macromedia.com> wrote in message
                                news:gcfb4o$o7$1@forums.macromedia.com...
                                > Hello once again Flex Gurus....
                                >
                                > Hope someone can help me again.... Problem still related with the threads
                                > below regarding the Scrolling Text....
                                >
                                >
                                > <mx:Repeater id="roomInfoRepeater3"
                                > dataProvider="{rest_service.lastResult.scheds.mrq.msg}">
                                > <mx:Canvas width="100%" height="50" horizontalScrollPolicy="off"
                                > verticalScrollPolicy="off">
                                > <comps:ScrollingText id="myScrollingText"
                                > text="{roomInfoRepeater3.currentItem.mrq_msg.toString()}"
                                > fontSize="40" fontStyle="italic"
                                > initialize="myScrollingText.start()" color="#0053C4"
                                > fontWeight="bold" fontFamily="Arial"/>
                                > </mx:Canvas>
                                > </mx:Repeater>

                                >
                                > Now I can see the value from the XML. Now the problem is with the
                                > initialize="MyScrollingText.start()".
                                >
                                > I am getting the error below:
                                >
                                >
                                > TypeError: Error #1006: start is not a function.
                                > at VSchedSysScreen2/__myScrollingText_initialize()[C:\Documents and
                                > Settings\Mondo\My
                                > Documents\Flex Builder 3\VSchedSys\src\VSchedSysScreen2.mxml:139]
                                > at flash.events::EventDispatcher/dispatchEventFunction()
                                > at flash.events::EventDispatcher/dispatchEvent()

                                http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf
                                Q9