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

Posted on 2008-11-03
Last Modified: 2013-11-11
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:"> More</a> ]]> </desc>


Open in new window

Question by:webguy62
    LVL 39

    Expert Comment

    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.

    Author Comment

    I m using AS3.  where do I add this code?
    LVL 39

    Accepted Solution

    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.

    Author Closing Comment

    only partially becuae I am a beginner but I learned from the example given

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
    In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now