ActionScript 2.0 :: [FMX] Count And Array With XML Parser?
May 20, 2003allright, this is the problem, i got this xml file...PHP Code:
<portfolio>
<item>
<img>blaat.jpg</img>
[code]....
allright, this is the problem, i got this xml file...PHP Code:
<portfolio>
<item>
<img>blaat.jpg</img>
[code]....
in many programming languages there is this great idiom that lets you use a hash to count occurrences of items. Eg in Perl, suppose you have a list of students and you want to see how many of each name you have (2 Bobs, 1 Jeremy, 22 Aidans etc):
my %uniqueNames;
for (@studentNames){ $uniqueNames{$_}++; }
# print it out[code]....
So you can do this in ActionScript 3 of course, using the Object.The problem is NaN. If you try to autocreate and autoincrement a key at the same time, you get NaN, and the whole thing breaks down.Sure, you can use a conditional to test whether the key exists, and then autoincrement it, or set it to one if not, but that's ugly.
studentNames[name] = studentNames[name] ? studentNames[name] + 1 : 1; // shudder
How do I accomplish this in actionscript (example in c#):
string[] arr = { "1.a", "2.b", "3.d", "4.d", "5.d" };
int countD = 0;
for (int i = 0; i < arr.Length; i++)
{
if (arr[i].Contains("d")) countD++;
}
I need to count a character in an array of strings
how can i count if the same number is repeated more than once in an array
[Code]...
i need how many times the number was repeated ,is there any key word like "count" or any thing with piece of code
I'm trying to figure out how to find the exact location of an XML item after I pushed it to an array... I'm using this to find the item with the "fotoNR" number:
[Code]...
But how do I find that by code? Basically, I need to know how many items go from the beggining till the finded one!
Is it possible for me to use An array to make a 1 hit test count for more than 1 MC like have
Code:
floor=["MC1", "MC2", "MC3"];
}
if (this.hitTest(_root.floor)){
[Code].....
I'm trying to make a volume button for my site and it looks something like this:
- ||||| +
i want the volume bar to start filled and when the user hits the minus button it lowers the volume and when it hit plus it takes the volume up well when I go down and up the volume bars start to get crazy...it just works when I go down the whole way and after it goes up the whole way, when I change direction on the midle of the path it jumps some bars...
Code:
volDown.addEventListener(MouseEvent.CLICK, menosVol);
volUp.addEventListener(MouseEvent.CLICK, maisVol);
var cliques:uint = 0
if (cliques == 7){
[code]....
I've found a simple count up script over on Actionscript.org
var count:Number = 0;
var maxNum:Number = 1250;
var num:Number = 1;
this.createTextField("txt", this.getNextHighestDepth(), 0, 0, 100, 50);
[code]....
This works great for my use, but now I am trying to figure out how to make it count down. I've tried changing everything to opposites like count=1250 and maxNum=0 (I think this would be the minNum instead), count+=num to count-=num, and count>=maxNum to count<=maxNum.
I need a XML Parser in as3
View 1 Repliesi've been taking advantage of the new XFL file format recently and it's really opened up a lot of possibilities. i've started a C++ project which parses and builds XFL files as a addon for openFramworks.here is the project on github => https:[url].....im now up to the point where i need to work out how to parse the content of DOMShape so I can draw custom shapes.im finding that online docs on this topic are non-existant.i need to understand how Edge is being encoded - example XFL snippet below,[code]...
View 1 RepliesThis is my first post ever on ActionScript.org. I confess, I suck at ActionScript. Yet I had to put together a website, for which I had to shamelessly borrow code snippets from so many different places. It was working fine, until I got stuck with some colour management issues. I am a 3D artist making a portfolio website. There are some categories under portfolio such as 3D art, 2D art, Photographs, etc. So I wrote down the category names in an XML and used a parser script in case I need to re-use it or create categories of different names later.
[Code]....
Is it possible to make a count up timer (from a specific date, birthday for exemple) from the count down timer ?
I've tried to change a few things (I'm very bad in programming) but I can't get the date properly.
If not, do somebody know a count up timer (.fla) that I can use ?
The flash XML parser working fine with '>', but when I try '<' or '"' it doesn't read them correctly. Is there a way to get the parser to load in < and "?
View 9 RepliesI have a basic XML file and a parser in as3.
So far, I can get it to parse and trace data from the xml file:
{
xml = new XML(e.target.data);
var tester = xml.item;
[Code].....
My objective is to pass in a bunch of variables from my XML file that I can use anywhere in the flash project.
I am attempting to create a custom Collada parser. I Think I'm getting something wrong with the uv's. Attached is the class. Also attached is my model class so you can see the exact methods I am using to render.
View 2 RepliesDoes anyone know of a parser for math functions?
Basically, I want to be able ot take a string such as:
(x + (x - 3)/2 * 4)^2
and compute the answer. Before I make the parser on my own, I thought I'd check to see if anyone has something similar already made.
I am evaluating the possibility of developing a JSFL script to parse a FLA and need to know first if it would be able to do what i want to do. I need the script to parse through all the library's linked assets, recursively go through their children, replace all the children of type "Group" with a bitmap and then save that FLA as a new file. I haven't received an ok to develop this yet at work, but i'm trying to evaluate the possibility for a proposal.
View 1 RepliesSimple html parsing library, written in as3 for a flex project?
View 3 RepliesI need to load and apply CSS at runtime in my Flex app. I know that the adobe docs say that you need to compile the CSS before loading it but I would like to find a work around. I know that you can set individual styles like this:
[Code]...
I know that the adobe flex.text.StyleSheet class has a CSS parser but I could not find a way to harness that. (Is there a way to get that source code?)
I've tried to make an XML parser class using ASBroadcaster, that would act as a listener, and then have methods like getNode(n), which when called, would return the value of that node as a string to the dispatcher/caller.
This doesn't really work all that well, since I'm unsure of how to adress the dispatcher/caller in an economic way.
Do I have to supply the caller object as an argument when broadcasting from it, then do another broadcast for setNode inside the XMLParser.getNode method, supplying it as an argument again, and then check with an if statement in the setNode of the caller, whether it is the right one or not. Seems a bit over the top.
I'd want XMLParser to be a centralised class, that all other objects would refer to via some listener or get/set thing, instead of having an instance of it in each of the objects that would use it.
i have this code:
Code:
var loader:URLLoader = new URLLoader();
loader.load(new URLRequest("http://internetradio.vrt.be/internetradio_master/productiesysteem2/epg/41_epg_huidigeweek.xml"));
loader.addEventListener(Event.COMPLETE, loadXML);
[code]....
but i get error:
1095: XML parser failure: Unterminated attribute.
I am getting the above error, I cant see the problem in my xml.
<?xml version="1.0" encoding="utf-8"?>
<Work Columns="4" XPosition="30" YPosition="80" Width="100" Height="100">
<Image id="images/images/images_01.jpg" thumb="images/images/thumbs/thumb_01.jpg"</Image>
<Image id="images/images/images_02.jpg" thumb="images/images/thumbs/thumb_02.jpg"</Image>
<Image id="images/images/images_03.jpg" thumb="images/images/thumbs/thumb_03.jpg"</Image>
<Image id="images/images/images_04.jpg" thumb="images/images/thumbs/thumb_04.jpg"</Image>
<Image id="images/images/images_05.jpg" thumb="images/images/thumbs/thumb_05.jpg"</Image>
<Image id="images/images/images_06.jpg" thumb="images/images/thumbs/thumb_06.jpg"</Image>
<Image id="images/images/images_07.jpg" thumb="images/images/thumbs/thumb_07.jpg"</Image>
<Image id="images/images/images_08.jpg" thumb="images/images/thumbs/thumb_08.jpg"</Image>
<Image id="images/images/images_09.jpg" thumb="images/images/thumbs/thumb_09.jpg"</Image>
<Image id="images/images/images_10.jpg" thumb="images/images/thumbs/thumb_10.jpg"</Image>
</Work>
I need to make a parser to be able to extract logical structure from a text input in order to construct a query for some web service.
I tried to use regular expressions but it gets really complicated to handle imbrication logic
ex:
( (foo1 and bar) or (foo2 and bar2) ) and ( (foo3 and bar3) or foo4 ) and "this is quoted"
the result should be something like this:
{
[Code].....
So I'm trying to make a Vertical 3D Carousel using Flash CS3, ActionScript 3, a program called TweenMax, and some XML. The site I got a tutorial from is a dead site, there.
Here's the error I'm getting:
TypeError: Error #1090: XML parser failure: element is malformed. at outrageouslycooltitlescreennoerrors_fla::MainTimeline/xmlLoaded() at
[code]......
a php file which generate an XML var and then I import this content into flashIf I see the php file directly I have:
Quote:
<?xml version="1.0" encoding="utf-8"?>
<directories>
[code].....
I'm trying to include some JavaScript (JSON 2, to be precise)in with some ActionScript 3 classes. I'm using the inline XML method (E4X) of declaring the data. It looks like this:
public static var JSON_2:XML = <data><![CDATA[
if (!this.JSON) {
JSON = function () {[code]....
Actually, this is only about a quarter of what I need to include but this is where it breaks down. Right after the second slash in the last line, Flash reports: TypeError: Error #1091: XML parser failure: Unterminated CDATA section.
In fact, as you can see this is a perfectly valid CDATA section and isn't being terminated anywhere (there is no instance of "]]>" anywhere in the data). Unfortunately, Flash doesn't think so and seems to think that the backslash is an XML node directive. how to effectively deal with this? The JSON source code has *many* backslashes so not having to convert them would be *very* useful.
In my Flex 3 site, I'm getting a 1090 error, an xml parser error in IE only. It works in Safari and Firefox. Does anyone see a problem with this xml?
[Code]...
I have a problem with xml, i'm getting a value from xml file, for example "1000". Here is the code
Code:
var my_xml = new XML ();
my_xml.ignoreWhite = true;
my_xml.load ("data.xml");
[Code]....
I want to do a thing where a number is displayd, and it represents the number of days that has passed since I started the date.Or to put it in another way, I put the certain date in the actionscript, and it displays how many days had passed since that date, on the main stage, inside a text box
View 8 RepliesAfter loading the following XML file, is there a way to count the number of attributes of the "question" node, and if possible, the number of items having the word "answer" in them? (in this case 4 should be returned, ie. answer1, answer2, answer3, answer4)
Code:
<?xml version="1.0" encoding="utf-8" ?>
<quiz>
<question text="The man went ___ the morning." answer1="at" answer2="on" answer3="in" answer4="out" correct="in" />
</quiz>