Flash & XML HELP!
- Started
- Last post
- 9 Responses
- miracola
I know that I can load images and text at the same time from an external XML file. What I need to do is load an image with it's corresponding text at timed intervals with the click of an "autoplay" button. the images also fade in and out. Is this possible? I'm not very experienced with actionscript, XML, blah, blah, blah. It's for a personal portfolio slideshow.
I'm losing my mind, help me! Please!
- o0o0
check out setTimeout( ) and setInterval( )
- o0o0
if you know how to load the image and text, that's most of the battle, you just need to keep a counter, and load one after the other, right?
- miracola0
I know about setInterval(), but I just don't know how to write the code for it. I mean, I'm not too familiar with actionscript. I am trying to piece together stuff I've found here and there, but noone seems to have combined all the things I'm looking for.
HERE IS THE CODE I HAVE SO FAR:
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
slides_xml.ignoreWhite = true;
slidesMC._alpha=0;
mypic=1;_root.onEnterFrame = function()
{
if (slidesMC._alpha 10 && fadeOut)
{
slidesMC._alpha -= 10;
}if (slidesMC._alpha < 100 && fadeIn && !fadeOut)
{
slidesMC._alpha += 10;
}
else
{
fadeIn=false;
}
}next.onPress = function() {
if (mypic = 12)
{
mypic=1;
}
}prev.onPress = function() {
if (mypic > 1 && !fadeIn && !fadeOut)
{
fadeOut = true;
mypic--;
}
if (mypic == 1 && !fadeIn && !fadeOut)
{
fadeOut=true;
mypic=12;
}
}autoplay.onPress=function() {
setInterval(intervalID);
showTimer = delay*3000;
intervalID = setInterval(autoAdvance, showTimer); }function autoAdvance() {
if (mypic 12)
mypic=1;
}Do you also need to see what the XML text looks like? It has image info and text info.
- miracola0
In response to your question, I guess. I have no idea. I'm so damn confused. Been racking my brain with this all day.
- bhawk0
Why bother...why not just use the loadMovie action script...very simple to use and good tutorial on it in flash.
- o0o0
hm, I'm sorry I'm not good at following code like that...
but it looks like you have the 'next' and 'previous' actions working, right?
If so I would suggesting taking that code out of the button on(release) and putting it in a function... call it click_next() and click_prev() (then your on(release) calls one of those functions)
That way, when the user clicks autoplay, you just need a function that repeats every x miliseconds, and calls click_next()
- miracola0
Yes all the buttons currently work, even the autoplay button. But I need it to load the text in the XML into two different dynamic text fields. It currently only loads the images.
- freekilly0
If you do not include the loading time of the images, you could make an interval autoplay thing also by using the timeline of a separate movieclip, which starts running from frame1 of it's timeline when the loading of the pic&text is doen. In the frame of your choice you can let it gotoAndStop() to the first frame and let it load the next picture. Use a variable that increments which stands for the picture to be loaded.
it's just one way.
pick your favourite
good luck
- o0o0
why does it need to load the text into different dynamic text fields?
I was assuming the text was like a caption or something...