ActionScript 3.0 :: Flash Sorting Weapons + Monsters?
Jul 18, 2010
I've just started making a RPG game.I want to add alot of monsters, and I'm looking for a way to keep all my monsters in one class maybe? So I'd have a class called "Monsters" and in it it would be like:
Code:
Monster1{
Strength = 50;
Stamina = 25;[code].....
Is there a way I can store my monsters like that, AND read them from my main timeline, so when my character enters my dungeon, it will take a random monster from that class file? And also I would need to get the stats from the monster, so I can calculate the damage dealth.I would also need a system like this for sorting out all my weapons in game, where the stats are kept too.
View 6 Replies
Similar Posts:
Mar 28, 2012
I have been trying to sort an XMLListCollection following instructions like this for some time, without success. Here's the relevant code:
<fx:Declarations>
<s:HTTPService id="photoServ" url="pics.xml" resultFormat="e4x"/>
<s:XMLListCollection id="photoList" source = "{photoServ.lastResult.photo}"/>
[code]......
View 2 Replies
Oct 8, 2009
would anyone beable to help with sorting out an XML file, what I have is a tooltip that loads in via XML and exported from flash. the XML loads in 2 text fields, field and field2. what I am trying to do is add a button also to the tooltip so that you can click and go to a url. this is what I have in my XML file;
[Code]...
View 15 Replies
Aug 5, 2009
Iam trying to do a highscore list which is generated on a website as Xml and then send to Flash. I have got the Xml to be loaded into Flash but the probelm is that i want them to be sorted in so the highest score is on the top and then its going to down to the lowest score.
[Code].....
View 0 Replies
Jul 9, 2011
var dataArray:Array = [ 5, 6, 3, 8, 10, 11, 32, 2 ];
var dataObjectArray:Array [ { "uid": 5 }, { "uid": 6 .... Similar to above ... } ];
I have the above 2 arrays in AS3. and i wish to sort them numerically (1 ~ X) in order [Skipping those that does not exist]. What is the best and most efficient way to do so for dataArray / dataObjectArray.
View 2 Replies
Nov 4, 2011
How would I go about sorting an array of nested arrays, based on the contents of one of the nested arrays elements?
var nestedArray1:Array = new Array(0,0,1);
var nestedArray2:Array = new Array(0,0,9);
var nestedArray3:Array = new Array(0,0,7);
[code].....
View 2 Replies
Dec 14, 2010
I have a set if variables:
Code:
var appleCount:Number = 8;
var bananaCount:Number = 5;
var carrotCount:Number = 2;
[Code].....
What I want to do is sort them by value.
Basically I have some fruit and veg objects, and I want to add 5 randomly to the scene. So the first time you run the application, you might get a banana, apple, carrot, kiwi and grape. Then another time it might be apple, kiwi, cabbage, pineapple and banana.
But I want to make it based on how many times they have been seen previously. So if the count variables are as shown above, how can I sort the fruit and veg objects in to order, so I only add the lowest 5? Bearing in mind, the numbers might all be the same. I.e. the first time it's played, the count for all objects will be 0. So I want to choose 5 random fruit/veg with the lowest value.
I assumed the best way to do this would be to put them in to an array, sort it and select [0], [1], [2], [3] and [4]. But how can I put the values in to the array and sort them without losing the fruit/veg they are associated with?
I.e. if I end up with an array of {2,3,5,5,5,5,8}, I have no idea which fruit and veg they represent.
View 2 Replies
Jul 6, 2010
im trying to fix the flash overlap using regular expressions. here is an example of markup im trying to convert to my needs
<object width="440" height="300" data=
"http://www.youtube.com/v/dMH0bHeiRNg&color1=0xb1b1b1&color2=0xd0d0d0&hl=en_US&feature=player_embedded&fs=1"
[code]......
View 3 Replies
Aug 18, 2010
I'm creating a table that displays information from a MySQL database, I'm using foreignkeys all over the place to cross-reference data.
Basically I have a datagrid with a column named 'system.' The system is an int that represents the id of an object in another table. I've used lableFunction to cross-reference the two and rename the column. But now sorting doesn't work, I understand that you have to create a custom sorting function. I have tried cross-referencing the two tables again, but that takes ~30sec to sort 1200 rows. Now I'm just clueless as to what I should try next.
Is there any way to access the columns field label inside the sort function?
public function order(a:Object,b:Object):int
{
var v1:String = a.sys;
[Code]....
View 2 Replies
Mar 25, 2009
Quick Question, I just started learning the psuedo 3D methods in FP10, and as a sample I am creating a virtual rolodex. It is dynamically generated with a user inputted number of cards. The cards are then added to the stage and are rotated around a central axis using the function below.
[Code]....
After this is created I have an Enter Frame listener that rotates the cards around that axis based on mouse position. Problem is that they get depth sorted based on the order that they are created, cardArray[0] in back all the way up to whatever the number of cards is. I have tried a few of the simple Z sorting classes and noticed that my cards dont actually change there Z property, only their rotationX. I was just wondering if anyone might know of an easy way to depth sort these. Otherwise the best idea I can come up with is to check the rotation based on 360 degrees and assign a depth. That seems like a lot of ugly math though if you want to see what the swf looks like check here.
View 5 Replies
Feb 21, 2011
I'm not quite sure how to do this - I'm building an admin interface to sort the order of a series of flash slides into a dynamic presentation. The admin interface pulls the slides from xml and displays each as a thumbnail. The thumbnails, when dragged, reorder themselves in the array appropriately. The problem is, I want the actual array of slides to reorganize itself accordingly. My code is this:
function onThumbPress( e:MouseEvent ):void {
e.target.startDrag();
} function onThumbRelease( e:MouseEvent ):void {
e.currentTarget.stopDrag();
sortSlides();
[Code] .....
So what I want to do is take the change in the array (say 0 moves in front of 1 in project_thumbs_array) - and make sure that my other array (project_clips_array) moves item 0 in front of 1 as well. I thought something like this might work but it doesn't:
project_clips_array.sortOn ('project_thumbs_array.x',Array.NUMERIC);
View 1 Replies
Oct 17, 2011
iSo let's say I have three different arrays of objects, and I want to combine them into one sorted array. I want the order to be such that the items from each array are evenly distributed throughout the sorted array.
If there were 3 xItems, 3 yItems, and 3 zItems, the sorted array would have this order: x, y, z, x, y, z, x, y, z
HOWEVER, even if the arrays are differing lengths, I still need to make them alternate as much as possible. If there were 6 xItems, 4 yItems, and 2 zItems, the sorted array should have this order: x, y, x, y, x, z, x, y, x, y, x, z
View 1 Replies
Aug 5, 2011
I have a list containing display objects from throughout the application (insertion order). I want to process the list either top-down (parent, child) or bottom up (child, parent). The only requirement is that either a parent is processed before any child or vice versa a child before its parent. What is a good approach? This question is not about sorting a list. It's about retrieving the depth of a particular display object.
Example
Display list:
A (root)
B1
C1
C2
D1
B2
......
My list:
list = [E1, F4, A, B2, B1, C3, ..., N9, N8]
Bottom-up:
N9, N8, F4, E1, C3, B2, B1, A
Top-down:
A, B2, B1, C3, E1, F4, N9, N8
Does not matter if N9 before N8 or N8 before N9. Important is that any N is before M (first run) or any M before its children N* (second run).
View 2 Replies
Mar 17, 2009
I have been deveolping my new site, which is in it's early stages and have most things working ok but i need to open new windows from buttons in the main swf file. please check out my link to see for yourself! new windows load in the same window ad the main swf. [URL] I have been using this code on the thumbs on my design and illustration sections
on (release) {
getURL("javascript:NewWindow=window.open('url.html ','newWin','width=1133,height=425,left=425,top=113 3,screenX=1133,screenY=425');NewWindow.focus();voi d(0);");
}
each of the thumb windows being a different specified size.
View 1 Replies
Nov 26, 2003
Given an XML file similar to this:
Code:
<class>
<student>
[code].....
View 2 Replies
Oct 21, 2009
Is there any way in Flex where in we can sort an arraycollection based on strings .I have a dataprovider with strings like "Critical" "High" "Medium" "Low" where in I need to sort it in such a way that I need Critical to be displayed on the top and next High , Medium and Low follows.
View 1 Replies
Apr 4, 2011
I have an advancedDataGrid and I would like to sort the adg according one AdvancedDataGridColumn(studyDate) which use strings in format DD/MM /YYYY(I receive like this from the server):But i find another problem, I need to sort the columns of the adg the first time it displays so I used the following function but It doesn't sort from the recent day to old one, I do not know what I can I do cause I set sort.descending= true, any ideas?[code]
View 1 Replies
Sep 26, 2011
I have a one comboBox that I fill as:
for (var key:String in values) {
conns.addItem(key);
}
After that I sorted my ComboBox as:
private function sortConnection():void {
var dataSortField:SortField = new SortField();
dataSortField.name = "data";
dataSortField.numeric = true;
var numericDataSort:Sort = new Sort();
numericDataSort.fields = [dataSortField];
conns.sort = numericDataSort;
conns.refresh();
}
And on finish I want to select item on my specific value in ComboBox. How can I do that? I try:
for (var ii:Number=0; ii<combo.rowCount; ii++) {
var item:String = combo.getChildAt(ii);
if (item == name) {
index = ii;
}}
But does not work. I do not know where I made mistake, and how I can select on specific item in my combobox.
View 2 Replies
Mar 7, 2007
i'm trying to sort out some xml entries based on an attribute when you click a button. an example of my xml is below.
Code:
<list>
<entries cat="all">
[code].....
View 14 Replies
Jul 2, 2003
i just started with isometrics. i got the 3d to 2d coordinates working but i cant seem to get the z sorting to work.
View 2 Replies
Aug 7, 2009
i just started with isometrics. i got the 3d to 2d coordinates working but i cant seem to get the z sorting to work. please check the fla if you have knowledge in the subject.
View 6 Replies
Sep 18, 2009
Trying to re-sort an array of objects from:
var arr:Array = new Array({num:0},{num:1},{num:2},{num:3})
to
var arr:Array = ({num:0},{num:3},{num:1},{num:2})
View 2 Replies
Mar 23, 2010
- Put a bunch of MC's on the stage distributed horizontally.
- Store them in an array.
- yourArray.sortOn("x", Array.DESCENDING)
- loop though the now "sorted" array and trace their x property.
Doesn't work, does it? If it did, shuffle them up and try again (sometimes, perhaps randomly they will be in order).
View 7 Replies
Nov 22, 2010
I'm trying to bring XML nodes into an array so I can sort them in alphabetical order, then display the data in some textfields in a movieclip.I've managed to get the XML displaying fine in the movieclips and all the data in the arrays, but the problem is I'm not sure where to use name.sort();. Right now you can see I have it at the start of the loop that places all the data in, but it will only sort as it populates and hence becomes pointless.Is there a way to add all the data into an array, sort it, THEN display all the data in my movieClips?My XML looks like this:
PHP Code:
<example><item><name>Zack</name><donation>99</donation><message>Zacks msg</message></item><item><name>John</name><donation>70</donation><message>Johns msg</message></item><item><
[code]......
View 2 Replies
Apr 21, 2012
Rows B, D and E do not sort correctly, basically because I am assuming they have numbers with unmatching or too many places. I can not find any help online with this. The columns with percentages work fine unless they go over 99%. ?[code]...
View 7 Replies
Jul 6, 2010
I have this array
Code:
_global.itemsSelected[1][0]=20;
_global.itemsSelected[1][1]=60;
_global.itemsSelected[1][2]=10;
[Code]....
View 2 Replies
Nov 6, 2010
In the project I'm working on, there are towers the user can place. However, it you place a tower higher then another one, it appears infront of that one, which looks weird.I want to be able to arrange all the towers so that that does not happen.There is an sprite called towerHolder holding, which all the towers are children of, and an array called towerArray, which the towers get pushed to when they are created.I tried clearing towerHolder, then running the sortOn() function on the array, and then adding each tower back to the towerHolder, but the towers just seem to be randomly placing themselves irrelevent to their height.Here's my code for the relevant parts:
Actionscript Code:
function clearTowers():void { while (towerHolder.numChildren > 0) { towerHolder.removeChildAt(0); }}function orderTowers():void { clearTowers();
[code]....
View 3 Replies
Mar 8, 2009
have a twodimensional array that consists of 6 other arrays(like array[0 to 5][0 to 4]). The [4] of each sub-array is a indexnumber that i'd like to use for sorting the array[0][x] toarray[5][x] according to their array[x][4]-value. How would I do
View 3 Replies
Feb 1, 2010
How would I do to sort this array by the largest sum and not just the first number?
var myArray:Array = new Array(100, 200, 9);
myArray.sort(Array.DESCENDING)
//puts out (9, 200, 100)
How would I do to get it (200, 100, 9)?
View 1 Replies
Jul 28, 2011
I have a datagrid that uses a custom cellrenderer class to allow me to use a combobox. I have an invisible column that holds the value returned by the cellrenderer when the combobox value is changed. BUT sorting is wonky. Since what really lives in the combobox column individual cells is an object, it never really sorts properly. Is there a way to fire a sorting event to the column that holds the real value?
View 4 Replies