Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

need to know if possible to add links to sound files in an xml file that loads images to flash?

How do we edit n xml file so a sound will play with a photos?  I understand it is bad and not a good idea to auto play sound  but we have a client that demands this :(
				<thumb src="/img/images/2.jpg" />
				<img src="/img/images/2big.jpg" />
				<caption text="Caption 2"/>
				<desc> <![CDATA[<h1>Description Description</h1> <br>Lorem ipsum dolor sit amet, 
consectetuer adipiscing elit. Praesent euismod nunc id ligula. Vivamus ac justo. Morbi imperdiet. Lorem ipsum dolor 
sit amet, consectetuer adipiscing elit. Pellentesque est eros, viverra quis, pellentesque nec, elementum id, mi. 
Nulla malesuada. Proin blandit tincidunt neque. <br><br><a href="event:BACK">Back</a> <a 
href="event:http://www.google.com"> More</a> ]]> </desc>

Open in new window

  • 2
  • 2
1 Solution
is your sound from a local folder, off a server, imported into flash?
are you using AS2 or AS3?

the logic will be along these lines
simply add another tag - putting it at the end won't mess up existing code

<img soundbg url="blah/blah.mp3"/>
currently the code you call to load the image, add code to get the sound to play
based on answer to first 2 questions. use Sound.attachSound/NetStream.attachSound() etc to play.
webguy62Author Commented:
I m using AS3.  where do I add this code?
you're going to add the node to the xml file.
where you're currently loading the images, you'll have some code pulling the image info from the xml.
add code there to pull the sound file info store it in a variable

where you load the image, create the sound object and tell it which sound to play / attach / load from the variable you've just saved.
webguy62Author Commented:
only partially becuae I am a beginner but I learned from the example given

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now