2 Replies Latest reply on Aug 21, 2012 12:09 PM by Kristin95762

    BorderContainer vs HorizontalList

    Kristin95762 Level 1

      Hi

       

      I have a borderContainer that I am loading up with an array of images from sqlite.

       

      As I mouse over each image, it's y value changes to indicate it's selectability.

       

      This all works quite well.

       

      The problem is that since I'm not loading these images into a data aware object, I don't have access to the information that I need.

       

      Ultimately I want to be able to click on the image and have an enlarged copy of it placed into a new container and display the associated

      data.

       

      So the question is how to link the data to the image? What is the method I would use here?

       

      Unless I can get a list control to perform the way I want it to...

       

      Thanks

       

      Kristin

       

      private function result(event:SQLEvent):void

                                    {

                                              var data:Array = selectStmt.getResult().data;

       

                                              for (var i:int = 0; i < data.length; i++)

                                              {

        

                                                        var card:Loader = new Loader();

                                                        imageUrl = "assets/" + data[i].image;

      cardImage = new UIComponent();

       

                                                        card.load(new URLRequest(imageUrl));

                                                        cardImage.addChild(card);

                                                        bc1.addElement(cardImage);

                                                        cardImage.scaleX = .5;

                                                        cardImage.scaleY = .5;

                                                        cardImage.x = 25*i;

                                                        cardImage.y = 5;

                                                        cardImage.addEventListener(MouseEvent.ROLL_OVER, onRollOver);

                                                        cardImage.addEventListener(MouseEvent.ROLL_OUT, onRollOut);

                                              }

                                    }

       

                                    private function onRollOver(e:MouseEvent):void

                                    {

      var hoveredImage:Object = e.currentTarget;

                                              hoveredImage.y = -15;

                                              cardImage.removeEventListener(MouseEvent.ROLL_OUT, onRollOver);    

                                    }

       

                                    private function onRollOut(e:MouseEvent):void

                                    {

                                              var hoveredImage:Object = e.currentTarget;

                                              hoveredImage.y = 5;

                                              cardImage.removeEventListener(MouseEvent.ROLL_OVER, onRollOut);

                                    }