Spark list component Icon property?

in Flex 3.x the VBox property was property of the icon that you can use to set the images in the elements of the list as well as the label property. How can I get the same thing in a Flex 4 spark list component?

I would like something like 'iconField' property set to the list item, so that my itemrenderer can be generic and not worry for a specific type of object is passed in.

Thank you!

~ Mike

I have the subclass would list, add an iconField property and change the default

renderer a converter custom will check data [iconField] for a

icon and display it.

Tags: Flex

Similar Questions

  • return data to spark list itemrenderer

    Everyone is not how to return data from the itemrender for a spark list. say I had a checkbx in my itemrenderer how can we retrieve this info to my component principal if his selected or not. I looked on the datagrid itemeditor but I really use rather a spark list. Thank you

    Hello

    itemRenderer should be used only as RENDERER. All chenges must be made in the data.

    So if there is a check box, you must add click eventListener and change the property in the data to see whether he is selected.

  • Access a drop-down list component created in fom runtime C++

    Hello everyone.

    I included a file "Settings.qml" as a ComponentDefinition in my file "main.qml" as follows:

    *******************************
    main.qml
    *******************************
    
    Page {
        id: page
    
        //App menu
        Menu.definition: MenuDefinition {
            settingsAction: SettingsActionItem {
                title: "Settings"
                imageSource: "asset:///icons/ic_settings.png"
                onTriggered: {
                    var settings = settingsSheet.createObject(_cam);
                    settings.open();
                }
            }
        }
    
        //Main container
        Container {        Camera {            id: cameraQML            objectName: "cameraQML"        }    }
    
        //Attached objects
        attachedObjects: [
            //*****this is the component definition****
            ComponentDefinition {
                id: settingsSheet
                source: "Settings.qml"
            }
        ]
    }
    

    Then, in the "Settings.qml" file, I have something like that.

    On the crack of onCreationCompleted I call you access of wich C++ function to the cameraQML component and gets the available resolution values and add them to the drop down list component.

    ***********************Settings.qml***********************
    
    Sheet {
        id: settingsSheet
        objectName: "settingsSheet"
        peekEnabled: true
        content: Page {        Container {            DropDown {
                    title: "Capture Resolution"
                    objectName: "resolution"
    
                    options: [
                        Option {
                            text: "16:9"
                            value: 16/9
                        }
                    ]
    
                    onCreationCompleted: {
                        _cam.loadResolutionValues();
                    }
    
                    onSelectedValueChanged: {
                        //_cam.selectResolution(selectedValue);
                    }
                }
            }    }}
    

    The PROBLEM comes when I try to access the menu item drop down because, even if I get error when you call the function findChild(), I do when I try to add Options by calling the add() function:

    ******************applicationui.cpp******************
    
    AbstractPane* root;Camera* cameraQML;DropDown* resolutionsDD;
    
    void AppliactionUI::ApplicationUI() {    //code...    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);    qml->setContextProperty("_cam", this);    root = qml->createRootObject();    cameraQML = root->findChild("camera");    //code...}void ApplicationUI::loadResolutionValues() {
        QVariantList reslist = camaraQML->supportedCaptureResolutions(CameraMode::Photo);
                    //**I don't get error by calling this function
            resolutionsDD = root->findChild("resolution");
    
            //**The app do crashes when calling any of these three functions
        //resolutionsDD->setTitle("Choose an option");        //resolutionsDD->removeAll();
        //resolutionsDD->remove(resolutionsDD->at(0));    for (int i = 0; i < reslist.count(); i++) {
            qDebug()<<"QVatiant value:"<add(Option::create().text(res.width()+"x"+res.height()).value(reslist[i]));
        }
    }
    

    I thought it was a problem with the type of value, I was put in the service. value() when you create an option, but then I realized that, while trying to change the title from the drop-down list, or delete i ' ts options that the application crashed also.

    This makes me think that the problem is that I'm not a correct reference for component drop-down menu QML due to the fact that this drop-down list does not exist when the application starts and is created until the user opens the Settings.qml file. Also, I think that this is a problem with all that stuff parent and child, but of course, it's just a feeling.

    I'd really appreciate your help on this type of problem. I'm not experienced enough to know what is the right way to get a reference of work to the drop down list component in question in a situation like this

    Thank you very much in advance!

    P.D. I'm sorry, I know that my English is not very good. Hope you do not misunderstand

    Hello
    Very probably findChild returns NULL and a NULL pointer dereference causes the crash. I remember there was problems with findChild during the use of the leaves.

    Try from the drop-down list directly to the function as an argument:

    (1) in applicationui.cpp:

    After:
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
    Add:
        // This is needed for passing DropDown in function parameters from QML to C++
        qmlRegisterType("bb.cascades", 1, 0, "DropDown");
    

    (2) modify the function declaration for:

    Q_INVOKABLE void loadResolutionValues(bb::cascades::DropDown *dropDown);
    

    (3) in QML:

    DropDown {
      id: dropDown
      ...
      onCreationCompleted: {
         _cam.loadResolutionValues(dropDown)
    
         // _cam.loadResolutionValues(this) // maybe this will also work, but I haven't checked
    
      }
    }
    
  • Spark list ItemRenderer 'data' is null.

    I use the same code in one place that I use in another, and still the event creationComplete that they prepare in the itemRenderer, the first line of code, trace("data") returns "null".

    This code has been fine for months of work and suddenly stopped working with no explanation.  I lost two days within period of fixation which should not be broken and I'm no closer to a solution.  Very frustrated. Any help appreciated - greatly.

    Puddleglum.

    = Component relevant code containing spark list = Output from the console displayed in the form of comments

    [Bindable]

    public var itemArray:ArrayCollection = new ArrayCollection();

    [Bindable]

    private var gap: uint = 6;

    private var file:File;

    private var fileStream:FileStream;

    private var toolXML:XML;

    protected function creationCompleteHandler (): void

    {

    trace ("FUNCTION MyLibraryToolsPanel creationCompleteHandler()");

    file = parentApplication.getFileOperations () .getToolFilepath ();

    trace ("file:" + file.url);

    }

    private void loadTool(xmlFilepath:File,_xmlFilename:String):void

    {

    trace ("MyLibraryToolsPanel FUNCTION loadTool ("+ xmlFilepath.url +"," + xmlFilename + ")"); / / MyLibraryToolsPanel FUNCTION loadTool (app-storage: / Tools/User000000, 000000Tool1371827886983.xml)

    var xmlFile:File = xmlFilepath.resolvePath (xmlFilename);

    If (xmlFile.Exists)

    {

    fileStream = new FileStream();

    fileStream.open (xmlFile, FileMode.READ);

    toolXML = XML (fileStream.readUTFBytes (fileStream.bytesAvailable));

    fileStream.close ();

    var obj:Object = new Object();

    obj.xmlFilepath = xmlFilepath;

    obj.xmlFilename = xmlFilename;

    obj.XML = toolXML;

    trace ("obj:" + obj); / / obj: [object Object]

    trace ("FUNCTION MyLibraryToolsPanel loadTool\n"+obj.xml.toXMLString ());   / / returns the XML when uncommented

    itemArray.addItemAt (obj, itemArray.length);

    }

    on the other

    {

    trace ("MyLibraryToolsPanel FUNCTION loadTool XMLFILE does NOT EXIST");  / / This will trigger never

    }

    < s:List id = "itemList".

    useVirtualLayout = "false".

    Changing = "listChangingHandler (Event)" "

    Click = "Event.stopPropagation (); »

    touchTap = "event.stopPropagation (); »

    scrollSnappingMode = "tip".

    Height = "height of {}.

    interactionMode = 'touch '.

    explicitHeight = "{height}".

    dropEnabled = "false".

    dragEnabled = "false".

    dragMoveEnabled = "false".

    allowMultipleSelection = "false".

    alternatingItemColors = "[0xe6e6fa, 0xF0F8ff].

    dataProvider = "{itemArray}.

    itemRenderer = "converters. MyLibraryToolsPanelListItemRenderer ".

    horizontalScrollPolicy = "off".

    verticalScrollPolicy = "on".

    borderVisible = "false".

    visible = "{ItemArray.Length > 0} '"

    includeInLayout = "{itemList.visible}" "

    Width = "100%" >

    < s:layout >

    < s:VerticalLayout id = "itemListVerticalLayout" variableRowHeight = "false" gap = "0" / >

    < / s:layout >

    < / s:List >

    < s:Label id = "noToolsMsg" text = "no tool saved available." horizontalCenter = "0" verticalAlign = "middle" red = "0" visible = "{itemArray.length == 0} ' includeInLayout ="{noToolsMsg.visible}"/ >"

    < / s:Group >

    = Renderer code that contains relevant sections =.

    protected function creationCompleteHandler (): void

    {

    trace ("FUNCTION MyLibraryToolsPanelListItemRenderer creationCompleteHandler"); / / MyLibraryToolsPanelListItemRenderer FUNCTION creationCompleteHandler

    trace ("data:" + data);  / / data: null

    dataProxy = new ObjectProxy (data);

    ...

    Looks like I'll change to use instead of the creationComplete dataChange in all my custom converters.  I can't believe I lost 2 days and more hair because of something so trivial as multithreading.

    Really... You cannot MAKE something before that data is passed and the rendering engine is INSTANTIATED ONLY when an element is added to the dataProvider... Then... the procedure.   Data added to dataProvider-online Insantiate WITH object relevant-Online Layout/rendering/upgrade to day-online THEN creationComplete();   Duh.  creationComplete is a misnomer if you don't even have the relevant data that you use to CREATE the instance.

    No doubt this would be avoided if the BUG that places the dummy rendering engine IN the dataProvider have been set, but as it is - not, been resolved, I have no choice but to disable put in virtual.   Sage, grumble, winge winge winge-grouse.

  • Custom spark list control

    I have a spark list control that displays a dynamically imported Images tilelayout.  Basically, a bunch of thumbnail Images that appear in a tile layout.  I slipped active so that I can reorganize these thumbnails and everything works great except for one thing, the who.  In my itemrenderer I included Image in the State "dragging", but the image does not appear in the who.  I'm basically just has a square semi transparent like my, but I want to be able to actually drag my sticker.  Any ideas how to do this?

    Here is my list:

    < s:List id = "ImageList1" x = "77" y = "95" width = "858" height = "412" dataProvider = "{imageAC}".

    itemRenderer = "converters. ImageACSmallItemRenderer"contentBackgroundColor ="0x000000 ".

    borderVisible = 'false' dragEnabled = "true" dropEnabled = "true" dragMoveEnabled = "true".

    allowMultipleSelection = "true" skinClass = 'skins. General.ListSkin' focusAlpha = '0' mouseMove = "getImageProxy (event)" >

    < s:layout >

    < s:TileLayout columnWidth = rowHeight = "76" "76" horizontalAlign = "center" verticalAlign = "middle".

    horizontalGap = "8" verticalGap = "8" / >

    < / s:layout >

    < / s:List >

    Here's my Itemrenderer:

    < fx:Script >

         <! [CDATA]

    import mx.utils.ObjectProxy;

    [Bindable]

    public var dataProxy:ObjectProxy;

    private function init (): void {}

    dataProxy = new ObjectProxy (data);

              }

         ]]>

    < / fx:Script >

    < s: states >

    < s: State name = "normal" / >

    < s: State name = "flat" / >

    < s: State name = "selected" / >

    < s: State name = 'slide' / >

    < / s: states >

    < mx:Image source = "{dataProxy.pathSmall}" horizontalCenter = red "0" = "0" includeIn = "normal, hovered, selected, dragging" / > "

    < / s:ItemRenderer >

    Thanks for any idea!

    Hi Bill,

    Looks like you create a new object for each ItemRenderer ContentCache, to create a single instance shared, add "static" like this:

    static public var contentCache:ContentCache = new ContentCache();
    

    This will ensure that the contentCache variable is shared between all of the ItemRenderers.

    In addition, in my view, there is no need to explicitly call the contentCache like this:

    contentCache.load(dataProxy.pathSmall);
    

    Fixing the contentCache just the contentLoader on the Image property, the way you have done should be sufficient.

    I just do a quick experiment and here is an example with an ItemRenderer that exposes the problem:

    
    
        
    
    
    

    And here's workaround with contentCache (works well for me in the AIR):

    
    
                    
    
        
    

    See you soon,.

    Evtim

  • SelectedItems value for List component

    I was able to put 1 items in a list, but not many. I've searched and searched and I can't find out how to do this.

    This code is taken to the right of the section of help for the List component documents in the List.selectedIndices section.  Add an instance to the stage and name it my_list and the code will do the rest.  In the code, a table is used to assign multiple selections, since it is implied the selectedIndices, an array property... my_list.selectedIndices = [0, 2];

    my_list.multipleSelection = true;

    my_list. AddItem ({data: "flash animation", label: "Flash"});
    my_list. AddItem ({data: "dreamweaver", label: "Dreamweaver"});
    my_list. AddItem ({data: "coldfusion", label:"ColdFusion"}); "})

    my_list.SelectedIndices = [0, 2];

    var numSelected:Number = my_list.selectedIndices.length;
    for (var i: Number = 0; i< numselected;="" i++)="">
    trace ("selectedIndices [" + i + "] =" + my_list.getItemAt(my_list.selectedIndices[i]).label);
    }

  • need help with change in spark list itemRenderer

    Hey guys... so I have a spark list, where I've made available to tileLayout and I use the converter component to display an image and two buttons in each tile... what im trying to do is when you hover over each tile I want buttons fade in and out... and by default... I need to no visible buttons...

    I had pimples fade in and out when you hover over the point... but the problem is that I have when I initialize the application buttons are all visible... If there is no sence...

    any help is greatly appretiated!

    Here is the code I have... can you tell me what changes I need to make...

    <s:List id="searchResultImages" borderVisible="false" dataProvider="{searchImages}" width="100%" height="100%">
         <s:layout>
              <s:TileLayout requestedColumnCount="6" horizontalGap="30" columnWidth="100" rowHeight="85" />
         </s:layout>
         <s:itemRenderer>
              <fx:Component>
                   <s:ItemRenderer>
                        <s:states>
                             <s:State name="hovered" />
                             <s:State name="normal" />
                        </s:states>
                        <s:transitions>
                             <s:Transition fromState="normal" toState="hovered">
                                  <s:Fade id="hoveredFade" targets="{[delBtn, editBtn]}" alphaFrom="0.0" alphaTo="1.0" duration="1000" />
                             </s:Transition>
                             <s:Transition fromState="hovered" toState="normal">
                                  <s:Fade id="normalFade" targets="{[delBtn, editBtn]}" alphaFrom="1.0" alphaTo="0.0" duration="1000" />
                             </s:Transition>
                        </s:transitions>
                        <s:VGroup>
                             <mx:Image source="{data.fileLoc}" width="100" height="50" useHandCursor="true" buttonMode="true" verticalCenter="0" />
                             <s:HGroup>
                                  <mx:LinkButton id="delBtn" label="DEL" skin="{null}" color="#0184C7" rollOverColor="#333333" useHandCursor="true" 
                                                    buttonMode="true" />
                                  <mx:LinkButton id="editBtn" label="EDIT" skin="{null}" color="#0184C7" rollOverColor="#333333" useHandCursor="true" 
                                                    buttonMode="true" />
                             </s:HGroup>
                        </s:VGroup>
                   </s:ItemRenderer>
              </fx:Component>
         </s:itemRenderer>
    </s:List>
    

    Hello

    With a lot of intelligence are already integrated into state transitions, when for example the transition fading knows when to fade in or fade out, get your components placed in the States you want is all that is necessary.

    This is a simple example, but as you can see there is almost no code involved...

    http://gumbo.flashhub.NET/Cyber/ source included

    David.

  • generate the List component: make all child elements on createComplete?

    Hello

    It is my understanding that a list created only children who are visible and children who lie immediately next to the display window. When scrolling, the other children in the list are created when they are ready to be displayed in the display window. I understand that it is an internal mechanism to free up memory and speed up the rendering of provision process.

    My question is, it is possible to set a property or to create a method to add all children is made in the list at present, it is created, rather than limiting children to only close the display window? Thank you b

    For the Spark list, I'll try defining a layout custom with useVirtualLayout = false

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc..

    Blog: http://blogs.adobe.com/aharui

  • I can't get rid of ccSvcHst.exe in the list of icons in notification area.

    I can't get rid of ccSvcHst.exx in the list of icons in notification area.  He indicates that he belongs to Norton Internet Security.  My new computer came with Norton on it.  Natch.  First things to get out were three Norton programs.  The free 60 day trial of Norton internet Security, Norton backup program and VIP access.  I used the function uninstaller in the control panel of Windows 7 sp 1.  When I noticed this ccSvcHst.exe in the list of the notification icons, I guessed that it was a case of undesirable residue left by Norton, so I used the removal tool mentioned on this site.

    http://us.Norton.com/support/kb/web_view.jsp?wv_type=public_web&docURL=20080710133834EN&LN=en_US

    But ccSvcHst.exe is always in the list of icons in notification area.  And I wonder how much other stuff hidden Norton is still on this new computer.  I would appreciate any advice on how to get rid of it.  There may be a third party removal tool that is safe and not provided by Norton that could be more complete.

    Thank you

    Department of public works

    We need remove IconStreams, PastIconStreams in the registry key, and then restart...

    See:
  • Horizontal scrolling in the list component

    Hello

    I use a list component, which is filled from a textbox control.  I set the horizontal scroll policy to automotive and also we however scrolling does not appear (in the case of auto) or does not move (in the case of it).  Is there a setting I need to change to make the scrolling work normally?

    Thank you

    you need not use invalidate().  use:

    lc.horizontalScrollPolicy = ScrollPolicy.ON

    lc.maxHorizontalScrollPosition = 200;   Use an appropriate number

  • How to dynamically add data in a Spark list control

    Hi, I have a spark list in one of my custom components() control(id="Cclist") and a text input control. When a value is entered in the entry of the texts, I want to dynamically add the same in the list control. I tried to do the following:

    protected function Cc_selectHandler(event:CustomEvent):void

    {

     var cctext:DisplayObject = event.data as DisplayObject
    CcList.enabled = true;
    CcListButton.enabled = true;

    CcList.addChild(cctext);

    }

    But I get an error saying "addChild() is not available in this category.  "Instead, use addElement(), or change the skin. So I tried to use addElement, but apparently it is not available at all. No idea what im doing wrong?

    Add the text entered in the textinput to the dataProvider of the list in the appropriate format.

    A simple example:

    
    
        
            
        
    
        
            
        
    
        
            
        
        
        
        
    
    
  • ActionScript for List component

    I'm developing a glossary for a course of training, and I have my list component set up with all my terms.  Now, I need to program when the user clicks on a term, the definition appears.  I thought there was a way to do it, but my book does not in this detail.

    can anyone help?  Here's actionscripting I found online, but he says he can not work with Actionscript 3.

    Import fl.controls.List;
    Import fl.controls.TextArea;
    import flash.events.Event;
    Import fl.data.DataProvider;

    var glossary: List = new List();
    var Definition_Text:TextArea = new TextArea();
    var items: Array =]
    {label: "AbbrDial", data: "Dial allows an index number speed dial."},
    {label: "Response", data: "Allows you to answer a call."},
    {label: "Back", data: "Lets go back to the previous Help topic."},
    {label: "Barge", data: "Allows you to add yourself to a call on a party line."},
    {label: "Recall", data: "Allows you to be notified when a busy extension will be available."},
    ];
    Glossary.dataProvider = new DataProvider (items);

    addChild (Glossary);
    addChild (Definition_Text);

    Glossary.Move (150,150);
    Definition_Text.move (150, 260);

    Glossary.addEventListener (Event.CHANGE, changeHandler);

    function changeHandler(event:Event):void {}
    Definition_Text.text = event.target.selectedItem.data;
    };

    You don't need to build components, just them in the library.  The code does all the work for you.

    Open a new file, copy the code you posted to frame 1 of the scenario of this file... go into the component library and drag an instance of the List component to the stage and then delete it. go in the asset library, drag an instance of the TextArea component to the stage and then delete it..., run the file.

  • spark list removeChildAt error

    I am trying to remove an item from the spark list books as follows:

    books.removeChildAt (books.selectedIndex);

    but I get an error when I run the method:

    Error: removeChildAt() is not available in this category. Instead, use removeElementAt() or change the skin, if you have a.

    they do not compile if I use removeElementAt() as the s:List does not have this method. I do not have a skin to change either.

    How can I delete the item in the list? Thanks - brandon

    remove the item from the dataprovider of the list.

    list.dataProvider.removeItemAt(list.selectedIndex);
    
  • How to refresh a Spark list manually?

    Hello

    I'll build a News Module, which consists of a DataGrid and a spark with a customItemRenderer list.

    When I click on the item in the DataGrid control, I get the 'newsID' of the item clicked and receive the newsDetails associate my data in an ArrayCollection collection.

    This table Collection is the dataprovider for my spark list.

    Okay, well, when I click on the first point, nothing works like it supposed to be.


    But when I click the second entry, for example, the list of the spark is not following and display the changed data but the ArrayCollections are updating of data.

    I checked in the binder to an another DataGrid that owns the ArrayCollection as a DataProvider collection.

    So my question now is to know how to manually refresh a list of Spark.

    On google I found that someone suggested to set the ItemRenderer of the spark to null list and re - declare.

    http://www.mail-archive.com/[email protected]/msg132923.html

    How would I do this programmatically?

    = null myList.itemRenderer and that?

    My custom item converter is called HListRenderer.mxml

    Any help is very appreciated

    Marc

    Try:

    myList.itemRenderer = null;

    Group1.itemRenderer = new ClassFactory (HListRenderer);

    See the latest example of code here:

    http://flexponential.com/2009/11/02/different-ways-of-assigning-an-item-renderer-in-Flex-4 /.

  • How to animate a dataGroup spark list when the user travels through elements?

    How can I get the dataGroup have an effect when the user travels through the list?

    I came across this example that uses a HGroup:

    olling-through-items-in-a-spark-hgroup-container/ http://blog.flexexamples.com/2009/11/11/Creating-an-Animated-transition-when-SCR

    .. who is the exact effect I would like a list.

    Taking the example of HGroup you posted you can do something similar with a spark list by animating the position of scroll on the page layout:

    http://ns.Adobe.com/MXML/2009.
    xmlns:s = "library://ns.adobe.com/flex/spark" >
       
            Import spark.core.NavigationUnit;
               
    protected function scrollToThere(dir:int):void {}
    var value: Number = listLayout.getHorizontalScrollPositionDelta (dir);
    If (value! = 0) {}
    pth.valueBy = value;
    Anim.Play ();
    }
    }
    ]]>
       

       
       
           
               
                   
               

           

       

       
       
    horizontalCenter = red '0' = '0' >
           
               
           

           
           
           
               
                   
               

               
                   
                       
                           
                       

                   

               

               
                   
                        one
                        two
                        three
                        four
                        five
                        six
                        seven
                        eight
                        nine
                        ten
                        Eleven
                   

               

           

           
       
       

Maybe you are looking for