ActionScript 3.0 :: "index" In A Sorted XML?
Dec 12, 2011I have and XML which contains the chart for the scores of a game.It's like this
HTML Code:
<?xml version="1.0"?>
<TetrisScore>
[code].....
I have and XML which contains the chart for the scores of a game.It's like this
HTML Code:
<?xml version="1.0"?>
<TetrisScore>
[code].....
I use an XML derived with PHP from a MySQL database to loop through a series of pictures.The XML I get from a database query gets sorted in the wrong order.I try to sort it by orde (is a columnname) but it keeps sorting by the ID. This is the PHP code to create the XML:
$link = mysql_connect("localhost", "xxxx", "xxxxxxxxx");
mysql_select_db("xxxxxxxxxxx");
$query = 'SELECT * FROM gallery WHERE categorie = "dessin" ORDER BY "orde" ASC';
[code].....
I have a table which stores high-scores, along with player ids. I want to be able to extract a record by a players id, and then get the rank, or position of their score in the table. Means, Basically I want to be able to say "you are in Nth" position, purely based on the players score against all other scores. For Example: if i am at 46th position then to me the position message will be like you are at 46th position out of total scores. Can anyone show me small example?
View 3 RepliesI have this array
myarray['array1'] = 321;
myarray['array2'] = 123;
myarray['array3'] = 213;
How can I get this order by value asc like this?
myarray['array2'] = 123;
myarray['array3'] = 213;
myarray['array1'] = 321;
I have a column in a data grid that has the values of "Monday", "Tuesday" etc, as varchars, and I wanted to know, how do i sort the column to be in the correct order. Doing a normal sort doesnt work obviously, as the days are not alphabetically ordered naturally (Wed after Thurs). I am assuming some sort of itemrenderer, but anyone got a snippet of code to illustrate how this would work?
View 1 RepliesI didn't find any clear explanation how list in ComboBox could be sorted alphabetically. It's very annoying that this ComboBox takes data from array (label/data) in random order.
View 2 RepliesSo, for sending to individual streams we have to reference the connected netStream we want to send to in some way like this:
sendStream.peerStreams[0].send("MyFunction",param1,param2);
and I have to determine which peer I'm sending to by their ID such as "peerID1234"
I know that you can check the peerID of the stream by doing:
sendStream.peerStreams[0]["farID"]
how can I make my send stream function know to use the array index where the peerID is?
so basically it could be like:
sendStream.peerStreams[where peerStreams[]["farID"] == peerID].send("MyFunction",param1,param2);
How should I go about matching the selected row of a sorted DataGrid to its source data row within its associated data provider?
For example, once a user sorts a DataGrid by clicking on one of the column headers, the target.selectedIndex from the CHANGE event (generated next time a row is selected) represents the index of the sorted row and not the index of the data as supplied by the data provider. Is there a simple way to map the index of the user selection back to the index of the original data?
I am using the DataGrid component in Flash, that is loaded with data via a external XML file. I have a column, A (Serial), which once loaded, I'd like for the information to be sorted Ascendingly, automatically.
Here is my code:
import fl.controls.DataGrid;
import fl.data.DataProvider;
import fl.controls.dataGridClasses.DataGridColumn;
import fl.controls.ScrollPolicy;
[Code]....
I have an AdvancedDatagrid which gets populated by an ArrayCollection. I ordered the ArrayCollection by date (one of its properties), so it shows from past to future. The thing is, if I refresh the GroupingCollection (for immediate display in the datagrid) After the Sorting of the ArrayCollection, the ordering of the dates in the ArrayCollection gets scrambled again, but displays the populated AdvancedDatagrid immediately. So in sum: from ArrayCollection > Sorting > Refresh the GroupingCollection > Populates the Adv.DataGrid, but the ArrayCollection is not sorted anymore.
View 2 RepliesI have a browser-deployed Flash app (not an AIR app with access to SQLConnection) and it fetches JSON results from a remote server via HTTPService. I need to extract subsets from the returned resultset, an array of objects, efficiently. Mutltiple calls through the cloud to the back-end won't do. It all has to happen client-side.Is there any collection class in Flex ActionScript that can sort an array of objects by one of the properties the objects all have in common, like the Array sortOn method, and then also provides a binary search method can extract a subset of objects from the sorted version of the array without visiting every item in the array and comparing?if I have an array of objects and each object had a zip property and a name property, I'd like to be able to extract all objects with zip = 10015 from the a copy of the original array where the copy has been sorted on zip.
View 2 RepliesI want to know which header the user clicked on to give the currently sorted view. Is there an API in flex framework that I can use to achieve this? Hopefully I can get back a column index so I know how it is currently sorted.
View 1 RepliesI use a flex mx:datagrid. I can set the headerBackgroundSkin to specify a skin or a picture to be displayed in all datagrid column's headers and it works just fine !
The problem is I can't find any way to specify a custom skin for the currently sorted column (doesn't matter if the sort is asc or desc, this is just to show the user which column is currently sorted).
I also tried to create a custom headerRenderer for each column but it is quite complicated and doesn't work very well.
I have been looking for the solution for a while but I can't find a good approach to do it. It sounds like a very basic need for me...incredible it is so complicated to achieve with Flex !!
I noticed someone was looking for the same thing few years ago but without success... [URL]
I have a list of 99 item (something like a phone book) and I will like to sort them in different method. Part of the 99 item might be empty, so the requirement is to move the empty field behind the sorted data in every sorting behavior, here the code we have so far:
[Code]...
I think it would be simplest to explain it like this:
[Code]...
Ive copied some code for an xml image viewer that contains a thumbnail scrollbar which loads an enlarged image on click. I want to change the code to go to the next image when I click on the big image. I cant seem to figure out how to find the current index number and add 1 to go to the next one in the onClickBack function.
function fileLoaded(event:Event):void {
myXML = XML(event.target.data);
xmlList = myXML.children();
[code].....
Is there a way to get the index of an array?
For instance, if I have an array:
buttons = Array("abc","def","ghi");
If I wanted to get the index dynamically of the string "ghi", could I do that with a certain function or piece of code?
I want to get tab Index with it's id. My tabs are in a tabNavigator.
this.tabid.instanceIndex returns -1
this.tabid.tabIndex returns -1
Do I have enable order or any property in tab Navigator to get the index of a tab?
I've set the tabIndex for three input boxes in a flash form. When tabbing through the boxes I get a green highlight. Is there a way to change the color or eliminate the highlight all together?
View 1 RepliesI'm using a for-statement to add a series of movieclips.
for (var i:Number = 0; i<10; i++) {
attachMovie("myMC", "myMC"+i, this.getNextHighestDepth());
}
Inside the movieclips I have some code. In this code I need the index-number of the movieclip. I'm staring the code off with: var indexr:Number = _root.i; The for-statement is so fast that all the movieclips get number 9 in the index-variable! Is there any trick to manage this, like can I get the index from the name in some way? Or do I have to work around it in some more or less complicated way?
I have a flash drop down menu that overlaps a separate flash piece in an HTML page. The example of what I am talking about can be found here: [URL]
When you hover over product types, you'll notice that the drop down falls under the 'water banner'. I have set the z-index of that specific banner to be lower than the flash header but it still did not work. When I change the 'water banner' to a static image instead of a flash file, the menu overlaps without a problem.
This is the style that I have applied to the navigation bar
#flash_piece {
z-index: 1;
position:relative;
top:0px;
}
I thought that there was a way to be able to name array indexes. Like instead of myArray[0], it could be myArray["tileFour"]. I thought that instead of using index numbers one could use index words.
View 1 RepliesI'm just fooling around making an inventory system and I was wondering if there is a way to work out the next available index in an array without pushing the item into the array.So for instance
var array:Array = new Array();
array[0] = new Object();
array[1] = new Object();
[code]....
a main movie clip (photo_group) which call an external movieclip from xml which call another movieclip which load a video... but the video is placed at the bottom of my main stage and i would like to have it at the top of everything.
main clip :
function loadClip():void { var Clip_request:URLRequest = new URLRequest( folderswf + photo_list[swf_no].swf); var Clip_loader:Loader = new
[code].....
I have used flash for several sites. I am using CS5. I'am use to publishing Flash files to the server, naming the HTML file as index, I also name my SWF file as index. But When I go to the web and look at my site, the tab syas index. I tried changing the SWF file to the name of the site, but this does not work. I also tried and renamed both files and indexnameofsite.HTML, but this also does not work. I tried looking at the script file (open it in notepad) but its mumbo jumbo to me.
View 5 RepliesThis assignmentis returning undefined:
var str=activeCarton.toString.substr(0,2);
where activeCarton is a variable referencing an array of movie clips. Does activeCarton contain the name of the mc or the index. How can I get the mc name string?
I created some classic text boxes and assign to each of them a tab index using the syntax: "fNameInput.tabIndex = 0; fNameInput.tabIndex = 1; fNameInput.tabIndex = 2;" etc.
afterwards, I decided to turn them into TLF boxes but after I did so, the tab index feature stopped to work.
What's wrong in my code and what should I do in order to turn on the tab index attribute?
Can I have a flash movie in a div under a another div file w/ content? I want to have this flash movie.[url]... and have a jquery slider over the top.
View 1 RepliesIs there a way to get the index of an array?
For instance, if I have an array:
buttons = Array("abc","def","ghi");
If I wanted to get the index dynamically of the string "ghi", could I do that with a certain function or piece of code?
I have a game map made of tiles, each tile is stored in an array called _tiles.The very each tile has a "plantable" parameter, which determines whether or not something can be placed on it.Then i loop through the array and check the position of each its elements against the mosue cursor, so I know which tile am I hovering with my mouse.
And it works pretty good. The problem is that even though I know what is the position of the tile I'm having the cursor on, I still lack the knowledge of what index is that tile. I simply can't tell where exactly in the array is placed this tile. I just know its position. The reason why I want to know the index of it, is because it's the only way for me to set a proper flag, namely whether it's plantable or not. Here's the code:
ActionScript Code:
for(var j:int = 0; j < _tiles.length; j++)
{
[code]...