List component row manipulation
I have two questions regarding as3 list component:
- I'd like to highlight and keep selected the item a user last selected from my list component. I've combed the live reference as well as google and must be typing the wrong search words. I can tell what label and index an item was that was selected but am not finding a way to highlight and keep highlighted the user's choice in the list component.
- Also, I'm exploring the notion of inline buttons within a list's rows. If a user hovers their mouse over a row, a set of small buttons come up the user can click on for further functionality. This may be more of a make your own component answer but I'm exploring it nonetheless. Any thoughts or comments on this?
Thanks!
no something else is going on. Or perhaps you didn't explain your problem clearly.
After servlet b calls getList() you have two servlets each having a reference to the same list
A------\
List
B------/
Similar Messages
-
Count the rows in a list-component
Hi,
How can I count the rows with a value in a list component?
I thought it would be RowCount but as I figured out that shows the number of shown rows, not the number of rows with a value.Hi,
Try list.dataProvider.length -
Selecting multiple rows from List-component
Hi
Could someone give me an example how to programmatically select multiple rows from List-component?
I know that this selects one row: lst_example.selectedIndex = 1;
But how about selectin indexes 1,2 and 4 for example?selectedIndices
A Vector of ints representing the indices of the currently selected item or
items...
var si:Vector.<int> = new Vector.<int>;
si.push(1);
si.push(2);
si.push(4);
list.selectedIndices = si; -
In Flash CS4,How can I give a AS3 List Component a suitable horizontalScrollBar
In Flash CS4 when an AS3 List Component has too many rows,it will has a verticalScrollBar automatically. but it will never has a horizontalScrollBar even a part of the content of the list is hidden.
I set the property list.horizontalScrollPolicy="on",and set list.maxHorizontalScrollPosition=200; then the horizontalScrollBar appear
but when I click the item of the list, all the list move to left, half of the list is hidden,
I can only see the right part of the list, the I click the list again,the list move to right,then I can see all the list by move the horizontalScrollBar
How can I give a suitable horizontalBar to the AS3 list component?Thank you for your help! (sorry,I`m bad in English...)
In fact, it works.
but,I made a mistake,the reason I want to give a list a horizontalScrollBar is:I want to show all content in a list that is not wide enough,
you see,first row can show all content in this list,but in the other rows,the content is too wide to show,I want to give the list a horizontalScrollBar to show all content by draging the horizontalScrollBar to right.
now,set property:
list.horizontalScrollPolicy="on", list.maxHorizontalScrollPosition=30;(the result is the image above),when I drag the horizontalScrollBar to right:
ah ha ,the row can`t show all content too,the horizontalScrollBar is related to the width of all the list, is not related to the width of the content in every row.
now I kown why the horizontalScrollBar is always disable.
but in design,to show a lot of content,we can`t draw a list too wide, it`s not beatiful,so I want to use a horizontalScrollBar to show all content in every row.
and the list is not too wide
ah ah, like the list in Flex4
In fact,ah,I have not studied Flex 4,so,I have to make it by using Flash CS4 Component
How can I do? Please
(so sorry for my bad English,I do my best in it) -
Help with a vertical scroll bar issue with a List component
hi. i have a basic <s:list> that uses an XMLListCollection as it's data provider and a very basic itemrenderer. when a row in the list is clicked a function gets the list.selectedIndex then populates some text fields with more xml data. that all works fine.. the problem i have is that the vertical scroll bar on the list seems to be "clickable" - just like a row in the list. the scroll bar scrolls normally but when it's clicked the selectedIndex becomes -1 which is not helpful b/c the value -1 is passed to the XMLListCollection.
any ideas? cheers.thanks but still problematic...surely the <s:List> component shouldn't return a value when the scrollbar thumb is clicked? i created a very basic list (see below) and made the list dimensions short enough so that there is a vertical scrollbar and found that when the scrollbar thumb is clicked the trace(event.currentTarget.selectedIndex) returns a number. that's annoying b/c i just want a selectedIndex value for a row that is clicked not the scrollbar.
any ideas to get around? cheers
<fx:Script>
<![CDATA[
protected function list1_clickHandler(event:MouseEvent):void
trace(event.currentTarget.selectedIndex);
]]>
</fx:Script>
<s:List x="162" click="list1_clickHandler(event)" y="276" labelField="@label" width="144" height="153">
<s:dataProvider>
<s:XMLListCollection>
<fx:XMLList xmlns="">
<node label="one"/>
<node label="two"/>
<node label="three"/>
<node label="four"/>
<node label="five"/>
<node label="six"/>
<node label="seven"/>
<node label="eight"/>
<node label="nine"/>
<node label="ten"/>
<node label="eleven"/>
</fx:XMLList>
</s:XMLListCollection>
</s:dataProvider>
</s:List> -
Why doesn't list component identify grid component
Hi,
I have couple of doubts.
1. I put <grid> component inside of <List>
component . Surprise! The <List> component is not identifying
the <Grid> component. Is this bug of Flex Or it's property of
Flex <List> component.
What I have to do to make <Grid> visible even I put
inside of <List> component.
2. what is an equilanat of <Table> in Flex. Ofcourse it
may be DataGrid. Suppose If I use DataGrid I have lot of
restrictions.
These are the problems I am facing with <DataGrid>
( i ) Is this possible to put radio button / link bar as one
of column in a row. I mean how to put radio button / link bar as
row in array
( ii ) Is it possible to make columns in a row as variable
sizes i.e. suppose if DataGrid header has size=100. Is it possible
to make column of next row size as 200.
anybody help me in this regard. I am eagarly waiting for
reply.Because I have been strugling to solve this problem for last
4 days.
Regards,
Siva KumarA custom itemRenderer will be the solution to several of your
issues(1,i).
For 2., there is no exact equivalent of an html table. Look
at Grid, TileList, or consider making your own component.
for ii), no, all cells in a columns must be the same size.
Tracy -
Problems With List Component Flash Cs3
Hello Friends,
I am working in Flash Cs3.
I am having a List component in my application.
I added 10 items into my list component. Now out of those 10 items, i want to disable particular list items like Item 4, Item 8, Item 9. How to do this using flash cs3 or flash 8.0.
Item1 -- Enabled state
Item2 -- Enabled state
Item3 -- Enabled state
Item4 -- Disabled state
Item5 -- Enabled state
Item6 -- Enabled state
Item7 -- Enabled state
Item8 -- Disabled state
Item9 -- Disabled state
Item10 -- Enabled state
Any suggestions/ideas would be really appreciated.
Regards,
RajeshHello Friends,
I got a partial solution for this. Now i can able to disable a particular list item using flash cs3. I achived this. But it was happening only after clicking the item values....
But i need in a diff way like, as soon as you run the flash file it has to disable. how is this possible in flash cs3.
this is the code :
import fl.controls.List;
import fl.controls.listClasses.CellRenderer;
import fl.controls.listClasses.ListData;
import fl.events.ListEvent;
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
var sampleItem1:Object = { label:"John Alpha" };
var sampleItem2:Object = { label:"Mary Bravo" };
var sampleItem3:Object = { label:"Trevor Gamma" };
var sampleItem4:Object = { label:"Susan Delta" };
var myList:List;
var tf:TextField;
ListDataExample()
function ListDataExample() {
createList();
tf = new TextField();
tf.x = 10;
tf.y = 125;
addChild(tf);
function createList():void {
myList = new List();
myList.move(10,10);
myList.addItem(sampleItem1);
myList.addItem(sampleItem2);
myList.addItem(sampleItem3);
myList.addItem(sampleItem4);
myList.rowCount = 4;
myList.addEventListener(ListEvent.ITEM_CLICK,listItemSelected);
addChild(myList);
function listItemSelected(e:ListEvent):void {
var cr:CellRenderer = myList.itemToCellRenderer(e.item) as CellRenderer;
var listData:ListData = cr.listData;
if(cr.listData.row == 2) {
cr.enabled = false
tf.text = "Row selected: " + listData.row;
waiting for your replies.
Regards,
Rajesh -
Cannot get more than 8 item in list component
Hi,
I can't get more than 8 items in list component using getItemAt(), it returns null. I will search more for this but no result.
Please Help me here to move to next step.
Thanks
Sureshkumar GIf you're asking if you can overall, yes you can:
http://help.adobe.com/en_US/as3/components/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f41.html
If you're asking if you can do this in the same context, off-screen, no you still get the same error as the .enabled property.
I hate to throw a hunch but I feel as though Adobe is employing something I'm used to in native iOS programming (Apple Devices). In lists they have something called "dequeue". It's the reason an extremely long list scrolls smoothly. What it does is render ONLY the rows that are in view. When a row is about to scroll off view it deallocates it from memory and then recreates the next row. They do this so you only ever have the current amount of viewable rows in memory and it speeds up scrolling. Although, I can make property changes to items in an iOS list that's off-screen so they don't have this issue ;(. Just food for thought.
I'd submit it to the bugbase and see what Adobe states. They may say they intend you to get the item in view, alter it and then go back to your previous position. That would be silly but at most I can tell you I definitely get errors trying to access an element outside my view. They're probably not used to items needing visual toggles when you can't even see them.
edit:
On a further note I tried the scrollToIndex() method, tried to disable, that much worked fine. The second I then scrolled back to the previously selected index the list screwed up.
I even daisy chained functions a second apart (30 frames worth of wait). I scrolled down and that worked so I waited 1 second. I disabled the visible item I wanted to and that worked so I waited another second. I scrollToIndex(0) to get back to the top of the list, the list blew up. Random items (several items) were disabled and the one that I explicitly disabled was enabled. -
Displaying Text in List Component
I am using AS3 to load data from an XML document into an Array and use the Array as a dataProvider for a List Component. If I addChild the list to the main timeline, everything works fine. All 38 elements show up in the list with readable text. When I addChild the list into a MovieClip, all 38 rows of the list get created, but no text shows up. What the hell is going on? Does anyone know what the fix for this is and why in the world this is happening?
Here's my code:
TOCList = new List();
TOCList.dataProvider= new DataProvider(TOCArray);
TOCList.labelField="theLabel";
TOCList.y=75;
TOCList.width=250;
TOCList.height=350;
addChild(TOCList);
When I change the addChild(TOCList) to navBar.sceneMenu.addChild(TOCList) the list shows up formatted correctly, just no text.I figured it out with help from another web site's forum and the problem was that the MovieClip that I was loading into was masked, so the font needed to be embedded and my code...
var myFormat:TextFormat = new TextFormat();
myFormat.font="Tahoma";
TOCList.setStyle("embedFonts", true);
TOCList.setStyle("textFormat", myFormat);
...wasn't working, but I didn't know, because the text wasn't showing.
The fix was actually to use the StyleManager...
StyleManager.setStyle( "textFormat", new TextFormat("Arial") );
StyleManager.setStyle( "embedFonts", true );
...to force all components to this style.
I have no idea why the above code doesn't work. If anybody knows, please tell me!!! -
hello everyone,
I've been working with Flex 3 for over a year and really want
to get into customizing components the best way possible, so i've
been digging into the classes. my first task is to create a smooth
tween when scrolling a List component instead of the default
"jumping" motion. So i decided to extend the list and do some
function overriding:
override protected function moveRowVertically(i:int,
numCols:int, moveBlockDistance:Number):void
var r:IListItemRenderer;
trace(String(listItems
[j]));
for (var j:int = 0; j < numCols; j++)
r = listItems[j];
prev_y
= r.y + moveBlockDistance;
//trace(r.y +" "+(r.y+ moveBlockDistance)+" "+prev_y);
TweenMax.to(r,0.5,{y:(r.y +
moveBlockDistance),ease:Sine.easeOut});
//r.move(r.x, r.y + moveBlockDistance);
rowInfo
.y += moveBlockDistance;
I've found moveRowVertically to be the method that actually
does the vertical row movement (called from the scrollVertically
method in the ListBase class). As you can see, i've added the
TweenMax where the object's move method was. This works
normally when the tween time is set to 0 sec, the List scroll
effect is the same as the stock component. But when TweenMax.to is
changed to 0.5 sec, the animation behaves strangely. I believe this
is partly because when a new object appears in the list it is
immediately added to the list, so the method that controls the
addChild needs to have the TweenMax animation also applied to. But
also, there is another problem, when you click the scroll arrow
before the TweenMax animation is complete, this function uses the
current y poisition (in the middle of the animation) as opposed to
the end y position- when the animation is complete. This is why the
TweenMax positions the items correctly when the TweenMax duration
is set to 0.
I
have an example here.
When you click the scroll arrow and wait for the animation to
complete, it works as the code expects. But when you click too fast
or scroll the scrollbar thumb, you can see the unexpected behavior.
SO what I believe needs to be added to the code is an array
that stores the end y coordinate and have the class use that
instead of the current y coordinate. I believe the best way to do
this is to store the end y coordinate in the listItems
[j] array so that i could call: TweenMax.to(r.end_y +
moveBlockDistance),ease:Sine.easeOut}); and all would be fine (for
the objects in the display, hopefully). But i cannot find the
original as file where the listItems property is (aka:
listContent.listItems as defined in the listItems get and set
methods in ListBase.as). Here i could extend this and define a
custom property. But a more important question is this: is it
possible to define a custom property on the fly, so i wouldn't have
to extend the listContent object (therefore, extending ListBase,
then List... on down the line)?
thank you all for your help!Ok I found out that it works fine in IE but not in FirefoX
HOWEVER it does work fine in Firefox from another computer! I tried
clearing out the cache but NOTHING...chan ANYONE PLEASE HELP
ME??? -
How can I select an item from a list component with a seperate button
This is a repost, I decided it'd probably be better here than
in the general discussion board. I will try to delete the other
one.
Hello Everyone,
This is my first post here. I am trying to figure out how to
select an item within a list component with a button. This button
is calling a function. I have searched for the past 3 hours online
and I can't find anything about it. I thought perhaps I could set
the selectedItem parameter, but that is read only, and I believe it
returns an object reference rather than something like a number so
even if i could set it, it would be pointless. I also found a get
focus button, thought that may lead me somewhere, but I think that
is for setting which component has focus currently as far as typing
in and things like that. I am lost.
Basically I am looking for a way to type this
myList.setSelected(5); where 5 is the 5th item in the list.
Any help would be much appreciated.Never mind found it. It is the property called selectedIndex
and it is writable -
How to populate list component via xml file?
There is a TextArea component that should show the name and
the description of the item selected in the list component. But I
dont know how to populate list with external XML and what should be
the coding in flash as well as what should be written in the XML.
Please help.Here's an xml file listing a couple of brother comedy teams:
<?xml version="1.0" encoding="UTF-8"?>
<team>
<brothers>
<Marx>
<name>Groucho</name>
<name>Chico</name>
<name>Harpo</name>
<name>Zeppo</name>
<name>Gummo</name>
</Marx>
<Howard>
<name>Moe</name>
<name>Curly</name>
<name>Shemp</name>
</Howard>
</brothers>
</team>
Open a new .fla and save it in the same folder as the .xml
file. Place a List Component on the Stage and name it (in this
case, "comicTeams_list"). In the first frame write the following
ActionScript:
//create XML object and load external xml file
var broList:XML = new XML();
broList.ignoreWhite = true;
broList.onLoad = processList; // this is a function that will
be written below
broList.load("populateList.xml");
function processList(success:Boolean):Void{
if(success){
loadList();
}else{
trace("Load failure");
function loadList():Void{
var broName:String;
var listEntries =
broList.firstChild.childNodes[0].childNodes[0].childNodes.length;
for(var i:Number = 0;i<listEntries;i++){
broName =
broList.firstChild.childNodes[0].childNodes[0].childNodes
.childNodes[0].nodeValue;
trace(broName);
comicTeams_list.addItem(broName);
//to make something happen when you click on a name in the
List, create a Listener and function
var broListListener:Object = new Object();
broListListener.change = someAction; //"someAction" is a
function to be written shortly
//add the Listener to the List
comicTeams_list.addEventListener("change", broListListener);
function someAction(evtObj:Object):Void{
var pickedBrother:String = evtObj.target.selectedItem.label;
//write actions here, referencing pickedBrother variable
The names of the Marx Brothers will appear in the box.
This is written in AS2. When you post a question, it's a good
idea include which version of ActionScript you're using. -
Adding Images to the List component
Adding Images to the List component while using the FLV
PLayback
All, ( i can send you my source files if it would help)
I'm using the FLV Playback component and loading videos into
it from an external xml file. I also have a list component tied to
the FLV playback that when you click on one of the elements in the
list, it plays that movie.
QUESTION:
My question is how do I add an image to the list component?
Below is the xml file and the actionscript. I've added the image
attribute to the XML file as img="time_square.jpg" and added the
element of the array when calling/creating the list. Did I do this
right?
Any direction would be very much appreciated.Adding Images to the List component while using the FLV
PLayback
All, ( i can send you my source files if it would help)
I'm using the FLV Playback component and loading videos into
it from an external xml file. I also have a list component tied to
the FLV playback that when you click on one of the elements in the
list, it plays that movie.
QUESTION:
My question is how do I add an image to the list component?
Below is the xml file and the actionscript. I've added the image
attribute to the XML file as img="time_square.jpg" and added the
element of the array when calling/creating the list. Did I do this
right?
Any direction would be very much appreciated. -
Using a List Component to create a photo gallery.
This feels like a lot to be asking but i'm gonna go ahead and
ask to see what happens.
I'm trying to figure out how to use a list component to
select 6 items from a large list, display the words to the 6
selected items (in a text field), then finally (by pressing a
button) I would like to load the 6 corresponding pictures for the
selected items into a seperate frame. If there is anyone that could
point me in the right direction it would be greatly appreciated. I
have been trying to find information online about programming the
List Component but haven't had any luck. Is there a book that
anyone recommends that could help me? I've been doing simple
animations and websites in flash but i'm now looking to learn some
actionscripting as well. Thanks.Hi PinkPowerRanger,
Per my understanding that you have two fields in the table "Date and Time picker" which is Date/time type and another is "Item ID", you need to get the Month from the Date field to display in the X-axis and count(Item ID) related to each
month to display in the Y-Axis, right?
I have tested on my local environment and can do this by create two calculated fields to get the month and year values from the Date/Time field.
Details information below for your reference:
Right click the main dataset to select the "Add Calculated field", specify an name of the new calculated field and add the expression in the field source as below:
Year: =Year(Fields!Date.Value)
Month: =MonthName(Month(Fields!Date.Value))
Add the three field in the Chart as below and remember in the Value area you have got the Count(ItemID) but not SUM(ItemID):
Preview you will got the chart like below:
If you still have any problem, please feel free to ask.
Regards
Vicky Liu
Vicky Liu
TechNet Community Support -
Horizontal Scroll in list component
Hi,
I'm using a list component which is populated from a textbox. I've set the horizontal scroll policy to auto and also to on however the scroll either doesn't appear (in the case of auto) or doesn't move (in the case of on). Is there a setting which I need to modify to have the horizontal scroll working normally?
ThanksI tried the invalidate method as follows but nothing happened:
mylist.invalidate();
Not sure if I explained myself well, I just want the horizontal scrollbar to appear and be able to move it when one or more items in the list are long and thus not all visible...thanks
Maybe you are looking for
-
How to make the text in a JSP editable?
I have created a telecalling application, in which I have generated the caller's script("good morning Mr.....this & that...blah blah blah) using a JSP! Some fields are picked up from the database & substituted in the script - personaliasation! now my
-
My iphone 5 speakerphone just stopped working today as i was on the phone. i have tried to use it, and it doesnt work. THis really stinks because now im completly unable to video chat and do other things.. please help!!!
-
Table name where all the SAP Script names are stored
Hi Gurus, Can i know the table name where all the SAP Script names are stored in SAP Database. Thanks in advance, Shyam.
-
Unavailablity of screen saver and contact group im...
Hello I have nokia 5230 nuron and 3110c handset even the basic java phones has the option like screen saver contact group image why the 5230 symb. set doesn't having those option prakash
-
Iphone4S : a column of the screen does not respond to touch.
There is a section, a thin coloumn on the right side of my screen that is irresponsive to touch. I cannot type my password because a part of the keyboard is there (And interestingly all keyboard layouts had that key at the same spot) I tried wiping m