Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Unhighlighting items in a TileList

Guest
Dec 29, 2012 Dec 29, 2012

Good morning,

I'm trying to figure out how to unhighlight/deselect an item in a TileList.  When the list is initialized, no items are highlighted, but once you click an item, it seems there is no way to unhighlight/remove that blue background once an item has been clicked. 

I've tried resetting the selected index manually to -1, and using the clearSelection() method, and while that does seem to change the index to -1, the actual image itself is still highlighted and appears to be selected.

I've searched tutorials and sites for the past day, and tried playing around with code, to no avail.

Here is my basic code (based off the Adobe help example), I've erased all the attempts and tactics I've tried to make it work, so this is just the basic example:

package

{

    import fl.controls.TileList;

    import fl.controls.ScrollBarDirection;

    import flash.display.MovieClip;

    import fl.events.ListEvent;

    import flash.events.Event;

    public class TileListExample extends MovieClip

    {

        var myTileList:TileList = new TileList();

        public function TileListExample()

        {

            myTileList.addItem({label:"Image 1", source:"http://www.helpexamples.com/flash/images/image1.jpg"});

            myTileList.addItem({label:"Image 2", source:"http://www.helpexamples.com/flash/images/image2.jpg"});

            myTileList.addItem({label:"Image 3", source:"http://www.helpexamples.com/flash/images/image3.jpg"});

            myTileList.direction = ScrollBarDirection.VERTICAL;

            myTileList.columnWidth = 200;

            myTileList.rowHeight = 150;

            myTileList.columnCount = 1;

            myTileList.rowCount = 2;

            myTileList.move(10, 10);

            addChild(myTileList);

            myTileList.addEventListener(ListEvent.ITEM_CLICK, itemClicked);

        }

        private function itemClicked(e:Event)

        {

            myTileList.clearSelection();

        }

    }

}

Thanks

TOPICS
ActionScript
796
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 29, 2012 Dec 29, 2012

use:

package

{

    import fl.controls.TileList;

    import fl.controls.ScrollBarDirection;

    import flash.display.MovieClip;

    import fl.events.ListEvent;

    import flash.events.Event;

    public class TileListExample extends MovieClip

    {

        var myTileList:TileList = new TileList();

        public function TileListExample()

        {

            myTileList.addItem({label:"Image 1", source:"http://www.helpexamples.com/flash/images/image1.jpg"});

            myTileList.addItem({label:"Image 2", so

...
Translate
Community Expert ,
Dec 29, 2012 Dec 29, 2012

use:

package

{

    import fl.controls.TileList;

    import fl.controls.ScrollBarDirection;

    import flash.display.MovieClip;

    import fl.events.ListEvent;

    import flash.events.Event;

    public class TileListExample extends MovieClip

    {

        var myTileList:TileList = new TileList();

        public function TileListExample()

        {

            myTileList.addItem({label:"Image 1", source:"http://www.helpexamples.com/flash/images/image1.jpg"});

            myTileList.addItem({label:"Image 2", source:"http://www.helpexamples.com/flash/images/image2.jpg"});

            myTileList.addItem({label:"Image 3", source:"http://www.helpexamples.com/flash/images/image3.jpg"});

            myTileList.direction = ScrollBarDirection.VERTICAL;

            myTileList.columnWidth = 200;

            myTileList.rowHeight = 150;

            myTileList.columnCount = 1;

            myTileList.rowCount = 2;

            myTileList.move(10, 10);

            addChild(myTileList);

myTileList.selectable=false;

            myTileList.addEventListener(ListEvent.ITEM_CLICK, itemClicked);

        }

        private function itemClicked(e:Event)

        {

            myTileList.clearSelection();

        }

    }

}

p.s. please mark helpful/correct responses.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 29, 2012 Dec 29, 2012

Thanks!  You gave me the key, and from there I figured out how to toggle the selection on/off.

I'll clean up my code, add some comments and then post the solution I went with.

Thanks again!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 29, 2012 Dec 29, 2012
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines