I have a Canvas which has many components inside it and those again, have many components inside them.
getChildren() returns only the top level children. What is the best way to retrieve all the children (children of children of children and so on).
Well, I sorta know how to do this by iterating through the children, but the code is really messy. I'd prefer to use a nice recursive function. Has anyone written this before? Or is there a Util class to do this?
I have figured out how to run through an xml file with nested nodes recursively (please see code below). My challenge now is how do i convert it into a multidimensional array? I would like the array to be the data source for a Flex tree control
What I'm trying to do is just iterate through stage children and trace out what the child is and the index. Here is some code.the problem area seems to be the actual recurseStage() call at the end. As well as the if statement before that. I know not all children will have the property .numChildren but I'm not sure what to use instead. This should be an easy fix but my brain just isn't helping me out right now.
yet again need to do something which would be simple with code, but i am on a large project that well - if it went to school it would get there by way of a short bus. From within the library, I need to duplicate a number of movie clips that contain other movieClips, graphics, text fields. The problem is that I can duplicate the container movieclip but instances insice this duplicate continue to reference items in the library.
Effectively defeating the purpose of duplicating it in the first place, because changing the duplicate will modify the original as well as it references the same clips
I'm using URLLoader to parse XML feeds in my flex project, problem is matching/detect loaded feed in Evevent.COMPLETE,I don't know how to pass id or variable or object tag through URLloader.When loading images this is solved by using name property in Loader, but Loader didn't work for XML[code]...
[AS] // Assuming a lot more properties are added to all objects var parent:Object = new Object(); var kid:Object = new Object(); var kidToy = new Object();
[code]....
Does making the parent object null recursively release all memory used by all subordinates in the hierarchy?
I'm curious how, in ActionScript 3, to parse the font attributes of an HTML formatted content string. Lets take the following example content string:[code]
I am trying to return results from my SQL database, using PHP to convert it into JSON, which is then read by Flex. Here is the parse error I receive -
JSONParseError: Unexpected < encountered at com.adobe.serialization.json::JSONTokenizer/parseError()[/Users/mesh/src/as3corelib/src/com/adobe/serialization/json/JSONTokenizer.as:579] at com.adobe.serialization.json::JSONTokenizer/getNextToken()[/Users/mesh/src/as3corelib/src/com/adobe/serialization/json/JSONTokenizer.as:168] at com.adobe.serialization.json::JSONDecoder/nextToken()[/Users/mesh/src/as3corelib/src/com/adobe/serialization/json/JSONDecoder.as:83] [Code] .....
Is there some way in flex to parse strings to date. I want it to support custom formats similar to 'dateformatter'. Using 'dateformatter' class we can parse date object in various string formats as specified by 'formatString property'. I want it other way round, from string to date. The parse method 'Date.parse(my_string)' does string parsing but for a very limited set of formats. Can't we have something similar to following, where user can specify his/her own formats.
I would like to find an actionscript library that can take strings like:
Two days 2h one month a week
and parse them into duration (returning the time in some unit). It seems like it's been done so many times before and I'd hate to implement such a thing myself. If not in actionscript then in python (I can run this on the server side I guess).
I'm trying to read a xml file from client. After search for it. I have got to upload the file to the server with this code. var imagesFilter:FileFilter = new FileFilter("*.jpg,*.gif,*.png", "*.jpg;*.gif;*.png;*.jpeg"); fileRef.browse([imagesFilter]); But what I want to do is to read the file from client and parse it without uploading it to the server.
private var filer:FileReference; protected function button1_clickHandler(event:MouseEvent):void { var fd:String = "Files (*)";
[code]....
And my file looks like this:
[URL]
I need to read the uploaded file and parse it. The problem is that in my e.currentTarget.data.toString(); I get only '1' and not the rest of the String. how to successfully read this entire txt file?
I need to parse a large trace file (up to 200-300 MB) in a Flex application. I started using JSON instead of XML hoping to avoid these problems, but it did not help much. When the file is bigger than 50MB, JSON decoder can't handle it (I am using the as3corelib).
Try to split the file: I would really like to avoid this; I don't want to change the current format of the trace files and, in addition, it would be very uncomfortable to handle.Use a database: I was thinking of writing the trace into a SQLite database and then reading from there, but that would force me to modify the program that creates the trace file.
I am using JSON to parse HTML data with customized html tags in Flex. Flex's support for HTML is pretty minimal, so I am wondering if it's possible to do a simple font color change rollover effect on these links. Currently I have found that Flex only supports a few HTML tags, but also supports CSS through Flex's whack CSS methods. Can I manipulate HTML that is written in my JSON files through an external CSS file? Or better still using a simple tag with the JSON file?
I'm using String.split to parse a command line string into an array of strings. The result is then used to call a function using the Function.apply API.If apply(null, ["17"]) is called with this function:[code]does not work (expected output: false Boolean; actual output: true Boolean).Is there a way to make it recognize "true" and "false" (or anything else) as Boolean values, just like it does with numerical strings? Ideally "true" and "false" should also remain valid string values.
I'm using String.split to parse a command line string into an array of strings. The result is then used to call a function using the Function.apply API.
If apply(null, ["17"]) is called with this function:
static function test(foo:int):void { trace(foo, typeof(foo)); }
it works as expected (output: 17 number).
However, calling apply(null, ["false"]) or apply(null, ["0"]) with this function:
static function test(foo:Boolean):void { trace(foo, typeof(foo)); }
does not work (expected output: false Boolean; actual output: true Boolean). Is there a way to make it recognize "true" and "false" (or anything else) as Boolean values, just like it does with numerical strings? "true" and "false" should also remain valid string values.
I've got a php backend which delivers a time (e.g. '07:00:00'). This time is recognized as a string but I need it as a Date. So what I need is: Convert a string '07:00:00' to a Flex Date object. Is there a way to do this (without using regular expressions)?
I want to upload a file(photo) from Flex to Rails and then send a response back to the server in XML (contains photo URL and ID). I'm sending from my Rails server some XML as follows:[code]it doesn't seem to parse XML properly. I have used similar code before with URLLoader and it worked.
I am trying to obtain strings from a xml file: I tried the following:
var url:URLRequest = new URLRequest("blog.xml"); var xml:XML; var rss:URLLoader = new URLLoader();rss.load(url);rss.addEventListener(Event.COMPLETE, readRss); function readRss(e:Event):void{ xml = XML(rss.data); txt_field.text=xml.entry[1].author.name; }