6 Replies Latest reply on Oct 18, 2009 11:55 AM by Kaboom42

    Image with bound source

    Kaboom42

      OK, so now I have:

      <mx:Image source="{boxes..box0.pkmn1.img}" width="32" height="32"/>

       

      When I run the program, boxes starts as an empty XML object, which is then filled by an HTTPService. However, I get this error before anything displays:

       

      Error: Unable to load ''.
      at mx.controls::SWFLoader/loadContent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\controls\SWFLoader.as:1617]
      at mx.controls::SWFLoader/load()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\con trols\SWFLoader.as:1380]
      at mx.controls::SWFLoader/commitProperties()[C:\autobuild\3.2.0\frameworks\projects\framewor k\src\mx\controls\SWFLoader.as:1167]
      at mx.core::UIComponent/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framewor k\src\mx\core\UIComponent.as:5807]
      at mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\fr amework\src\mx\managers\LayoutManager.as:539]
      at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:659]
      at Function/http://adobe.com/AS3/2006/builtin::apply()
      at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
      at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]

       

      I have no idea what any of this means :S...

        • 1. Re: Image with bound source
          Gregory Lafrance Level 6

          Maybe try this:

           

          <mx:Image source="{boxes..box0.pkmn1.img.source}" width="32" height="32"/>

           

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

          • 2. Re: Image with bound source
            Kaboom42 Level 1

            Sadly not. The same error occurs.

             

            The XML in question is of the form:

             

            <boxes>

                 <box0>

                      <name>Box 1</name>

                      <pkmn1>

                           <img>http://pokefarm.adamhaskell.net/_img/animicon/257.gif</img>

                      </pkmn1>

                      <pkmn2>

                      [...]

                 </box0>

                 <box1>

                 [...]

            </boxes>

             

            I think it would be better practice to remove the number indices on the tags, but then I'm not sure how to access, say, box5. Would that be something like boxes..box[5]?

             

            Thanks for your help on this

            • 3. Re: Image with bound source
              Kaboom42 Level 1

              I've found out that having no souce, then updating the source with boxes..box0.pkmn1.img works fine. However, there can be up to 300 images to be loaded, and having to set each one in turn could be quite long. If anyone can help with the binding problem or tell me how to access the nodes of the XML file numerically, then I'll be on the right track.

              • 4. Re: Image with bound source
                Kaboom42 Level 1

                I've done a bit of working on this, and I've worked out that I'm stuck!

                 

                Since the eval() function is removed in ActionScript 3, there's no practical way I can work out of updating all the images when the data has loaded.

                If the error is caused by the image being assigned a source that is undefined, then the only practical way I can see of solving this is to have an XML file included in the .swf, which has all the fields as blank... But I can't work out how to make that work...

                 

                I need help here...

                • 5. Re: Image with bound source
                  Gregory Lafrance Level 6

                  Can your images be displayed using a Repeater, TileList, or some other component that uses dataProvider?

                   

                  If so, initially have the dataProvider have dummy empty data, and then populate it with data when the data has been loaded.

                   

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

                  • 6. Re: Image with bound source
                    Kaboom42 Level 1

                    Oops, I missed the e-mail notification of the response.

                     

                    I have given up on this project, and will be using PHP and JS again. However, your solution looks like it would have worked, so I'll give you the "Correct Answer" rating.

                     

                    Thanks anyway.