Web Design and Development Forums

xml & external link

This is a discussion on "xml & external link" within the Flash & Multimedia Forum section. This forum, and the thread "xml & external link are both part of the Design Your Website category.

Old May 5th, 2008, 11:05   #1 (permalink)
Reputable Member
 
Join Date: Aug 2007
Location: netherlands
Posts: 104
Send a message via MSN to ahwell Send a message via Yahoo to ahwell
xml & external link

Hi,
Im making a header in flash which loads in jpg's via an xml file. Its kind of a photoslideshow. Now I want an onRelease on each jpg which gets a different getURL from the xml. Can this be done? This is the code I use in flash:
Code: Select all
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 = "ll";
btn.playing = true;
btn.onPress = function() {
 if (this.playing) {
  this.playing = false;
  clearInterval(myInterval);
  this.t.text = "ll";
 } else {
  this.playing = true;
  nextImage();
 
  this.t.text = ">";
 }
};
Hope someone can help me! I googled all morning without any luck.
ahwell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 5th, 2008, 18:19   #2 (permalink)
Reputable Member
 
Join Date: Aug 2007
Location: netherlands
Posts: 104
Send a message via MSN to ahwell Send a message via Yahoo to ahwell
Re: xml & external link

..or maybe someone knows a different approuch to do this.. or tutorial. In short I want to load in jpgs plus urls via an xml file. So the client can change the jpeg's and url's without touching the fla.
ahwell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 5th, 2008, 19:57   #3 (permalink)
Moderator
 
marSoul's Avatar
 
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 367
Blog Entries: 2
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: xml & external link

you can add another tag for example <url></url> to your xml file for every image, then read their values in flash and onRelease function use that value to load external links
__________________
Designing for Communicating

Datis Design Website
Datis Design Weblog
marSoul is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 5th, 2008, 20:16   #4 (permalink)
Reputable Member
 
Join Date: Aug 2007
Location: netherlands
Posts: 104
Send a message via MSN to ahwell Send a message via Yahoo to ahwell
Re: xml & external link

Quote:
Originally Posted by marSoul View Post
you can add another tag for example <url></url> to your xml file for every image, then read their values in flash and onRelease function use that value to load external links
HI

Yes I've tried that but I don't know how to read the urls into my flash. How can I add a clickable text or make the loaded jpg clickable and then go to the lloaded url?
ahwell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 5th, 2008, 20:56   #5 (permalink)
Moderator
 
marSoul's Avatar
 
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 367
Blog Entries: 2
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: xml & external link

hi
Like this :

Code: Select all
url[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
then you can create a button and put a dynamic text box into it which reads this url[i] value
__________________
Designing for Communicating

Datis Design Website
Datis Design Weblog
marSoul is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 5th, 2008, 21:51   #6 (permalink)
Reputable Member
 
Join Date: Aug 2007
Location: netherlands
Posts: 104
Send a message via MSN to ahwell Send a message via Yahoo to ahwell
Re: xml & external link

Quote:
Originally Posted by marSoul View Post
hi
Like this :

Code: Select all
url[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
then you can create a button and put a dynamic text box into it which reads this url[i] value

I did like you said. I made a textfield,named it url_txt and put it inside a button. I put this on it:
Code: Select all
on(release){getURL(url,"_blank");}
so far so good (I think)
I put your script in the flashfile.
I put this in the xml
Code: Select all
<images>
    <pic>
        <image>http://www.gotoandflash.com/xavier/1.jpg<links>http://www.google.com</links></image>
  <description>mooi!!</description>
  <url>'http://www.google.com'</url>
    </pic>
blabla and so on
then when I try run it I get :
1. all the 5 urls I put in the xml load in at once
2.*** Security Sandbox Violation ***pops up

I have no idea what I did wong since i dont know what im doing in the first place..I put the files online for you to have a look at,maybe then its more clear.
Attached Files
File Type: fla header.fla (128.0 KB, 1 views)
File Type: xml images.xml (1.0 KB, 1 views)
ahwell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 5th, 2008, 23:49   #7 (permalink)
Moderator
 
marSoul's Avatar
 
Join Date: Sep 2007
Location: Tehran - Iran
Age: 28
Posts: 367
Blog Entries: 2
Send a message via MSN to marSoul Send a message via Yahoo to marSoul
Re: xml & external link

I have made some changes to your file, test it ...

first i rename your button to gotourl
then i added some functions to your file

Code: Select all
gotourl.onRelease = function() {
    get_url();
}
and

Code: Select all
function get_url() {
    current_url = p;
    getURL(url[current_url]);
}
that security warning is because your are testing your file locally and warns you that this file wants to access internet
its better you upload your file to server and test it
Attached Files
File Type: fla header.fla (114.0 KB, 1 views)
__________________
Designing for Communicating

Datis Design Website
Datis Design Weblog
marSoul is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 6th, 2008, 07:59   #8 (permalink)
Reputable Member
 
Join Date: Aug 2007
Location: netherlands
Posts: 104
Send a message via MSN to ahwell Send a message via Yahoo to ahwell
Re: xml & external link

thanks for your help. I uploaded it and i think its working if it wasnt for this security sandbox violation. When I try locally I get the sandbox violation security. Connection to 'http://www.google.com' halted it says. I uploaded the jpgs,xml,html,swf all in the same folder. Im gonna google a way to get around this sandbox violation security.

Last edited by ahwell; May 6th, 2008 at 08:10.
ahwell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old May 6th, 2008, 08:20   #9 (permalink)
Reputable Member
 
Join Date: Aug 2007
Location: netherlands
Posts: 104
Send a message via MSN to ahwell Send a message via Yahoo to ahwell
Re: xml & external link

Hey! It's working! For some reason I put ' around the urls in the xml file!! I had a bright moment and took them away and voila!
Thanks again ! Now I can concentrate on my exam on dreamweaver next thursday haha
Marieke
ahwell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
External HD Ryan Fait Webforumz Cafe 16 Jan 11th, 2008 13:28
loading external swf crazytyler34 Flash & Multimedia Forum 3 Nov 15th, 2007 21:38
external js alexgeek JavaScript Forum 6 Sep 23rd, 2007 20:57
send mail php with external hidden link?? lsatdown PHP Forum 0 Nov 28th, 2006 10:48
loading external swf razor Flash & Multimedia Forum 1 Nov 30th, 2005 15:40



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 19:17.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59