The Best Way To Parse XML In Flash?
Hi Everyone,I am trying to figure out the best way to load in my XML data into flash so that I can use it within an sequencer-type application you can view here:http://www.blueprintfilms.com/rebyrththe idea is that i want the track titles to be loaded in dynamically for easy update.. now what i am attempting to do is create multiple arrays, one say for each track that would store the names of the available samples for that track.e.g. var track1:Array = new Array('sample1', 'sample2', etc...);here is how i structured the XML:Code: <tracklabels><track id='1'> <sample01>01 OPEN/CLOSE HIHAT</sample01> <sample02>02 PARTIAL/CLOSE HIHAT</sample02></track><track id='2'> <sample01>01 CRASH CLENCH</sample01> <sample02>02 LIGHT CRASH</sample02> <sample03>03 LIGHT CRASH CLENCH</sample03> <sample04>04 RIDE CYMBAL BELL</sample04> <sample05>05 RIDE CYMBAL TING</sample05> <sample06>06 SPLASH CYMBAL</sample06></track><track id='3'> <sample01>01 SHORT SNARE</sample01> <sample02>02 STRONG SNARE</sample02></track></tracklabels>the problem i am running into is trying to streamline the AS for this. It seems silly to have to write out firstChild.nextSibling.nextSibling.nextSibling.... etc... for say a track that has maybe 10 different samples in it just to extract the XML.so I have been attempting to accomplish this in a for loop but my script keeps throwing an error:Code: var myXML:XML = new XML();myXML.ignoreWhite = true;myXML.onLoad = tracklabels;myXML.load('tracklabels.xml');function tracklabels(loaded){ if (loaded){ var nodes:Array = myXML.firstChild.childNodes; // create separate arrays for each track // var track1:Array = new Array; var track2:Array = new Array; var track3:Array = new Array; for (i=0; i<nodes.length; i++){ ['track'+i] = [nodes[i].firstChild.firstChild,nodes[i].firstChild.nextSibling.firstChild]; } trace(track1) } else{ trace('error'); }}i throw the error when I try to call the different track array names within the for loop:['track'+i] = [nodes[i].firstChild.firstChild, the must be some simple way to get this data in multiple arrays so I can control it. If anyone has any suggestions or thoughts I'd really appreciate it.thanks in advance!+stephen
General Flash
Posted on: Sat Aug 05, 2006 3:23 am
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Parse This Into Flash
http://www.weather.gov/tg/datahelp.html
Okay , Im new to data integration e.t.c , but is there a way to extract certain text from a ftp download for use in variables
Thanks
Can Flash MX Parse URL's
Does anyone know if flash has the ability to 'grab' a web page and then parse the file for output in a flash file ? I know flash can used to call upon say php files and text files
Thanks
How To Parse SUP Tags In XML To Flash?
Hi, I'm using XML to store the questions of a mathematic MCQ quiz I'm making. Some of the questions require me to input mathematic representation e.g. square of a number.
I was told to use the <sup> tag. But FLASH doesn't not understand the tag and instead replicated the tags as texts. Any solution?
Cheers
Parse HTML In Flash
Hi,
How to parse html in flash.
Can any one tell abt this, Suppose i have 200 lines html is there, In that i want a particular tag. How can i parse that tag.
Plz help on this.
Thanks
Rajesh ...
How Do I Parse XML Into My Flash Movie?
I am using MX 2004 Pro.
I can get XML to load into my flash movie - that's no problem. What I really want to do seems to escape me somehow.
I want to have one xml file, and I want it to dynamically fill the content of different text areas. Here's an example:
<name>John Doe</name>
<objective>To get a job as an accountant</objective>
So I want everything in the <name> tag to show up in one text box, and I want everything in the <objective> tag to show up in another text box.
How do I do that?
Getting Variables Out Of XML Parse Function (Flash MX)
Hi all,
Been banging my head on the wall trying to figure this out (which probably accounts for the fact that I can't figure it out ;-)).
I have an external XML file which I load in using a function:
f_yearsAvailable();
function f_yearsAvailable() {
xmlYearsAvail = new XML; //creates new XML object
xmlYearsAvail.load("xml/years_available.xml"); //loads the required file into the XML Object
xmlYearsAvail.ignoreWhite = true; // 'strips' whitespace from file
xmlYearsAvail.onLoad = parseYA; //calls XML parse function once XML file has loaded
}
function parseYA() { //XML parsing function
mainNode = xmlYearsAvail.firstChild;
mainName = mainNode.nodeName;
//Just a check to see if XML file is formatted properly
if (mainName.toUpperCase() <> "YEARS_AVAILABLE") {
trace("MainNode name is incorrect in Years_available doc(should be YEARS_AVAILABLE)");
}//if
childrenOfMain = new Object();
childrenOfMain = mainNode.childNodes;
yearsAvailable = new Array();//create a new array called yearsAvailable
for (i=0;i<=childrenOfMain.length;i++) {
if (childrenOfMain[i].nodeName <> null) {
thisTag = childrenOfMain[i];
yearsAvailable.push (thisTag.firstChild.nodeValue); //puts each individual YEAR tag into the array
}
}
}
This is the XML file I'm loading in:
<?xml version="1.0"?><YEARS_AVAILABLE>
<YEAR>47</YEAR>
<YEAR>ca.860</YEAR>
<YEAR>1203</YEAR>
<YEAR>1420-1481</YEAR>
<YEAR>1574</YEAR>
<YEAR>1606</YEAR>
<YEAR>1639</YEAR>
<YEAR>1807</YEAR>
<YEAR>1929</YEAR>
<YEAR>1945</YEAR>
<YEAR>1960-1982</YEAR>
<YEAR>1999</YEAR>
</YEARS_AVAILABLE>
If I trace within the parseYA function for the yearsAvailable array, no problem, I get the result, but I can't access the yearsAvailable array outside the function. I think it's something to do with variables being local within functions, but are arrays also local? I've tried putting the yearsAvailable into another array which was initiated in the timeline, but it still doesn't work. Anyone know how to solve this?
Thanks in Advance!
URL Parse From XML In Flash Used In GETURL Action?
hi Everyone , please have a look at the attached Fla file which shows the url coming from the XML file i have shown the URLS in the dynamic text box, There is a button on the stage which needs to function as the dynamic button that changes its URL within the GETURL syntax from the URL which comes from the XML
for example the first url coming from XML is :
Code:
http://www.yahoo.com
so the script behind the Flash button named URLBTN should be changed to :
Code:
on (press) {
getURL("http://www.yahoo.com");
}
similarly if the XML parse the second record the GETURL script modifies it self with the updated url.
Please please please if anyone can help me in that, it will help me a lot in finishing my project.
Many Thanks
F.
Parse Php String Into Flash Array
How exactly do I parse a string given by php in this format...
userid="10","11","12"&imageid="blah","blah","blah"
How could I make a multidimensional array based on that sort of layout?
I have the php all done up and it gives me a somewhat string like that but I am having some trouble getting that pulled up in flash as an array...
Any help would be great I have looked on google and through the board here but most of the things I see are amfphp and I prefer not to use that
Parse Dynamic Data In Flash
What I want is the user to input text, like "Hello my name is Rick" then have flash process the field, and generate images based on each individual character that was given.
Basically, each letter would be turned into an image; a = imageOne_mc, b = imageTwo_mc etc.
I know how to capture data from text fields and manipulate it, but I don't know how to break the data up into individual characters, and assign values to them in an effective and efficient manor.
Any ideas or suggestions?
Parse Youtube URL Into Flash Project
HI.. i want to parse a youtube URL like "http://www.youtube.com/watch?v=pPWDugaPLLE"... so that i can get the flv on this page to be loaded into my own custom player in my swf... i don't have any idea how to do it i will appreciate little help on it.. thanks in advance.. Regards
Parse Html Bullets From Data Into Flash?
i realise that Flash has a fairly limited HTML/rich text, im using Generator also and retrieving data from a DB, and content inside it will contain bullets infact alot of them, I want to use the same DB for the html, rather than using a seperate DB for the flash site, is there a way to let Flash translate the bullet tags into flash as perhaps a placeholder for Generator/Flash??
thanks
RM
Flash Parse Inline Xml Code In HTML Page
I have a movie that loads data via an XML file and that works fine. My question is can I get that same information inline - ie can I have the Flash <object> tag or some xml equivelant on the same page as the xml?
If this is confusing, I am working within an application that allows me to add "panels" of HTML code to a page. I can copy the XML gue from an Office graph and paste it into my HTML and the ActiveX graph reads it. Can I add some xml gue to my HTML page and parse it in my SWF?
Thanks,
Rob.
How To Parse And Display Multi Item Remote Xml In Flash 8?
Hi all. there is a remote rss xml file that has 10 items inside it. I wonder how in flash
i can pars and display them on movie just like shown format:
flash movie display format:
-songname1 by artistname1
-songname2 by artistname2
-....
.....
Furthermore,i want to get new data every few seconds since it is dynamic rss xml.
I tried Loading Data from DB tutorial but could not achive my goal.
I be happy if some one show me how this can be done.Thanks
I also want each item to be clicable and it points to imageurl.
remote xml format:
CODE <playlist>
<song>
<artist>artistname1</artist>
<name>songname1</name>
<image>http://www.somesite.com/song_images/pic1.jpg</image>
<rating>3.26667</rating>
<songid>3043</songid>
<totalvotes>15</totalvotes>
</song>
<song>
<artist>artistname2</artist>
<name>songname2</name>
<image>http://www.somesite.com/song_images/pic2.jpg</image>
<rating>5</rating>
<songid>4935</songid>
<totalvotes>3</totalvotes>
</song>
....
....
</playlist>
Flash Fails To Parse PHP Vars When Retrieved By MySQL Query.
FACTS
1. I'm using PHP to query a mySQL database.
2. I'm using the LoadVars class to retrieve those variables from PHP into Flash.
3. I'm using Flash 8, PHP 5, and MySQL 5.
PROBLEM:
Flash will not parse the PHP page if I include a MySQL
query on that page. The variables are passed, but Flash
doesn't read them.
For example, this code below works fine on its own:
Code:
$tagline = " some word";
echo ("&tagline=$tagline");
But when I add the mySQL query, Flash fails to
pickup the variables even though they show up as URL
encoded in the source of the output html page.
Code:
db_connect();
$sql = 'SELECT
tagline
FROM
some_table
ORDER BY RAND() LIMIT 1';
if( ($result = mysql_query($sql)) === FALSE )
{
echo mysql_error();
} else
while ($row = mysql_fetch_assoc($result))
extract($row);
echo ("&tagline=$tagline");
This is the actionscript I'm using:
Code:
tagData = new LoadVars();
tagData.onLoad = function(write){
text = this.tagline;
}
tagData.load("variables.php");
Can anyone think of a workaround for this?
Flash MX - HTML Parsing Problem: Custom Extension File Won't Parse As HTML
I am using Flash MX.
The problem is, I have a movieclip in my main timeline. This movieclip has a main key and a refresh key, which updates the dynamic textfield's contents with a loaded variable named content. The variable content is stored within a file named readme.ifh. When I load the variable in the textfield, it shows me the source of the HTML, not the rendered version.
What's wrong (and yes, I do have the "Render as HTML" option checked)?
What's The Best Way To Parse Out A Url String Using The String Object In Flash
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.
In flash I want to parse the string that I get from the database and look for URL strings that start with http "http://www.someurl.com" and parse out that substring.
For example the string could be "Please vist my site at http://www.site.com". I would want to parse out the http://www.site.com
If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield.
Does flash have an object that deals with Regular Expressions?
I've looked at the String object in flash but not sure how to achieve this task
I'm currently working on this so any ideas?
What's The Best Way To Parse Out A Url String Using The String Object In Flash
I'm creating a CMS(Content Management System) tool so that users can change text and the changes be reflected in a text window in flash . The text that the user enters in the CMS tool will be stored in the database.
In flash I want to parse the string that I get from the database and look for URL strings that start with http "http://www.someurl.com" and parse out that substring.
For example the string could be "Please vist my site at http://www.site.com". I would want to parse out the http://www.site.com
If I find this url string I want to pre-pend the a href tag <a> and append the closing </a> tag to the string so that this link will be clickable from the textfield.
Does flash have an object that deals with Regular Expressions?
I've looked at the String object in flash but not sure how to achieve this task
I'm currently working on this so any ideas?
How To Parse A Name?
Does anyone know how to parse a name so it displays correctly?
I am capturing a name from a database, but it comes last name, first name (i.e. Smith, John).
How do I parse that in actionscript and display is as John Smith.
Thanks.........
Parse The URL
i was wondering if flash 6 actionScript libraries had the ability to parse the URL of the html that the movie was playing in, without out using server side or JS scripting?
i've tried this._url but it only returned the url ending with the swf file (http://www.../file.swf) and needed is the actual url of the page the swf is playing in (http://www.../file.html) also i can't just change the url string in flash from a .swf extension to a .html casue the page extension could be anything, so this aspect need to be dynamic in nature... is this possible all from within the swf?
Parse XML
Hello everybody,
I am new to ActionScript. I have to bring data from MySQL database with PHP script to flash. The user then navigate through the records. I think I should make an XML of the data and then pass the whole XML to the flash. I am searching how can I parse the XML in the ActionScript so that I can let user navigate through records.
Thanks.
How Can I Parse A Var?
Ok I am sending data via xml sockets using flash 9 pro.
I have no idea how to build and send variables in an xml packet, but I can send one variable through my xml socket fine. So, I was thinking of using a special charter between my variables.
How, then, can I parse out my data?
Say I have 3 variables always and in the same order. If I use say * to seperate my data how would I get 3 variables from my one variables?
i.e. var myVar = "This is the first string*This is The second string* This is the third"
Place data into:
variables 1 2 and 3.
Second, is there a better way to pass variables through a xml socket? If so how?
Parse XLS With AS3?
Wondering if anyone knows of a way to parse an Excel .xls file directly in AS3 script. (I already have an CSV parser, and XML is not really an option in this situation.)
Thanks!
Parse XML
Hello everybody,
I am new to ActionScript. I have to bring data from MySQL database with PHP script to flash. The user then navigate through the records. I think I should make an XML of the data and then pass the whole XML to the flash. I am searching how can I parse the XML in the ActionScript so that I can let user navigate through records.
Thanks.
Parse XML DOM
I need to parse XML DOM in flash......
server side script is sending one var "req" through that XML DOM
And after parsing that XML DOM i'll get a XML again from which i need to parse the path to load an image
Why Can't I Parse
I have three dynamic text boxes. variables respectively (caption0,caption1,caption2).
My xml file is structured as:
<?xml version="1.0" encoding="iso-8859-1"?>
<captions>
<caption>Roll over this</caption>
<caption>This is the first Caption.</caption>
<caption>This is the second Caption.</caption>
</captions>
I am trying to create a rollover where when you rollover caption0; caption1 and caption2 are displayed in sequence.
Everything works except though only the first caption is ever displayed. For the other two I get "level0.caption1" and "level0.caption2" instead of the text in the xml file above.
Help!
This has got to be simple and I am missing something.
How do I parse the data so that each of the variables are assigned the text in the xml file?
Xml Parse As 2 HElp
HI, guys, thanks for taking your time to read this thread,
im newbie in as and getting stress now, so i hope anyone can help me
i have xml and this is the code
<?xml version="1.0" encoding="UTF-8"?>
<data>
<genre id="1">
<id>1</id>
<root>0</root>
<name>Action</name>
<description>Action</description>
</genre>
<genre id="6">
<id>6</id>
<root>0</root>
<name>Thriller</name>
<description>Thriller</description>
</genre>
<genre id="7">
<id>7</id>
<root>0</root>
<name>Comedy</name>
<description>Comedy</description>
</genre>
<genre id="8">
<id>8</id>
<root>0</root>
<name>Romantic Comedy</name>
<description>Romantic Comedy</description>
</genre>
<genre id="10">
<id>10</id>
<root>0</root>
<name>Classics</name>
<description>Classics</description>
</genre>
<genre id="11">
<id>11</id>
<root>0</root>
<name>Cult</name>
<description>Cult</description>
</genre>
<genre id="12">
<id>12</id>
<root>0</root>
<name>Documentary</name>
<description>Documentary</description>
</genre>
<genre id="13">
<id>13</id>
<root>0</root>
<name>Indie / Foreign</name>
<description>Indie / Foreign</description>
</genre>
<genre id="15">
<id>15</id>
<root>0</root>
<name>Children</name>
<description>Children</description>
</genre>
<genre id="16">
<id>16</id>
<root>0</root>
<name>Musicals</name>
<description>Musicals</description>
</genre>
<genre id="18">
<id>18</id>
<root>0</root>
<name>TV Shows</name>
<description>TV Shows</description>
</genre>
<genre id="19">
<id>19</id>
<root>0</root>
<name>War</name>
<description>War</description>
</genre>
<genre id="23">
<id>23</id>
<root>0</root>
<name>Drama</name>
<description>Drama</description>
</genre>
<genre id="31">
<id>31</id>
<root>0</root>
<name>Music & Concert</name>
<description>Music & Concert</description>
</genre>
<genre id="43">
<id>43</id>
<root>13</root>
<name>special collection</name>
<description></description>
</genre>
<genre id="44">
<id>44</id>
<root>13</root>
<name>criterion collection</name>
<description></description>
</genre>
</data>
</xml>
and now, i want to parsing the xml and get the id node from this xml
so here's the code:
/*global variabel declare*/
var label:TextField;
var duplicate_genre:MovieClip;
/*end declare*/
/*Opening connection with xml*/
myXML = new XML();
var id:Array;
var path_id:Array;
myXML.ignoreWhite = true;
myXML.load("genre.xml");
myXML.ref = this;
myXML.onLoad = function(succes) {
if (succes) {
var root = this.firstChild;
var nodes = root.childNodes;
for (var i = 0; i<nodes.length; i++) {
subnodes = nodes[i].childNodes;
duplicate_genre= _root.genre.createEmptyMovieClip(["container"+i], _root.genre.getNextHighestDepth());/*make container for dynamic txt genre*/
this["label"+i]=duplicate_genre.createTextField(["labelor"+i], 1, -422, (i*28.5)+(-200), 143.8, 22.6);/*declare position text for genre*/
/*conditional if text <20*/
if (i<20) {
this["label"+i].text = subnodes[2].firstChild.toString();/*write genre xml to dynamic text*/
path_id=_root.genre["id"+i]= this["container"+i]=subnodes[0].firstChild.toString();/*declare id genre xml*/
trace(duplicate_genre+path_id);
/*opening otherXML */
otherXML = new XML()
otherXML.ignoreWhite = true
duplicate_genre.onRelease = function() {
var string="other.xml/"+_root.genre.path_id;/*declare url for movie list*/
trace(string);
otherXML.load(string);/*function for load url movie*/
otherXML.onLoad = function(succes) {
if (succes) {
var totalpage = this.childNodes[1].firstChild.toString();
totalpage_txt.text = "("+totalpage+" Movies)";/*function for display total page*/
var root = this.firstChild;
nodes = root.childNodes;
for (var i = 0; i<nodes.length; i++) {
subnodes = nodes[i].childNodes;
_root.genre["cover_title"+i].text = subnodes[1].firstChild.toString();/*function for display movie name*/
_root.genre["genre_name"].text = subnodes[3].firstChild.toString();/*function for display genre name*/
}
} else {
trace("Error loading otherXML");
}
};/*end other xml load function*/
};/*end conditional for on release*/
} else {
trace("erorr loading xml document");
}/*end if text < 20*/
}/*end for Myxml*/
} else {
trace("Error loading XML document");
}
};
/*end connection for myXML*/
the trouble begins here, when i want to take id node at xml and parsing it into other.xml"+_root.genre.path_id,
i'm always get id from the last xml which is "44", and can't be suitable with te container which i clicked,
can u see the problems??
sorry my poor english
anyone have advice???
thanks
Parse URLs
Hi peoples,
Is it possible to parse URLs from a txt file and then use loadVariable to activate link??
Any help appreciated.
Total Extraction
How Do I Correctly Parse This?
Lets say I have 2 objects "item1" and "item2"
I know I can swap their depths by writing:
_root.item1.swapDepths (_root.item2);
Now lets say I have a=1 and b=2...
How do I properly write:
_root.item+a.swapDepths (_root.item+b)
The second part seems to work with ("_root.item"+b), but I can't figure out the first part...
How To Parse A String
Hey guys,
does anybody know how to parse a string 12345 in to five variables
a=1;
b=2;
c=3;
d=4;
e=5;
Thanks
Parse Mailto: From Php
I am pulling all of the variables used in this movie from php. I am taking a mc and repeating it according to the number of agents that are determined by the database. I can get the box to repeat as well as populate all of the information to be displayed. I just cannot get it to getURL("mailto:"+emailAddress);
help please...
[actionScript]
for (i=0; i<=(this.agents.length-1); i++) {
space = 250;
_root.agentBox.duplicateMovieClip("agentBox_"+i, i);
_root["agentBox_"+i].agentName.text = this.agents[i].agent_name;
_root["agentBox_"+i].agentTitle.text = this.agents[i].agent_title;
_root["agentBox_"+i].agentCell.text = this.agents[i].agent_cell;
_root["agentBox_"+i].agentEmailBut.agentEmail.text = this.agents[i].agent_email;
email[i]="mailto:"+this.agents[i].agent_email;
_root["agentBox_"+i].agentEmailBut.onRelease = function(){
getURL(email[i]);
}
if (i != 0) {
_root["agentBox_"+i]._x = _root["agentBox_"+(i-1)]._x-space;
}
}
[/actionScript]
Big One: How To Parse .eps Or .pdf Into An Online SWF ?
Big one: how to parse .eps or .pdf into an online SWF ???
1 thing I start to realise, after searching for a solution till I woke up with "qwerty" pressed on my face, is:
Probably a server-side "nut to crack"?
The basic concept is like this:
Creating a full-dynamic site with database, where the DTP department of some magazine can put their .eps-files into, wich get dynamicly loaded, and even, if possible parsed and manipulated........
How Do You Parse A String?
I am wondering how to convert a string lets say "5+(8+3)-6" into whatever it equals (10).
Please help,
zach_297
P.S. Then I might help you.
Parse String
I was wondering if anybody knew about a function that would take a string i.e. "3 + 3" and figure out what it equals just by parsing the string.
Thanks in Advance,
zach_297
P.S. I have flash 8
XML Parse The URL, GetURL Needs To Get That URL, Help Please?
hi Everyone , please have a look at the attached Fla file which shows the url coming from the XML file i have shown the URLS in the dynamic text box, There is a button on the stage which needs to function as the dynamic button that changes its URL within the GETURL syntax from the URL which comes from the XML
The XML coed is :
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<FOTO>
<texto>http://www.yahoo.com</texto>
</FOTO>
<FOTO>
<texto>http://www.cnn.com</texto>
</FOTO>
<FOTO>
<FOTO>
<texto>http://www.bbcworld.com</texto>
</FOTO>
so the script behind the Flash button named URLBTN should be changed to :
Code:
//variable get on the first frame of the flash is i
on (press) {
getURL("http://www.yahoo.com"); or
getURL(i);
}
similarly if the XML parse the second record the GETURL script modifies it self with the updated url.
Please please please if anyone can help me in that, it will help me a lot in finishing my project.
Many Thanks
F.
[F8] Parse XML As Array
Hi,
I've been working on a 3D carousel in which, images and text are loaded externally and displayed in a rotating ring, swapping depths giving a 3D effect. This is working great and when the user clicks on one of the items, the ring scales and fades, sliding the clicked item to the top corner and displays the externally loaded text.
This is all sourced from XML but I would now like to expand this to work as a navigation for video as well.
My problem is that I cannot figure out how to correctly reference the video URL attribute from my XML.
The code for loading the images/text/videos are as follows (my recent additions are in bold):
Code:
//--------SETUP NETSTREAM------------
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.setBufferTime(9);
my_video.attachVideo(stream_ns);
//--------GET XML-----------
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for(var i=0;i<numOfItems;i++)
{
var t = home.attachMovie("item","item"+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
t.toolText = nodes[i].attributes.tooltip;
t.content = nodes[i].attributes.content;
streampath = nodes[i].attributes.video;
t.icon.inner.loadMovie(nodes[i].attributes.image);
t.r.inner.loadMovie(nodes[i].attributes.image);
t.icon.onRollOver = over;
t.icon.onRollOut = out;
t.icon.onRelease = released;
//t.linkURL = nodes[i].attributes.link;
}
}
//------FUNCTION ONRELEASE-----
//scale and fade items using tween class
theText.text = t.content;
stream_ns.play(streampath);
//set video display visibility:true
For reference I have uploaded both my SWF, FLA and XML to the following:
SWF: http://www.dedicatedmicros.com/ukftp/carousel/
FLA: http://www.dedicatedmicros.com/ukftp.../carousel4.fla
XML: http://www.dedicatedmicros.com/ukftp...sel/icons5.xml
Right now, i've got it so it loads the FLV URL into my netstream but it's always the same video and it's not even the first video in my XML?!?
I think this is because I need to parse the video URL from my XML into an array but don't know how to go about it..
I've tried loads of different things but I'm obviously a fair way off.
If anyone has any ideas I'd be really grateful,
Thanks,
Dave
PS: I haven't set any buffer clips yet much of it's a little crude as i'm just trying to work the code out so, just give the video a second to load and you'll see what I mean..
How To Parse A String?
Hi, how to use regular expression in flash ??
for example :
var str = "xxx.yyy.zzz";
var pattern = "/([a-zA-Z]+).([a-zA-Z]+).([a-zA-Z]+)/";
var match = new Array();
reg_match(pattern, str, match);
How To Parse This Link
Hey Everyone,
I am trying to figure out how to parse this link and take out the nodeValue for Title and Description under the Item Section.....what is the exact string that i need to parse the two values cause i can pull out text all the way up to the "ttl" value with this line.....
Code:
trace(my_xml.firstChild.firstChild.childNodes[7].firstChild.nodeValue);
why wont it let me reference any further to get the values i want??
Here is the loading function.....
Code:
var my_xml:XML = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
if (success){
trace(my_xml.firstChild.firstChild.childNodes[7].firstChild.nodeValue);
}
}
my_xml.load("http://wordsmith.org/awad/rss1.xml");
Thanks in Advance,
Chris Tarantino
Need To PARSE A Complex XML
Hi All,
I'm new here and I just started AS too but glad to find such a huge community around here. I've been trying to parse some simple XML lately and so far successful with them. Now I got this one complex XML from amazon that i get from their webservice feature. I've been trying to figure out how but failed . I get zero results when i tried to converting them to array. Is there any way i could get this done? and put it on my Tree elements
Code:
<ItemSearchResponse xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://webservices.amazon.com/AWSECommerceService/2006-11-14" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OperationRequest>
<HTTPHeaders>
<Header Name="UserAgent" Value="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"/>
</HTTPHeaders>
<RequestId>AMAZONAPIKEY</RequestId>
<Arguments>
<Argument Name="Service" Value="AWSECommerceService"/>
</Arguments>
<RequestProcessingTime>0.18680214881897</RequestProcessingTime>
</OperationRequest>
<Items>
<Request>
<IsValid>True</IsValid>
<ItemSearchRequest>
<Keywords>Adidas</Keywords>
<ResponseGroup>Small</ResponseGroup>
<ResponseGroup>Images</ResponseGroup>
<SearchIndex>Apparel</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>11254</TotalResults>
<TotalPages>1126</TotalPages>
<Item>
<ASIN>B0007QCPO6</ASIN>
<DetailPageURL>http://www.amazon.com/gp/redirect.html%3FASIN=B0007QCPO6%26tag=ws%26lcode=sp1%26cID=2025%26ccmID=165953%26location=/o/ASIN/B0007QCPO6%253FSubscriptionId=0EKNQZD51HQ0WP6YE302</DetailPageURL>
<SmallImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01._SCTHUMBZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">75</Width>
</SmallImage>
<MediumImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01._SCMZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">160</Width>
</MediumImage>
<LargeImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01._SCLZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">500</Width>
</LargeImage>
<ImageSets>
<ImageSet Category="primary">
<SmallImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01._SCTHUMBZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">75</Width>
</SmallImage>
<MediumImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01._SCMZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">160</Width>
</MediumImage>
<LargeImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01._SCLZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">500</Width>
</LargeImage>
</ImageSet>
<ImageSet Category="variant">
<SmallImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.BACK._SCTHUMBZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">75</Width>
</SmallImage>
<MediumImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.BACK._SCMZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">160</Width>
</MediumImage>
<LargeImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.BACK._SCLZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">500</Width>
</LargeImage>
</ImageSet>
<ImageSet Category="variant">
<SmallImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.RGHT._SCTHUMBZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">75</Width>
</SmallImage>
<MediumImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.RGHT._SCMZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">160</Width>
</MediumImage>
<LargeImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.RGHT._SCLZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">500</Width>
</LargeImage>
</ImageSet>
<ImageSet Category="variant">
<SmallImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.LEFT._SCTHUMBZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">75</Width>
</SmallImage>
<MediumImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.LEFT._SCMZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">160</Width>
</MediumImage>
<LargeImage>
<URL>http://ec1.images-amazon.com/images/P/B0007QCPO6.01.LEFT._SCLZZZZZZZ_V1123253993_.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">500</Width>
</LargeImage>
</ImageSet>
</ImageSets>
<ItemAttributes>
<Manufacturer>adidas</Manufacturer>
<ProductGroup>Apparel</ProductGroup>
<Title>adidas Women's Supernova Cushion Running Shoe</Title>
</ItemAttributes>
</Item>
.
.
.
</Item>
</Items>
</ItemSearchResponse>
Your response is greatly appreciated and thanks to be part of this great forum.
regards,
XML Parse Problem
I have an xml document that is being read by a flash document and the same document is being read by a xsl template file to style the file. I had the flash communicating with the xml document and filling all of the text boxes on my stage correctly until I had to make the declaration at the top of the xml document to make the styling possible.
PHP Code:
<?xml version="1.0"?><?xml-stylesheet href="books2.xsl" type="text/xsl"?>
I guess my question is would be how do I get actionscript to ignore the
PHP Code:
<?xml version="1.0"?><?xml-stylesheet href="books2.xsl" type="text/xsl"?>
code?
PHP Code:
// Extract information from the XML file
function showBook(bookInfoNode){
if (bookInfoNode.nodeName.toUpperCase() == "BOOKINFO"){
_root.summaryTB = "";
details = bookInfoNode.firstChild;
while (details != null){
if (details.nodeName.toUpperCase() == "DETAILS"){
authorTB = "";
bookTB = "";
dateTB = "";
publisherTB = "";
summaryTB= "";
bioTB = "";
element = details.firstChild;
while (element != null){
if (element.nodeName.toUpperCase() == "AUTHORNAME"){
authorName = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "BOOKNAME"){
bookName = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "BOOKDATE"){
bookDate = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "PUBLISHERNAME"){
publisherName = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "SUMMARYTEXT"){
summaryText = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "BIOTEXT"){
bioText = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "IMAGEURL"){
imageUrl = element.firstChild.nodeValue;
}
if (element.nodeName.toUpperCase() == "IMAGEURLH"){
imageUrlH = element.firstChild.nodeValue;
}
element = element.nextSibling;
}
//assigns the XML nodes to their respective textboxes
_root.summaryTB = summaryText;
_root.bookTB = bookName;
_root.dateTB = bookDate;
_root.publisherTB = publisherName;
_root.authorTB = authorName;
_root.bioTB = bioText ;
bookHolder.loadMovie(imageUrl);
}
details = details.nextSibling;
}
}
}
// Check to make sure the XML file loaded, call the next function
function myLoad(ok){
if (ok == true) {
showBook(this.firstChild);
}
}
// Create a new XML object and load the XML file
bookXML = new XML();
bookXML.onLoad = myLoad;
//bookXML.load(eval("xmlLoader"));
Also here is the entire xml document that is being loaded
PHP Code:
<?xml version="1.0"?><?xml-stylesheet href="books2.xsl" type="text/xsl"?>
<bookInfo>
<details>
<bookName>Gopher Tales:Stories From the History of Minnesota</bookName>
<authorName>Minnie Ellingson Tapping</authorName>
<bookDate>10.39.43</bookDate>
<publisherName>PublisherName Here</publisherName>
<summaryText>This is a first-person account of a journalist’s experience during WWII. In addition to the actual events of the war, Sevareid discusses the development of journalistic strategies for covering international affairs. The author recounts his own youth in North Dakota and his reasoning for studying journalism. It also covers his early career in radio reporting at the beginning of the war. </summaryText>
<bioText>Eric Sevareid, U.S. Journalist. Educated at the University of Minnesota, B.A. in political science 1935; studied at London School of Economics and Alliance Francais I Paris. Sevareid began his journalism career as a teenage copy boy at the Minneapolis Journal, then worked as a freelancer for the Minneapolis Star while in college. After a brief stint on the staff of the Minneapolis Journal (1936-37), and as a reporter on the Paris edition of the New York Herald Tribune (1938), he was recruited to join CBS radio by Edward R. Murrow in 1939. Sevareid made a name for himself during World War II, first by traveling with the French army and air force for CBS (1939-40), becoming the first to report France’s capitulation to Germany. He was then assigned to the CBS News Bureau in Washington, D.C. (1941-43), served as war correspondent in China (1943-44) and in London (1945). He served as chief Washington, D.C. correspondent for CBS (1946-59), and as European correspondent, (1959-61). Sevareid was commer for The CBS Evening News, from 1963, and was the network's national correspondent from 1964. He began hosting an interview series, Conversations with Eric Sevareid, in 1977. Eric Sevareid eceived numerous honorary degrees, as well as Peabody Awards (1950, 1964, and 1976), three Emmy Awards, two Overseas Press Club Awards, the Harry S. Truman Award, 1981; numerous other awards. Sevareid died July 9, 1992.</bioText>
<imageUrl>web_assets/images/bookCovers/chucklingFingers.jpg</imageUrl>
<imageUrlH>../images/bookCovers/chucklingFingers.jpg</imageUrlH>
</details>
</bookInfo>
Can anyone help?
Parse XML To Object
Forum,
I am really surprised that I have not been able to
find a library or some code on the web for parsing
an XML file to a ready to use object.
Can someone direct me to some code that would
turn an XML object into a set of associative arrays
that mirror the XML tag structure.
ie
Code:
<data>
<a>
<b>
<c> hi </c>
</b>
</a>
</data>
convereted to:
object.a.b.c -> hi
Thanks!
-J
Not Able To Parse Media RSS In AS3.0
Hi All,
I'm not able to parse to a particular node in a media rss feed using AS3.0 XML Parsing
The (simplified version) of the rss is
Code:
<rss xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
version="2.0">
<channel>
<item>
<media:content>
<media:title>'Sorry 1'</media:title>
</media:content>
<media:content>
<media:title>'Get Together 1'</media:title>
</media:content>
</item>
<item>
<media:content>
<media:title>'Sorry 2'</media:title>
</media:content>
<media:content>
<media:title>'Get Together 2'</media:title>
</media:content>
</item>
<item>
<media:content>
<media:title>'Sorry 3'</media:title>
</media:content>
<media:content>
<media:title>'Get Together 3'</media:title>
</media:content>
</item>
</channel>
</rss>
I'm trying to access the node 'media:content' but am not able to do so...Seems like I'm missing something out here. I just moved into AS3 from AS2 and this is getting me crazy.. Please help
Parse An XML With Namesapce
Hi
I try to use webservice and AS3. I use this class
http://alducente.wordpress.com/2007/...s3-release-10/
I have a XML like that
Code:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCollectionsResponse xmlns="http://toto.com/">
<GetCollectionsResult>
<CCollection>
<m_iUserID>63155</m_iUserID>
<m_iAlbumID>4716235</m_iAlbumID>
<m_iRoleID>14</m_iRoleID>
<m_iSmartCollectionID>40</m_iSmartCollectionID>
<m_photos>
<CPhoto>
<m_iPhotoID>21108922</m_iPhotoID>
<m_iWidth>0</m_iWidth>
<m_iHeight>0</m_iHeight>
<m_strFileName/>
<m_strDescription>test photo1</m_strDescription>
<m_strURL>http://storage.photofinale.com/storage/5.0/lucidiom/photo.aspx?photo=21108922&size=96</m_strURL>
<m_dtDateAdded>2008-01-04T11:33:19.5708799-05:00</m_dtDateAdded>
<m_lFileSize>0</m_lFileSize>
<m_iFormat>0</m_iFormat>
<m_iSortOrder>-1</m_iSortOrder>
<m_dtDateTaken>2007-12-08T00:00:00</m_dtDateTaken>
</CPhoto>
<CPhoto>
<m_iPhotoID>21108924</m_iPhotoID>
<m_iWidth>0</m_iWidth>
<m_iHeight>0</m_iHeight>
<m_strFileName/>
<m_strDescription>test photo 3</m_strDescription>
<m_strURL>http://storage.photofinale.com/storage/5.0/lucidiom/photo.aspx?photo=21108924&size=96</m_strURL>
<m_dtDateAdded>2008-01-04T11:33:19.5708799-05:00</m_dtDateAdded>
<m_lFileSize>0</m_lFileSize>
<m_iFormat>0</m_iFormat>
<m_iSortOrder>-1</m_iSortOrder>
<m_dtDateTaken>2007-12-08T00:00:00</m_dtDateTaken>
</CPhoto>
</m_photos>
<m_location>
<m_lX>0</m_lX>
<m_lY>0</m_lY>
<m_lZ>0</m_lZ>
</m_location>
<m_strDescription/>
<m_strName/>
<m_dtCreated>0001-01-01T00:00:00</m_dtCreated>
<m_dtModified>0001-01-01T00:00:00</m_dtModified>
</CCollection>
</GetCollectionsResult>
</GetCollectionsResponse>
</soap:Body>
</soap:Envelope>
I try go to get the node CCollection , test this code
Code:
var soapNS:Namespace = serviceRespone.namespace("soap");
var body:XMLList = serviceRespone.soapNS::Body;
trace(body.CCollection);
However , trace retrun nothing
can you help me
thanks
RSS Feed And Parse
I have an rss feed that I'd like to bring into a Flash movie, and am successful in linking the code, but it displays too much info and not in a very readable format. How do I tell Flash to parse the rss feed? I've searched for tutorials on here and found none (if there is one please send a link). Everything else I've found on here and elsewhere is way more complicated (don't need scrolling text or drop-down menus, etc.) I'm able to control a tiny bit through textstyle.css, but not enough.
If I were to parse the rss, what would that code look like and how would it link up to the existing link and text box, or is there another manner in which I'd be required to link it to control the output?
Thanks...
Here is my code so far,
Code:
this.createClassObject(mx.controls.TextArea,"myEvent",151,{html:true});
myEvent.setSize(380,100);
myEvent._x = 299;
myEvent._y = 284;
//init TextArea component
myEvent.html = true;
myEvent.wordWrap = true;
myEvent.multiline = true;
myEvent.label.condenseWhite = false;
myEvent.setStyle("borderStyle","none");
_global.styles.TextArea.setStyle("backgroundColor","transparent");
//load css
kungFuStyle = new TextField.StyleSheet();
kungFuStyle.load("textstyle.css");
myEvent.styleSheet = kungFuStyle;
//load in XML
kungFuContent1 = new XML();
kungFuContent1.ignoreWhite = true;
kungFuContent1.onLoad = function(success) {
if (success) {
myEvent.text = kungFuContent1;
}
};
kungFuContent1.load("http://LiveWireMusician.lwcr.com/rss/calendarDirect.aspx?i=13574.13856");
XML Parse Question
Hello all and happy new year to everyone!
I have a quick (and should be painless) question. I am trying to read a simple XML file and based on the results turn MCs on and off. I have done this multiple times with success using a slightly different method (using XML node attributes and looping through the nodes) but something is off here. Any help would be greatly appreciated. I can't believe I can't get this to work...sorta embarassing...
Code:
var itemList:Object = new Object();
var my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(success){
var CMS = my_xml.firstChild.firstChild;
episode1a = CMS.firstChild.childNodes;
episode1b = CMS.lastChild.childNodes;
this.E1partOne = episode1a;
this.E1partTwo = episode1b;
trace(this.E1partOne);
trace(this.E1partTwo);
if (this.E1partOne == 1) {
trace("Finally!");
} else {
trace("You Suck!");
}
}
my_xml.load("episodes3.xml");
And here is the XML file:
Code:
<?xml version="1.0" standalone="yes"?>
<CMS>
<Episode1>
<partOne>1</partOne>
<partTwo>0</partTwo>
</Episode1>
<Episode2>
<partOne>0</partOne>
<partTwo>0</partTwo>
</Episode2>
</CMS>
The very strange thing is that the trace shows the correct two numbers, 1 and 0. However, the if/else statement will not fire.
Any ideas? This thing keeps telling me I suck...
How To Parse A String ?
hi,
I am sure that someone will be able to help me on that...
I would like to do the following:
parse a sentence and then put each word in a variable
for example, let's say I have I enter that sentence in a text field:
I am happy
What I would like to do is cut that sentence (the space is the type that indicates that one word in finished) and then allocate :
arg1 = "I";
arg2 = "am";...
Hope someone will help me
thanks a lot
a-sais-pas
Parse String
How can I split a string that has comma seperated values into different values that I then can assign to new variables? My string looks like "12,Your Name".
ActionScript Code:
myFunc = function(arg){
nummer = arg.split(",");
nName = arg.split();
trace("HIT: "+nummer+"||"+nName )
}
|