Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
|
|
Xml And External Link
This is a discussion on Xml And External Link, within the Flash & Multimedia section. This forum and the thread "Xml And External Link" are both part of the Designing Your Website category.
![]() ![]() |
May 5 2008, 03:07 PM
Post
#1
|
|
![]() Fresh Squeezed ![]() ![]() Posts: 14 Joined: 22-February 08 From: Netherlands |
Im stuck on this one. Im making a header in flash and the client wants to update the photo's and url himself,without touching the .fla. So I made the flash load in the jpgs via an xml file. But now I dont know how to have the urls loaded from the xml file aswell. Does any of you know a way or a tutorial on how to do this? This is the script in flash I use to load in the jpgs.
CODE delay = 3000; //----------------------- function loadXML(loaded) { if (loaded) { xmlNode = this.firstChild; image = []; description = []; total = xmlNode.childNodes.length; for (i=0; i<total; i++) { image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; } firstImage(); } else { content = "file not loaded!"; } } xmlData = new XML(); xmlData.ignoreWhite = true; xmlData.onLoad = loadXML; xmlData.load("images.xml"); // /////////////////////////////////// listen = new Object(); listen.onKeyDown = function() { if (Key.getCode() == Key.LEFT) { prevImage(); } else if (Key.getCode() == Key.RIGHT) { nextImage(); } }; Key.addListener(listen); previous_btn.onRelease = function() { prevImage(); }; next_btn.onRelease = function() { nextImage(); }; // /////////////////////////////////// p = 0; this.onEnterFrame = function() { filesize = picture.getBytesTotal(); loaded = picture.getBytesLoaded(); preloader._visible = true; if (loaded != filesize) { preloader.preload_bar._xscale = 100*loaded/filesize; } else { preloader._visible = false; if (picture._alpha<100) { picture._alpha += 2; } } }; var myInterval; function nextImage() { p++; p %= image.length; if (loaded == filesize) { picture._alpha = 0; picture.loadMovie(image[p], 1); desc_txt.text = description[p]; picture_num(); clearInterval(myInterval); if (btn.playing) { slideshow(); } } } function prevImage() { clearInterval(myInterval); if (btn.playing) { slideshow(); } if (p>0) { p--; } else { p = image.length-1; } picture._alpha = 0; picture.loadMovie(image[p], 1); desc_txt.text = description[p]; picture_num(); } function firstImage() { if (loaded == filesize) { picture._alpha = 0; picture.loadMovie(image[0], 1); desc_txt.text = description[0]; picture_num(); clearInterval(myInterval); if (btn.playing) { slideshow(); } } } function picture_num() { current_pos = p+1; pos_txt.text = current_pos+"/"+total; } function slideshow() { myInterval = setInterval(pause_slideshow, delay); function pause_slideshow() { clearInterval(myInterval); nextImage(); } } btn.t.text = ""; btn.playing = true; btn.onPress = function() { if (this.playing) { this.playing = false; clearInterval(myInterval); this.t.text = ""; } else { this.playing = true; nextImage(); this.t.text = ">"; } }; Maybe im doing this the wrong way? I'd appreciate if someone can lead me in the right direction! Marieke. |
|
|
May 5 2008, 05:17 PM
Post
#2
|
|
|
Fresh Squeezed ![]() Posts: 37 Joined: 15-February 08 |
Hey there - I'm not sure if it'd be this simple, but you can use the <url> </url> in your XML tree to set the URL and then include it in the code just like you did the .jpgs...
Cheers, Scott |
|
|
May 6 2008, 03:13 AM
Post
#3
|
|
![]() Fresh Squeezed ![]() ![]() Posts: 14 Joined: 22-February 08 From: Netherlands |
Hey there - I'm not sure if it'd be this simple, but you can use the <url> </url> in your XML tree to set the URL and then include it in the code just like you did the .jpgs... Cheers, Scott Yes lol i've tried that.. I am using <url> </url> and I made a button in flash with a dynamic text field and a getURL function. When I test it locally I get the security sandbox violation pop up. (so its doing something at last) It says connection to http://blabla halted..but when I upload it it doesnt do anything.So I think the security thing is still around but only without the popup. |
|
|
May 6 2008, 03:19 AM
Post
#4
|
|
![]() Fresh Squeezed ![]() ![]() Posts: 14 Joined: 22-February 08 From: Netherlands |
Yes lol i've tried that.. I am using <url> </url> and I made a button in flash with a dynamic text field and a getURL function. When I test it locally I get the security sandbox violation pop up. (so its doing something at last) It says connection to http://blabla halted..but when I upload it it doesnt do anything.So I think the security thing is still around but only without the popup. aaaaaaaaaaaaaaaaaaaah its working !!! For some reason I put ' around the url in my xml file. O M G ! |
|
|
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
1 | Jason | 152 | 18th February 2008 - 09:15 AM Last post by: c010depunkk |
|||
![]() |
4 | thewal | 281 | 19th February 2008 - 11:19 AM Last post by: Jacob |
|||
![]() |
5 | Monie | 122 | 12th March 2008 - 12:39 PM Last post by: delusion |
|||
![]() |
1 | edd | 188 | 1st April 2008 - 05:53 PM Last post by: Scott |
|||
![]() |
3 | paintingtheweb | 231 | 20th April 2008 - 06:38 PM Last post by: karinne |
|||






May 5 2008, 03:07 PM








