ActionScript 3.0 :: How To Display Specific XML Entry
Jul 7, 2009
I have a very simple line of code that i'm trying to modify to display a specific entry in a xml file:
AS3 Code:
// The first step is to activate the XML object
AmbientSettingsXML = new XML();
With the XML Object now active you must now load an XML foramtted document.
Any DTD or XLS formatting will be ignored.
AmbientSettingsXML.onLoad = myLoad;
[Code] .....
So the question is, how do I display the "event_title" entry only? (String)
I have a database all set up and working between flash and SQL .The set up allows me to add entries and receive data.. all this works great..The only problem I'm having is that when I want to update the score when clicking on a button..I can only send or receive data, and what I actually want to do is overwrite the current entry with a new entry to update the score..
I have been looking for a reference for this all over Google and even through the Adobe Forums but I can't find anything.I'm using Flash CS4, AS2. I'm calling an XML document to populate 2 text areas (textArea). In one textArea I need to display the firstChild (or ROOT node) and three childNodes after that. In the other textArea, I need to display the fourth childNode only.I am good to go for the second textArea, the one that only shows the fourth childNode. What I cannot figure out is how to hide that fourth childNode from my other textArea that calls for the same XML file. My code is written below, actionscript and XML.My textArea boxes are named "myText" and "myText2". "myText2" is the one that is working properly. I need to show only the <title> <description> and <price> tags in the "myText" box, not the <link> tag.
How do I get a Flex tree to display only specific XML nodes?
A sample of the XML data is below. Only the Grouper and Product elements should be displayed as branch and leaf nodes respectively; the Name elements should not be displayed. I can't use XSL or e4x to modify the XML as the Name elements' text is used as the label for the Grouper and Product tree nodes. Also, I cannot move the Name element to be an attribute as it needs to include a CDATA section.
It looks like using a custom TreeDataDescriptor is the way forward but I cannot find any examples of using one with XML.
I want to know how(and what scripts) to take words from a text input box and cause it to display and image Ex: if the text box said "smiley face" in it, then the image "smiley_face.jpg" would display on a certain movieclip and can be dragged around the stage and when a new image is loaded, it doesn't replace the previous image on the movie clip.
I've been trying to figure out how to display the descendants (in this case exchangeRate and PlacesOfInterest) of a parent node with a specific attribute.To set the scene - the user clicks on a button which sets a string variable to a destination eg. japan or australia.The code then runs through a set of nodes in the XML and any that have a matching attribute is traced - simple enoughWhat I can't figure out is how to then display only the child nodes of the node with that attribute.I'm sure there has to be a way of doing it and I'll probably be banging my head against the desk when I find it
public function ParseDestinations(destinationInput:XML):void { var destAttributes:XMLList = destinationInput.adventure.destination.attributes();
I have a LineChart that contains multiple series, both LineSeries and PlotSeries, and I have a custom dataTipFunction set for the chart. However, I only want data tips displayed for line series, not the plot series. I have tried returning null from my format function, but that just displays an empty box. I have also tried disable mouse events on the plot series (by setting both mouseEnabled and mouseFocusEnabled to false), to no avail. Is this even possible?
I really don't know where to start with this. I have many xml files in a specific directory and would like to have a listbox become populated with only those xml file names when a button is pressed.
I am building a custom shopping movie for a client. He sells wine and champagne glasses with customizable bracelets. He wants customers to first choose either a 2,4, or 6 pack of glasses, and then individually choose bracelets. My problem is I don't know enough AS to code the functions.
For instance, when a customer first orders 2 glasses, it adds them to the cart, and then sends them to a new frame of the movie, with pictures of the 4 possible bracelets and a text field below for quantity, each with a default value of 0. They can choose 2, and only 2, bracelets by adding a "1" to their desired text fields.
First off, I want nothing to happen until they add a "1" to 2 separate fields. Once they have done that, a specific 'add to cart button' needs to pop up, that will getURL the proper link to add that bracelet combo to the cart.The code, which is wrong, that I am using so far is this:
ActionScript Code: on (release) { if (AS2 + B2 + R2 + SL2 < 2) {
This has to be simple, if only I knew how. I'm an AS3 newbie, and am having difficulty setting up multiple specific EventListeners within a code generated display object container.
I am generating a 'page' (Sprite) with a heap of 'cards' (Sprites) on it. Each of those cards, in turn, contains a selection of text boxes and other objects generated from database output using a 'for' loop. My hope is to attach an EventListener to each 'card' so that a MouseEvent will let me manipulate the data that lead to the content of that actual card (the i-th iteration of my for loop). I've been playing with everything I can think of (limited repertoire of thoughts though) and the best I've managed is for my EventListener to access the final set of data, whichever 'card' I click on. I've summarised and attached my code for the function, how to get back to the i-set of data from the EventListener attached to the i-th card. I can handle the PHP and MySQL side of things but am fumbling my way into the OOP of AS3.
was just trying to make my site more efficient when its online. I have an image/video gallery. When the thumbnail is clicked, an image or video will be displayed in the container I have. Currently, the code is like
[Code]...
And if so, will it be in the cache or anything when it is loaded again within the click event?
Im trying to make a cursor display when rolling over a movieclip only between a specific range of frames. with this code the cursor shows up in the range of frames but doesnt follow the mouse, and the mouse pointe ris visible
Code: thisFrame = _root._currentframe; if (thisFrame > 50) { if (thisFrame < 90) {
I need to find the new item in a new set that is not in an existing set. here is an example:
// current set {file, file, file, file, file} // new set {file, file, file, file, file, file}
- The current set contains a list of file objects (for example)
- The new set contains another set of file objects, however it contains most of the same files in the current set, but now includes a brand new file.The new file in the new set needs to be pushed onto the current set.
Restrictions:
- The new set cannot replace the current set, only the new file can be appended.
- The files cannot be directly compared because each file in the new set that references the same file as a reference in the current set is not the same instance. Therefore they need to be compared by property, in this case, teh file name.I have the general work out of the algorithm:
actionscript Code:
for each(var currentFile:FileInfo in currentSet) { for each(var newFile:LocalFileInfo in newSet) { if(newFile.name == currentFile.name) { }}
But i just cant work out how to extract the new file. I will get it eventually, but im kinda hoping that someone will find a better solution entirely. one that might not even require so many loops.
I need to limit form data entry to once a day. I have created a login and a PHP script that writes variables to a txt file. However, I want to limit the users ability to enter data to the server date, so that they can only enter in data once per day. For example, a poll that allows a user base to vote once per day. I need to do it using Actionscript, PHP, CGI, or javascript.
This is what I have going on. Let's say I have a grid of movieclips, in this grid you can click on each movieclip and it will bring up that paticular movieclip. This movieclip has various frames on it 1,2,3,4,5,6. Each one of these frames contains all of the movieclips that the grid links to.
If I click on the first mc in the grid the slideshow will work fine, however, if I click on say the 3rd movieclip the slideshow will not work. I need to be able to figure out which frame it's exactly on so I can manage to be able to loop through all the frames..
I have a sound control file that works great, however, I cannot seem to get the audio to start playing upon entry. I have tried the using the code:: samplesound.play();and it plays but when you click the play button, the audio repeats and the sound file that started upon entry do not respond to the controls.URL...
I have five text boxes and a dropdown box in my flex application, how can I make the progress bar fill up when there is text in each box, and the dropdown selected. For example, if there is input in three out of five of the boxes and there is a selection in the dropdown, then the progress bar would be 4/6 full.
I forgot to mention that, i've done it by spliting the date entry to subentries and sort the array according to them and it can be also be done by creating a new array by fetching entries from the prototype.. but i wanted to see if there is a more "proffesional" way to do this.
ActionScript Code: var lijst:Object = new Object({fname:'John', lname:'Carpenter'}); lijst.push({mname:'Frank'});
[code]...
This doesn't work. The first name and last name work because they are created when the object was created, but the pushed middle name remains undefined.I understand that associative arrays are in fact objects. I tried turning it into a real array so the Push command would work cause it's part of the Array Class.
ActionScript Code: var lijst:Array = new Array({fname:'John', lname:'Carpenter'}); lijst.push({mname:'Frank'});
[code]....
Though this works, it only works when using a '1'. When in fact I want to keep it inside the '0' entry.So how do I really add an entry into an assciative array? So that in above example instead of each having two elements one is added resulting in three elements per entry?
The cursor is blinking in the correct field but it will not allow any text to be typed into the field. Is there something in the code that is causing this problem?
Atm the home page loads up a swf gallery that literally just displays a photo then fades in/out onto the next photo etc
it always loads the first frame obviously but i was wondering if there was a way to randomly jump to another part of the timeline each time the home page was reloaded?? its not essential but would be a nice touch
Okay I have two arrays, one full of bullets, the other enemies. They compare each array and hit detect. The splice function is removing the Array instance of the enemy. Now, this is all good for removing the entry from the array, the trace function says this is working, but I'm not sure how to remove the child from the stage here? I figure calling a custom class from here such as enemy.die(); is possible, but how do I specify the instance that was hit detected? Sorry if this doesn't make a lot of sense but I am just learning and trying everything I can think of.
I am trying to create an audio that only uses the first entry in an xml file. I have most of the things working but I keep getting an error related to the audio file.
TypeError: Error #1034: Type Coercion failed: cannot convert "http://rivervalleychurch.net/sermonaudio/Podcast/06_Jesus_Save_Your_Church_First_Love.mp3" to flash.net.URLRequest. at latestMessage_fla::MainTimeline/frame1()
I inserted the url for the file into error message so you can see if there is s problem with that. I was initially trying to use a variable to hold the url for me, because this xml file gets updated every week and I only want to access the most recent entry.
This is my first attempt at making an audio player in flash, so I am sure I have made a simple mistake, but for the life of me I cannot figure out what it is.
Here is the code I have so far: (Please Try not to Laugh, at least not out loud)
//Load the podcast.xml File var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML();
[Code].....
One last question is in regards to using id3 tags versus xml tags to fill dynamic text fields in the player. Currently I am using the xml file to do this, are there any advantages one way or the other for this. The only reason I ask is that I am hoping to display an "album art" image from the id3 tag in the player. Would it be better to grab all of the information from the mp3 file?
is it possible to create an actionscript project (File > New > Actionscript Project) and still use mxml for the ui layout? basically, i want a main class as the entry point which can reference the controls within the mxml.i tried it the other way around (File > New > Flex Project), but it creates an mxml app that seems to serve as the entry point. if i create a class in this project, how do i make it the main entry point?//when i create this class inside a flex project, the constructor never gets called