ActionScript 3.0 :: Change The Number Of Xml Elements Trace
Oct 27, 2011Simple question i can trace all elements from xml but how to trace 5 or 15 or any number (that you enter to input text field) of random elements from xml file
View 2 RepliesSimple question i can trace all elements from xml but how to trace 5 or 15 or any number (that you enter to input text field) of random elements from xml file
View 2 Replieshow to trace the elements in my code since my variables are populated dynamically. I have tried to use trace(cartOrder[0]); but when I do I just get the output [object movieclip]. I want it to give me the name of the handbag. My code is
var cartOrder:Array = [];
Code:
var cartOrder:Array = [];
[code]....
Actionscript: how to output color value in format like "#FF00FF00"
So I use such code to generate colors ond simply trace tham. How to trace tham in Hex format?[code]...
I want to know the index number of the object when I clicked it..
trace(mc.getChildAt(0)) = display the object at the index 0 lets say the output is [object] button
now I want to reverse it..
when i click the object button
button.addEventListener(MouseEvent.CLICK, onClick)
function onClick(e:MouseEvent)
{
[Code]....
The Action script code below takes the strings in the array (pgtit) and creates a dynamic navigation bar I am trying to trace the index number of the array being click I just seem to get -1.
var pgtit:Array=["link1","link2","link3","link4"];
var xPos = 0;
var menuHolder:MovieClip = new MovieClip;
addChild(menuHolder);
[code]....
I want to know the index number of the object when I clicked it..
trace(mc.getChildAt(0)) = display the object at the index 0 lets say the output is [object] button
Now I want to reverse it. When I click the object button
button.addEventListener(MouseEvent.CLICK, onClick)
function onClick(e:MouseEvent){
trace(e.currentTarget.????????)
//I want to trace what index number is that button, the output should be "0"
}
If myXML.person.length() gives me the number of person nodes in my XML file, then how do I count the number of elements inside each person node if each one has a different name (such as address,zip, etc.)?
View 2 RepliesIs it possible to define a property to limit the number of elements which will appear in a mx:List ? I've read about setting the property rowCount, but I don't see any effect.Can a filter be applied to accomplish this? My intention was to avoid removing the items from the list/array collection, but simply "hide" them. Can this be done?
View 2 RepliesI have a simple code that seems to be giving strange results.
var startPoint:Point = new Point(x, y); // a point
var r:Number = path[i].row + (-Math.floor((length * 2 + 2) / 2)); // just some math
trace(r); // the math checks out and gives a 3
var tey = startPoint.y + r; //this gives a really strange return....
[Code].....
Given this XML code:[code]I can count the total number of game elements in the XML.game with:[code]Is there please some way to print the number of all game elements having the exact number of 3 user children? And also count all such elements with less than 3 user children?[code]The backgound is, that I have a Flex game, where up to 3 players can sit at a playing table and I'm trying to display the number of All, Vacant and Full playing tables there (the top left row with RadioButtons, sorry for the non-English language):I'm reading the XMLList doc, but don't see how to do it with one-liners, I only can see how to do it with loops...
View 1 RepliesIf I had some numbers in an array, and wanted to calculate how many were below a certain value?
View 4 RepliesSay you have a class Parent, which has a property childArray:Array. In this array, we will register several instances of the class Child. Is there an easy way for a child to know which position in the array it currently has? I know I could just pass the index number into the child as I register them, but if a child were to be deleted from the array, all children past the deleted childs index would need to have their indexes updatedl. While this is of course not a huge task, I just have this feeling it should be a better and more dynamic solution.
View 6 RepliesI have created a set of MC's loaded from library via attachMovie in a for loop. Right now I have a set of MC's that are attached with the numbers 1-8. I would like to be able to select a MC and traces back its number. I know this can be achieved through an array. I know how to build arrays, but I do not know how to create an array what would trace back a number form a for loop.
Here is the code:
this.createEmptyMovieClip("navClip",this.getNextHighestDepth());
for (i=0; i<8; i++) {
currentThumb = navClip.attachMovie("numberBox", "clip"+i, i, {_x:(i*50)});
currentThumb.imageNum.text = i+1;
navClip._x = (Stage.width/2)-(navClip._width/2);
currentThumb.onRelease = function() {
trace(currentThumb);
};}
I need it to call back in the onRelease the number associated with that clip(array).
I have been working with flash remoting in actionscript 3.0 and there is no result set class. I'm fairly new to AS3, but I am very fluent with AS2, and so far the migration has been easy.I would like to create a result set class myself, but I am stuck on one part, pushing the dynamic number of elements onto the array, let me show you what I mean:
{ // start result function
var totalCount:Number = rs.serverInfo.totalCount; // # of records returned
var queryString:String = rs.serverInfo.intialData; // query string, each value separated
[code].......
I am using an array to return data to an application and as the array is filled with data using a loader and the order is important it happens that data in slot n is inserted later than data in slot n+1. How do I know that the array is full as I know the number of elements to be loaded? The length property doesn't work for this. I could go through the array each time I put something in and look if every slot is full but that seems ineffective.
View 1 RepliesI just read the tutorial "Finding Values in an Array". Sure, the code works, but that's only because we are searching arrays the contain a small number of elements. Suppose we have n elements in an array. To search that array for a particular element we may have to do n comparisons. If the array we are searching contains 10 million elements, we have a problem; can you imagine doing "if (this == that)" 10 million times? There's got to be a better way to search the array. Or perhaps we shouldn't use arrays to store the information.
View 9 RepliesCurrently the mp3 player xml document is using attributes [code]...
View 1 Repliesi suspect the answer here is "no", but i'm wondering if it's possible to set the color of trace statements which appear in flex's console pane. ie, i have a few "levels" of log statements, and i'd like the warnings and errors to really stand out.
View 2 RepliesI need to change all the elements in my movie that have the color X and change their color to color Y. Is it possible to have this in AS? like, if i press one button all the elements that have the color black (graphic, text, background, etc) change their color to yellow?
View 1 Repliesis it possible to assign code to graphic element so when it's 1/1/07, it displays red color, and 1/2/07 blue? or is it possible to show different graphics elements according to date?
View 4 RepliesI've got a 1126: Incorrect number of arguments (Expected 1) but I'm not sure what kind of an argument is involved with a trace statement. My goal is to 'package' things a little more so that I can have a 'pre-loader class' that will run first followed by a gallery or whatever. Usually, I just do it all in one package or in the timeline itself, but I'm hoping that this will clean things up and hopefully go faster for me.
[Code]...
I am having issues with a global array. I have an actionscript file called MyGlobal.as at the same level as my main FLA:
[Code]....
I am able to trace that first element while trace is called within the function... but if I try to trace that first element outside of the function it is "undefined". Do I need to return the array at the end of the function? I tried that but I cant seem to get it working correctly.
I've been playing with prototype a bit and I've noticed that either it isn't as static as it should be or that some functions are protected from altering, or that in some cases the prototype actually extends a function. For example, I was trying to modifiy the global trace function to output the current time of a trace action, something like this :
Code:trace("lulu"); // output 12:48:17.286 lulu I DID achieve something close to it, but it seems that I haven't actually modified the global trace function, but rather it's "_root" counterpart,
[Code]...
ive got a loaded xml list for an mp3 player. from playing track1, when i select track 2, it traces "track1" but then after a second click it traces "track2" and stays on that. the actually music for track2 does load on the first click though, but not the trace. anyone know why on the first click it would still trace the previous track? here is the code for that function...
[Code]...
Is it generally to position elements relative to other elements or in absolute values?
View 2 RepliesI am having a difficult time getting the Astra TabBar to do anything except be able to pass in my DataProvider array. I am trying to get it to simply trace a "click" using the CHANGE event when clicking on a tab. Nothing happens and I'm not sure why.
[Code]...
take a look at the results of these traces:
trace(imgGal); //traces "1"
trace(itemClip1._y); //traces "32"
trace(itemClip[imgGal]._y); //traces "undefined"
why does the last trace not trace "32" like the second trace? I want to insert the variable "imgGal" onto the end of the mc "itemClip", how can I do this?
[Code]...
does anyone know how to shift all the array elements by one or more without deleting the array itself?
Something like rotating the array:
1,2,3,4,5,6,7,8,9,10
10,1,2,3,4,5,6,7,8,9
9,10,1,2,3,4,5,6,7,8
8,9,10,1,2,3,4,5,6,7
7,8,9,10,1,2,3,4,5,6
var dane:Array = new Array();
dane_xml = new XML();
dane_xml.ignoreWhite = true;[code]....
and this last trace gives me undefined while trace(temp) gives me what I want
how to turn a variable number from positive to negetive using AS2? eg:
Code:
myVar1 = 40;
//use code to change to negetive number
myVar1 = -40;