function xmlfileLoaded() { xmlChild = xmlfile.firstChild.firstChild; entries = xmlChild.attributes.entries; var idcount = 1; } displayNextItem(); // move this inside the loadedFunction...right now this gets called before the xml is loaded // use this: function xmlfileLoaded() { xmlChild = xmlfile.firstChild.firstChild; entries = xmlChild.attributes.entries; var idcount = 1; displayNextItem(); }
Flash 8 XML Calendar
#21
Posted 05 April 2007 - 09:01 AM
#22
Posted 05 April 2007 - 09:04 AM
#23
Posted 05 April 2007 - 09:14 AM
xmlfile = new XML(); //xmlfile.onLoad = xmlfileLoaded; xmlfile.ignoreWhite = true; var oXMLListener:Object = new Object(); oXMLListener.scope = this; oXMLListener.onLoad = function(){ this.scope.xmlChild = xmlfile.firstChild.firstChild; this.scope.entries = this.scope.xmlChild.attributes.entries; var idcount = 1; this.scope.displayNextItem(); } xmlfile.addListener(oXMLListener); xmlfile.load("xml/bios2.xml");
Edited by Pax, 05 April 2007 - 09:19 AM.
#24
Posted 05 April 2007 - 09:30 AM
this is what it used atm:
xmlfile = new XML(); xmlfile.onLoad = xmlfileLoaded; xmlfile.load("xml/bios2.xml"); xmlfile.ignoreWhite = true; function xmlfileLoaded() { xmlChild = xmlfile.firstChild.firstChild; entries = xmlChild.attributes.entries; var idcount = 1; displayNextItem(); } function displayNextItem() { if (idcount<=entries) { if (xmlChild.nextSibling) { xmlfile = xmlChild.nextSibling; trace(xmlfile); itemManage(); } } } function itemManage() { eventID = currentBio2.attributes.id; eventDate = currentBio2.attributes.date; eventTitle = currentBio2.attributes.headline; xmlfile = currentBio2.attributes.xmlfile; currentLabel = eventDate+": "+eventTitle; eventLoad = eventID - 1 my_list.addItemAt(eventLoad, {label:currentLabel, data:xmlfile}); idcount = idcount + 1; displayNextItem(); } var my_list:mx.controls.List; //my_list.addItem({data:'flash', label:'Flash'}); //my_list.addItem({data:'funky dreamweaver', label:'Dreanweaver'}); //my_list.addItem({data:'coldfusion', label:'ColdFusion'}); // Create listener object. var listListener:Object = new Object(); listListener.change = function(evt_obj:Object) { trace("Value changed to: "+evt_obj.target.value); }; // Add listener. my_list.addEventListener("change", listListener);
This loops forever though, luckily flash automaticly stops it. It seems I don't have the hang of loop checks in Actionscript yet.
Any tips on this?
#25
Posted 05 April 2007 - 09:40 AM
function xmlfileLoaded() { xmlChildren = xmlfile.firstChild.childNodes; xmlChild = xmlfile.firstChild.firstChild; entries = xmlChild.attributes.entries; var idcount = 1; for(var ii:Number = 0; ii < xmlChildren.length; ii++){ xmlfile = xmlChildren[ii]; itemManage(); } } function displayNextItem() { if (idcount<=entries) { if (xmlChild.nextSibling) { xmlfile = xmlChild.nextSibling; trace(xmlfile); itemManage(); } } } function itemManage() { eventID = currentBio2.attributes.id; eventDate = currentBio2.attributes.date; eventTitle = currentBio2.attributes.headline; xmlfile = currentBio2.attributes.xmlfile; currentLabel = eventDate+": "+eventTitle; eventLoad = eventID - 1 my_list.addItemAt(eventLoad, {label:currentLabel, data:xmlfile}); idcount = idcount + 1; //displayNextItem(); }
#26
Posted 05 April 2007 - 09:40 AM
I also tried using this method, but it still loops forever.
function displayNextItem() { do { if (xmlChild.nextSibling) { xmlfile = xmlChild.nextSibling; trace(xmlfile); itemManage(); } } while (idcount<entries); } function itemManage() { eventID = currentBio2.attributes.id; eventDate = currentBio2.attributes.date; eventTitle = currentBio2.attributes.headline; xmlfile = currentBio2.attributes.xmlfile; currentLabel = eventDate+": "+eventTitle; eventLoad = eventID-1; my_list.addItemAt(eventLoad, {label:currentLabel, data:xmlfile}); ++idcount; displayNextItem(); }
EDIT: The Loops is fixed now. Just having problems with it adding the items into the list. I'll look into that.
Edited by Largo .//npc, 05 April 2007 - 09:53 AM.
#27
Posted 05 April 2007 - 10:13 AM
It adds the same sibling all 4 times. there are 4 different Sibling in this XML file, and that will change as more events are added, but it only adds the first one. I known it's something to do with nextSibling, I need to get that to go to the next one somehow.
function xmlfileLoaded() { xmlChild = xmlfile.firstChild.firstChild; entries = xmlChild.attributes.entries; idcount = 1; displayNextItem(); } function displayNextItem() { if (idcount<=entries) { if (xmlChild.nextSibling) { xmlChild2 = xmlChild.nextSibling; itemManage(); } } } function itemManage() { eventID = xmlChild2.attributes.id; eventDate = xmlChild2.attributes.date; eventTitle = xmlChild2.attributes.headline; xmlfile1 = xmlChild2.attributes.xmlfile; currentLabel = eventDate+": "+eventTitle; eventLoad = entries - eventID; trace(eventLoad); my_list.addItemAt(0, {label:currentLabel, data:xmlfile1}); ++idcount; displayNextItem(); }
EDIT:
Sorted it. Works ok now. Only a few problems left.
I've moved on to the next part, loading the event's own XML file, that works now, but for some reason, it refuses to set eventTitle.text, not sure why, I'll play with that.
The other thing I'm struggling with, and this is something I'd encountered in Flash since I started using it. If I put a ' in the test, for example "I won't be able to make it" The text in the dynamic text field displays: "I won't be able to make it".
I also have the problem with HTML, If i put something like "Go to the forums, <a href=\"forums.php\">Click here</a>", it displays as: "Go to the forums, <a href="forums.php">Click here</a>"
That's WITH HTML enabled on the text field.
Edited by Largo .//npc, 05 April 2007 - 10:45 AM.
#28
Posted 05 April 2007 - 10:42 AM
function displayNextItem() { if (idcount<=entries) { if (xmlChild.nextSibling) { xmlChild2 = xmlChild.nextSibling; xmlChild = xmlChild2; itemManage(); } } }
#29
Posted 05 April 2007 - 11:24 AM
I just took the 2s out, making it xmlChild.
Works perfectly now aside from the problems I mentioned above.
#30
Posted 06 April 2007 - 10:55 PM
I just need to add real content and fix the problem mentioned above
The other thing I'm struggling with, and this is something I'd encountered in Flash since I started using it. If I put a ' in the test, for example "I won't be able to make it" The text in the dynamic text field displays: "I won't be able to make it".
I also have the problem with HTML, If i put something like "Go to the forums, <a href=\"forums.php\">Click here</a>", it displays as: "Go to the forums, <a href="forums.php">Click here</a>"
That's WITH HTML enabled on the text field.
Thanks for all the help. This is the biggest thing I've done in flash before, and I'm surprised how much I understand about actionscript now.
Anyway, take a look.
http://www.beatclubo....uk/index2.html
#31
Posted 10 April 2007 - 09:08 AM
Did you notice that it doesn't like your apostrophe? It's outputting won't instead of won't.
I guess like anything, you've done it this way so you can customise it, but I use Outlook for my gigs (I do about 4 a week), and so I'm using phpicalendar with a script which extracts appointments from Outlook and converts it to .ics for use with phpicalendar. This takes me 5 minutes (including uploading), and means I have a fully up-to-date calendar, which is pretty painless
Edited by boogooloo1, 10 April 2007 - 09:09 AM.
#32
Posted 12 April 2007 - 09:19 AM
I did notice that it didn't like my apostrophe. I've asked for help regarding that, but I guess no one knows how to fix it. I have the same problem when I put some HTML code in too.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users