XML Slideshow
Hi,
Can any one please tell me dat how to achieve next, back and
autoplay for my XML image viewer that i have created.
I have a loader component in which i am calling the images
from an XML file through XML Connector component. And i have three
buttons next, back and autoplay through which i want to view the
next images located in the xml file.
Content in the xml file is below:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image>images/soldier.jpg</image>
<caption>I am a soldier..</caption>
</pic>
<pic>
<image>images/women.jpg</image>
<caption>Play it on..</caption>
</pic>
<pic>
<image>images/abstract.jpg</image>
<caption>Visualize me..</caption>
</pic>
<pic>
<image>images/tiger.jpg</image>
<caption>I am the king..</caption>
</pic>
<pic>
<image>images/elephant.jpg</image>
<caption>I am intelligent..</caption>
</pic>
<pic>
<image>images/butterfly.jpg</image>
<caption>I am cool..</caption>
</pic>
</images>
Actions in the first frame of the timeline:
myConnect.trigger();
var sXml:String;
myXML = new XML();
myXML.ignoreWhite = true;
myXML.load('images.xml');
myXML.onLoad = function(success) {
if (success) {
sXml =
myXML.firstChild.firstChild.nextSibling.firstChild.firstChild;
//trace(sXml);
//trace(myXML.firstChild.firstChild.nextSibling.firstChild);
next_btn.onRelease = function() {
//trace(sXml);
myLoader.contentPath = sXml;
Please help me it is very urgent.
For the autoplay you could use setInterval() with a preset
interval or you can add an extra component in which the user can
select an interval.
Similar Messages
-
Flash xml slideshow in iWeb not working
Hallo
I am really struggling to get a Flash xml slideshow to work. I have used Flash Slideshow Maker app, which creates a slide.xml, .swf and .html file and everything is published in one folder "slideshow" on a local disk.
I am using the following code and it works perfectly when viewed in iWeb:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0, 40,0"
WIDTH="920" HEIGHT="400" id="Phambili">
<PARAM NAME=movie VALUE="/Users/elsjevanzyl/Documents/Websites/Published Websites/Phambili/Slideshow/Phambili.swf?xml_path=slides.xml">
<PARAM NAME=quality VALUE=high>
<PARAM NAME="wmode" value="transparent">
<PARAM NAME=base VALUE=".">
<EMBED src="/Users/elsjevanzyl/Documents/Websites/Published Websites/Phambili/Slideshow/Phambili.swf?xml_path=slides.xml" quality=high wmode="transparent" WIDTH="920" HEIGHT="400"
NAME="Phambili" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" base=".">
</EMBED>
</OBJECT>
But as soon as I publish it to FTP with following code, it displays the slideshow but NOT the photos or thumbs:
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0, 40,0"
WIDTH="920" HEIGHT="400" id="Phambili">
<PARAM NAME=movie VALUE="http://harmonieproteas.co.za/Slideshow/Phambili.swf?xml_path=slides.xml">
<PARAM NAME=quality VALUE=high>
<PARAM NAME="wmode" value="transparent">
<PARAM NAME=base VALUE=".">
<EMBED src="http://harmonieproteas.co.za/Slideshow/Phambili.swf?xml_path=slides.xml" quality=high wmode="transparent" WIDTH="920" HEIGHT="400"
NAME="Phambili" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" base=".">
</EMBED>
</OBJECT>
I have also tried iFrame code, but this is not working at all.
Can anybody tell me what I am doing wrong when publishing the above code to FTP?
Any help will be appreciated.Flash isn't my thing but, it appears that you are missing the images:
<flash_parameters copyright="socusoftFSMTheme">
<preferences>
<global>
<basic_property movieWidth="920" movieHeight="400" decoration="" html_title="Title" loadStyle="Pie" startAutoPlay="true" continuum="true" backgroundColor="0x00000000" hideAdobeMenu="true" photoDynamicShow="true" enableURL="true"transitionArray="" socusoftMenu="false"/>
<title_property showTitle="true" photoTitleColor="0x00000000" backgroundColor="0x00c0c0c0" alpha="30" autoHide="true"/>
<music_property path="" stream="true" loop="true"/>
<photo_property topPadding="2" bottomPadding="64" leftPadding="2" rightPadding="2"/>
<properties enable="true" backgroundColor="0x00c0c0c0" backgroundAlpha="30" cssText="a:link{text-decoration: underline;} a:hover{color:#ff0000; text-decoration: none;} a:active{color:#0000ff;text-decoration: none;} .blue {color:#0000ff; font-size:15px; font-style:italic; text-decoration: underline;} .body{color:#ff5500;font-size:20px;}" align="top"/>
</global>
<thumbnail>
<basic_property width="40" height="40" thumBackColor="0x002c2c2c" borderColor="0x002c2c2c" thumborder="2" thumSpacing="4" shapeAlpha="60" buttonColor="0x00000000" currentbuttonColor="0x00ffffff"/>
</thumbnail>
</preferences>
<album>
<slide jpegURL="thumbs/mozzie tour 2.jpg" d_URL="slides/mozzie tour 2.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Mozzie Tour 2" width="916" height="334"/>
<slide jpegURL="thumbs/mozzie10.jpg" d_URL="slides/mozzie10.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Mozzie10" width="916" height="334"/>
<slide jpegURL="thumbs/snow on hogsback.jpg" d_URL="slides/snow on hogsback.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Snow on Hogsback" width="916" height="334"/>
<slide jpegURL="thumbs/tea time@santa maria.jpg" d_URL="slides/tea time@santa maria.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Tea Time@Santa Maria" width="916" height="334"/>
<slide jpegURL="thumbs/western cape tour knersvlakte.jpg" d_URL="slides/western cape tour knersvlakte.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Western Cape Tour Knersvlakte" width="916" height="334"/>
<slide jpegURL="thumbs/western cape tour[2].jpg" d_URL="slides/western cape tour[2].jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Western Cape Tour[2]" width="916" height="334"/>
<slide jpegURL="thumbs/bush camp in botswana[2].jpg" d_URL="slides/bush camp in botswana[2].jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Bush Camp in Botswana[2]" width="916" height="334"/>
<slide jpegURL="thumbs/eastern cape tour 2.jpg" d_URL="slides/eastern cape tour 2.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Eastern Cape tour 2" width="916" height="334"/>
<slide jpegURL="thumbs/hogsback 2.jpg" d_URL="slides/hogsback 2.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Hogsback 2" width="916" height="334"/>
<slide jpegURL="thumbs/mozzie tour.jpg" d_URL="slides/mozzie tour.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Mozzie Tour" width="916" height="334"/>
<slide jpegURL="thumbs/western cape tour.jpg" d_URL="slides/western cape tour.jpg" transition="0" panzoom="1" URLTarget="0" phototime="2" url="" title="Western Cape Tour" width="916" height="334"/>
</album>
</flash_parameters>
http://harmonieproteas.co.za/Slideshow/ -
Flash XML Slideshow - Load next image after set amount of time
I'm creating flash xml slideshow and have managed to get the
images to load from the XML file. What I want to do now is have a
timer that loads the next image after x amount of seconds. Any help
would be great.
Code sample
stop();
// Create XML Object
slideshow_xml = new XML();
// Start slideshow once XML file is loaded
slideshow_xml.onLoad = startSlideShow;
//Load XML file
slideshow_xml.load("slideshow.xml");
//Ignore Whitespace in XML Document
slideshow_xml.ignoreWhite = true;
//Create Function for Slideshow - Shows first slide and
initalises variables
function startSlideShow(success) {
if (success == true) {
rootNode = slideshow_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpgURL;
slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, loadTarget);
}Ok I've managed to get most of this working including the
alpha fade in. I haven't been able to get the images to fade out
(fadeImageOut function) so if someone can tell me what I'm doing
wrong. Also should I have some sort of preloader function for when
each image loads? and if so any pointers, then it should be done
except that I might need to add some text for each image in the XML
file.
stop();
var container:MovieClip =
this.createEmptyMovieClip("container", this.getNextHighestDepth());
var loader1:MovieClip = this.createEmptyMovieClip("loader1",
this.getNextHighestDepth());
var loader2:MovieClip = this.createEmptyMovieClip("loader2",
this.getNextHighestDepth());
container._x = 0;
container._y = 0;
function fadeImageIn() {
var fadeTween = new mx.transitions.Tween(loader1, "_alpha",
mx.transitions.easing.Regular.easeIn, 0, 100, 1.5, true);
loadmovie(imagePath, loader1);
function fadeImageOut(loader1) {
var fadeTween = new mx.transitions.Tween(loader1, "_alpha",
mx.transitions.easing.Regular.easeOut, 100, 0, 1.5, true);
unloadMovie(loader1);
// Create XML Object
slideshow_xml = new XML();
// Find out what this does
slideshow_xml.onLoad = startSlideShow;
//Load XML file
slideshow_xml.load("slideshow.xml");
//Ignore Whitespace in XML Document
slideshow_xml.ignoreWhite = true;
//Create Function for Slideshow - Shows first slide and
initalises variables
function startSlideShow(success) {
if (success == true) {
rootNode = slideshow_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpgURL;
slideText = newSlideNode.firstChild.nodeValue;
//loadMovie(imagePath, loader1);
fadeImageIn();
function nextSlideImage() {
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null) {
rootNode = slideshow_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
slideTimer = setInterval(nextSlideImage, 5000); -
XML Slideshow a bit rough around the edges
Hey there,
I'm supposed to be wrapping up another xml slideshow and
could use some help ironing out some of the problems.
1. The transitions between sections is a bit harsh, I'd like
to smooth it out some by fading from 1 color to the next or
something.
2. The captions don't sync up with the pictures the first
time around until the pics are cached.
3. When you click on the button of the section you are in,
the slideshow stops.
Just click on main.swf and you'll see what I'm working with.
Thanks a lot. Here's a link to all the files.
http://www.dynodealz.com/slideshow.zipFew suggestions to sharpen it up, add a fade out to the last
graphic shown, especially when changing catagories, and there wait
for the first graphic to load before fading the last.
With the colour tabs you could quickly have flash do the
colour change for you by putting all the colours in one movieclip
and having shape tweens between them which you can simply call when
changing catagory i.e label frame redToGreen and have it simply
shape tween red to green.
You could also fade in the text as well if you used embeded
fonts. Change the description copy font as well. Podium Sans
perhaps.
Other than that looks good, a little tweak of the style and i
think you've got it, nice clean simple -
Positioning XML slideshow images on Stage
Hello!
I have a xml slideshow that is working fine. The problem I am having is all of the images load in at x=0 and y=0. I would like to have the images load at a specific x coodinate and y coordinate on the stage. I have been looking at other code examples to see how to fit this in to mine but I keep breaking it. IF it's not too much trouble could someone help me out with the code or point me to an example that would help place it in the correct place?
Thanks! Sandra
Here is my code:
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
var transition_time:Number = 3;
var displaying_time:Number = 5;
var timer_tween:Tween;
var alpha_tween:Tween;
var index:int = 0;
var is_picture_loaded:Boolean;
var is_next_transition_ready:Boolean = true;
var picture_holder:Sprite = new Sprite();
addChild(picture_holder);
var xml_data:XML;
var array_of_picture:Array = new Array();
var request_xml:URLRequest = new URLRequest("setup_sss.xml");
var loader:URLLoader = new URLLoader();
var request_picture:URLRequest;
var picture_loader:Loader;
loader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(e:Event):void{
xml_data = new XML(loader.data);
for(var i:int = 0; i<xml_data.children().length(); i++){
array_of_picture.push(xml_data.child(i));
request_xml = null;
loader = null;
start_slide_show();
loader.load(request_xml);
function start_slide_show():void{
if(index == array_of_picture.length){index = 0;}
request_picture = new URLRequest(array_of_picture[index]);
picture_loader = new Loader();
picture_loader.contentLoaderInfo.addEventListener(Event.INIT, loader_Handler);
picture_loader.load(request_picture);
index++;
function loader_Handler(e:Event):void{
e.target.content.visible = false;
picture_holder.addChild(e.target.content);
is_picture_loaded = true;
if(is_next_transition_ready){
var last_child:int = picture_holder.numChildren-1;
start_transition(picture_holder.getChildAt(last_child));
function start_transition(target:DisplayObject):void{
is_next_transition_ready = false;
is_picture_loaded = false;
target.visible = true;
target.alpha = 0;
start_slide_show();
alpha_tween = new Tween(target, "alpha", null, 0, 1, transition_time, true)
alpha_tween.addEventListener(TweenEvent.MOTION_FINISH, start_timer);
function start_timer(e:TweenEvent):void{
var count:Number = 0;
timer_tween = new Tween(this, "count", null, 0, 1, displaying_time, true)
timer_tween.addEventListener(TweenEvent.MOTION_FINISH, remove_picture);
function remove_picture(e:TweenEvent):void{
if(picture_holder.numChildren>2){picture_holder.removeChildAt(0)}
timer_tween.removeEventListener(TweenEvent.MOTION_FINISH, remove_picture);
is_next_transition_ready = true;
if(is_picture_loaded){
var last_child:int = picture_holder.numChildren-1;
start_transition(picture_holder.getChildAt(last_child))I new I had to move it but I couldn't find out a sample of how to write it, but I figured it out!! So that is now working... BUt now I have another problem which doesn't make any sense at all. When I test my movie locally everything works fine all of my movies pull in correctly in the correct place But when I upload them on the server some of the movies don't show up... specifically some of the ones I worked on this afternoon. My html pages I update load but anything swf doesn't seem to.
I have taken the whole folder and moved it somewhere else and again checked it locally and worked but uploaded not there!! I check on the server files appear to be there. I am posting this xml file... can you tell if the syntax appears correct? I am really at a loss and checked all of the obvious things. Some of the swfs that are not updating are really simple swfs with no scripts so I dont know why???
Your good at pointing out the obvious and maybe I am too braindead to see. I am so close I just want to upload and be done!!
Thanks! Sandra
xml code:
<?xml version="1.0" encoding="utf-8"?>
<SLIDE_SHOW>
<PICTURE>intro/1.JPG</PICTURE>
<PICTURE>intro/2.JPG</PICTURE>
<PICTURE>intro/3.JPG</PICTURE>
<PICTURE>intro/4.JPG</PICTURE>
<PICTURE>intro/5.JPG</PICTURE>
</SLIDE_SHOW> -
Xml slideshow playback controls issue
Hi, I'm trying to create a picture slideshow which can be controled by the user with play / stop / next buttons. I've managed to program the play / stop events with success, but I'm stuck trying to create the next button event since it doesn´t work properly. The first time I hit the next button it takes me to the same picture that has been currently loaded, the second time I hit the next button it works as expected, takes me to the next image.
I appreciate your help, thank you in advance.
Here's the Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
stop();
//Escondo botones navegación
navigation.visible = false;
//Declaro/inicio variables
var loadernike:loadercreditos = new loadercreditos();
var my_speed:Number;
var my_total:Number;
var my_images:XMLList;
var my_loaders_array:Array = [];
var my_labels_array:Array = [];
var my_success_counter:Number = 0;
var my_playback_counter:Number = 0;
var my_contador_next:Number = 0;
var my_slideshow:Sprite = new Sprite();
var my_image_slides:Sprite = new Sprite();
var my_label_slides:Sprite = new Sprite();
var my_preloader:TextField;
var my_timer:Timer;
var my_prev_tween:Tween;
var my_tweens_array:Array = [];
var my_xml_loader:URLLoader = new URLLoader();
//Precarga xml
my_xml_loader.load(new URLRequest("images/interior/NIKE/slideshow.xml"));
my_xml_loader.addEventListener(Event.COMPLETE, processXML);
var htmlContent:TextField;
function processXML(e:Event):void
var my_xml:XML = new XML(e.target.data);
my_xml.ignoreWhitespace = true;
//htmlContent = my_xml.title.text();
my_speed = my_xml. @ SPEED;
my_images = my_xml.IMAGE;
my_total = my_images.length();
loadImages();
trace("imag", my_images);
my_xml_loader.removeEventListener(Event.COMPLETE, processXML);
my_xml_loader = null;
function loadImages():void
for (var i:Number = 0; i < my_total; i++)
var my_url:String = my_images[i]. @ URL;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest(my_url));
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
my_loaders_array.push(my_loader);
//formateo texto;
var myFont = new Font1();
var myFormat:TextFormat = new TextFormat();
myFormat.align = TextFormatAlign.RIGHT;
myFormat.font = myFont.fontName;
var my_label:TextField = new TextField();
my_label.textColor = 0xffffff;
my_label.embedFonts = true;
my_label.antiAliasType = AntiAliasType.ADVANCED;
my_label.defaultTextFormat = myFormat;
my_label.text = my_images[i]. @ TITLE;
//my_label.autoSize = TextFieldAutoSize.LEFT;
my_label.width = 450;
my_label.background = true;
my_label.border = true;
my_label.backgroundColor = 0x000000;
//my_label.htmlText = htmlContent;// Assign the HTML content to the text field*/
my_labels_array.push(my_label);
//preloader;
addChild(loadernike);
loadernike.x = (stage.stageWidth - loadernike.width)/2;
loadernike.y = (stage.stageHeight - loadernike.height)/2 + 50;
function onComplete(e:Event):void
my_success_counter++;
if (my_success_counter == my_total)
startShow();
var my_loaderInfo:LoaderInfo = LoaderInfo(e.target);
my_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
function startShow():void
removeChild(loadernike);
loadernike = null;
//muestro botones navegacion
navigation.navintback.visible = false;
navigation.visible = true;
addChild(my_slideshow);
my_slideshow.addChild(my_image_slides);
my_slideshow.addChild(my_label_slides);
my_slideshow.x = 30;
my_slideshow.y = 160;
nextImage();
my_timer = new Timer(my_speed * 1000);
my_timer.addEventListener(TimerEvent.TIMER, timerListener);
my_timer.start();
//boton stop;
function clickstopboton(event:MouseEvent):void
navigation.navintnext.gotoAndStop(1);
if (MisGlobales.vars.i == 0 && MisGlobales.vars.h != 1)
navigation.navint.gotoAndPlay(2);
my_timer.stop();
else if (MisGlobales.vars.i==1 && MisGlobales.vars.h != 1)
//play
navigation.navint.gotoAndPlay(1);
my_timer.start();
if (MisGlobales.vars.h == 1 && MisGlobales.vars.i == 0)
navigation.navint.gotoAndStop(2);
my_timer.stop();
else if ( MisGlobales.vars.h == 1 && MisGlobales.vars.i == 1 )
navigation.navint.gotoAndStop(1);
navigation.navint.addEventListener(MouseEvent.CLICK, clickstopboton);
navigation.navint.buttonMode = true;
//boton next;
function clicknextboton(event:MouseEvent):void
my_timer.stop();
navigation.navint.gotoAndStop(2);
nextImage();
my_playback_counter++;
trace("playback_counter_next",my_playback_counter);
if (my_playback_counter == my_total)
my_playback_counter = 0;
navigation.navintnext.addEventListener(MouseEvent.CLICK, clicknextboton);
navigation.navintnext.buttonMode = true;
//boton back;
function clickbackboton(event:MouseEvent):void
my_timer.stop();
nextImage();
my_playback_counter--;
if (my_playback_counter == 0)
my_playback_counter = my_total;
my_timer.stop();
navigation.navintback.addEventListener(MouseEvent.CLICK, clickbackboton);
navigation.navintback.buttonMode = true;
//slide auto
function nextImage():void
var my_image:Loader = Loader(my_loaders_array[my_playback_counter]);
my_image_slides.addChild(my_image);
my_tweens_array[0] = new Tween(my_image,"alpha",Strong.easeOut,0,1,1,true);
var my_label:TextField = TextField(my_labels_array[my_playback_counter]);
my_label_slides.addChild(my_label);
my_label.x=(stage.stageWidth - 63) - my_label.width;
my_label.y=(my_image.y+my_image.height)+7;
my_tweens_array[1] = new Tween(my_label,"alpha",Strong.easeOut,0,1,1,true);
function timerListener(e:TimerEvent):void
hidePrev();
my_playback_counter++;
if (my_playback_counter == my_total)
my_playback_counter = 0;
nextImage();
trace("playback_counter_play",my_playback_counter);
function hidePrev():void
var my_image:Loader = Loader(my_image_slides.getChildAt(0));
my_prev_tween = new Tween(my_image,"alpha",Strong.easeOut,1,0,1,true);
my_prev_tween.addEventListener(TweenEvent.MOTION_FINISH, onFadeOut);
var my_label:TextField = TextField(my_label_slides.getChildAt(0));
my_tweens_array[2] = new Tween(my_label,"alpha",Strong.easeOut,1,0,1,true);
function onFadeOut(e:TweenEvent):void
my_image_slides.removeChildAt(0);
my_label_slides.removeChildAt(0);
function clickbotonskb(event:MouseEvent):void
my_timer.removeEventListener(TimerEvent.TIMER, timerListener);
gotoAndPlay(10);
MovieClip(root).main.main_bar.seccinteriors.my_playback_counter_sk = 0;
skunkfunk_btn.addEventListener(MouseEvent.CLICK, clickbotonskb);
skunkfunk_btn.buttonMode = true;
See example at:
http://www.neoconfort.com/neoconfort/Neoconfort.htmlI did a workaround by using the slideshow component shown in
http://flashotaku.com/blog/slideshow-component-as3-documentation/
Thank you to FlashOtaku -
Xml slideshow controls, need help!
Hello,
I am new to actionscript and am trying to make a slideshow
with next and previous controls. The info for the slideshow is
coming via xml. I have it up and running but there are two issues.
When clicking on the next or previous buttons the new image will
load but the first image will be present under the new image. So if
you are navigating from image 2 to 3, while image 3 loads, image 1
is visible. The next problem I am having is I would like for the
slideshow to repeat itself once it gets to the end.Sorry 2 more things.
In the above link to get to the slideshow, click america,
then new england.
And it appears that on the initial load the first image loads
17 times, which is the total number of images in the slideshow.
Thanks again -
XML slideshow with preloader bar
I'm using the following code to create a simple slideshow:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var my_speed:Number;
var my_count:Number;
var my_images:XMLList;
var my_loaders_array:Array=[];
var my_success_counter:Number=0;
var my_playback_counter:Number=0;
var my_slideshow:Sprite = new Sprite();
var my_image_slides:Sprite = new Sprite();
var my_preloader:TextField;
var my_timer:Timer;
var my_prev_tween:Tween;
var my_tweens_array:Array=[];
var my_xml_loader:URLLoader = new URLLoader();
my_xml_loader.load(new URLRequest("theme1.xml"));
my_xml_loader.addEventListener(Event.COMPLETE, preXML);
next_mc.addEventListener(MouseEvent.CLICK, timerListener);
prev_mc.addEventListener(MouseEvent.CLICK, goBack);
function preXML(e:Event):void {
var my_xml:XML=new XML(e.target.data);
my_speed=my_xml.@SPEED;
my_images=my_xml.IMAGE;
my_count=my_images.length();
loadImages();
my_xml_loader.removeEventListener(Event.COMPLETE, preXML);
my_xml_loader=null;
function loadImages():void {
for (var i:Number = 0; i < my_count; i++) {
var my_url:String=my_images[i].@URL;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest(my_url));
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
my_loaders_array.push(my_loader);
my_preloader = new TextField();
my_preloader.text="Loading";
my_preloader.autoSize=TextFieldAutoSize.CENTER;
my_preloader.x = (stage.stageWidth - my_preloader.width)/2;
my_preloader.y = (stage.stageHeight - my_preloader.height)/2;
addChild(my_preloader);
function onComplete(e:Event):void {
my_success_counter++;
if (my_success_counter==my_count) {
startShow();
var my_loaderInfo:LoaderInfo=LoaderInfo(e.target);
my_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
function startShow():void {
removeChild(my_preloader);
my_preloader=null;
addChild(my_slideshow);
my_slideshow.addChild(my_image_slides);
nextImage();
my_timer=new Timer(my_speed*2000);
my_timer.addEventListener(TimerEvent.TIMER, timerListener);
my_timer.start();
function nextImage():void {
var my_image:Loader=Loader(my_loaders_array[my_playback_counter]);
my_image_slides.addChild(my_image);
my_image.x = (stage.stageWidth - my_image.width)/2;
my_image.y = (stage.stageHeight - my_image.height)/2;
my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,1,true);
function timerListener(e:Event):void {
hidePrev();
my_playback_counter++;
if (my_playback_counter==my_count) {
my_playback_counter=0;
if(e.currentTarget is MovieClip)
my_timer.reset();
my_timer.start();
nextImage();
function goBack(e:MouseEvent):void
hidePrev();
my_playback_counter--;
if (my_playback_counter<0) {
my_playback_counter=my_count-1;
nextImage();
my_timer.reset();
my_timer.start();
function hidePrev():void {
var my_image:Loader=Loader(my_image_slides.getChildAt(0));
my_prev_tween=new Tween(my_image,"alpha",Strong.easeOut,1,0,1,true);
my_prev_tween.addEventListener(TweenEvent.MOTION_FINISH, onFadeOut);
function onFadeOut(e:TweenEvent):void {
my_image_slides.removeChildAt(0);
I would like change "loading" to a preloader bar. How can i insert a preloader bar in this code? I add this lines:
var total:Number=this.stage.loaderInfo.bytesTotal;
var loaded:Number=this.stage.loaderInfo.bytesLoaded;
var percent:Number=loaded/total;[/b]
my_preloader = new TextField();
my_preloader.text=(Math.round(percent * 100)) + "%";
my_preloader.autoSize=TextFieldAutoSize.CENTER;
my_preloader.x = (stage.stageWidth - my_preloader.width)/2;
my_preloader.y = (stage.stageHeight - my_preloader.height)/2;
addChild(my_preloader);
But only show a static "100%".
Thanks guys!you'll need to change your basic setup from loading all those images in a for-loop to loading them sequentially. so, to start:
var loadIndex:int;
function preXML(e:Event):void {
var my_xml:XML=new XML(e.target.data);
my_speed=my_xml.@SPEED;
my_images=my_xml.IMAGE;
my_count=my_images.length();
loadIndex=0;
loadImages();
my_xml_loader.removeEventListener(Event.COMPLETE, preXML);
my_xml_loader=null;
function loadImages():void {
var i:int=loadIndex;
var my_url:String=my_images[i].@URL;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest(my_url));
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
my_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
my_loaders_array.push(my_loader);
y_preloader = new TextField();
my_preloader.x = (stage.stageWidth - my_preloader.width)/2;
my_preloader.y = (stage.stageHeight - my_preloader.height)/2;
addChild(my_preloader);
function onProgress(e:ProgressEvent):void{
var total:Number=e.bytesTotal;
var loaded:Number=e.bytesLoaded;
var percent:Number=loaded/total;[/b]
my_preloader.text=100*loadIndex/my_count+(Math.round(percent * 100))/my_count + "%";
my_preloader.autoSize=TextFieldAutoSize.CENTER;
function onComplete(e:Event):void {
loadIndex++;
if (loadIndex==my_count) {
startShow();
var my_loaderInfo:LoaderInfo=LoaderInfo(e.target);
my_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
loadImage(); -
Non-XML slideshow with AS3?
Hello,
I am looking for a way to run a slideshow without using XML, but controlling the entire show with AS3. I have all of the resources and code to run a dynamic show, but I am attempting to build this on Oracle's Content Management System – Stellent. Stellent does not allow us to access our external XML files or external assets such as images, js, swf, etc.
The best way to go about building our slideshows for use with this CMS is to make them fully integrated in themselves. The downside, obviously is a larger filesize, but does anybody know how I would go about building this into itself, instead of externally?
I would like to keep all functionality of the XML (specifically the links and timer)
I would also like to keep the automatic button generation.
If anybody can help me out with this it would be greatly appreciated. I have attached a file enclosing all of my working dynamic elements.
Thank you!!
Nick
I am unable to load a zip file, but within the parent directory there should be an assets folder with an images folder inside.there must be some way to use external data to feed applications or that wouldn't be much of a cms.
but if you want to keep all the data in swf, just hardcode all the data in your swf. actually, with as3, you can copy and paste the contents of an xml file into flash and assign it to an xml instance. -
Convert AS2 to AS3 (XML / Slideshow)
Hi everyone,
I've created a slideshow in AS2 (with some help from a
tutorial) but it is in AS2 unfortunately. I need it to be in AS3
and I've tried to read some online tutorials and other online
materials on AS3 and the difference, but I just seem to run my head
against the wall every time.
I don't know if it's a comprehensive task to ask but I take
my chances and try anyway. Please let me know if this is way too
much to convert / translate
I've attached my AS2 code
I short it has to load images from a XML file where a tag
with caption (image title) and a tag with the delay settings.
So far I’ve discovered that the XML loading in the very
beginning is completely different in AS3 so I founded a tutorial on
how to load XML data into flash. That is working alright but my
next problem is to reset all the other variables (like caption,
delay etc.) and I’ve read that XML in AS3 has a much faster
and smarter way to load the tags. Now I just have to found out how
that’s done :-)
Thanks in advance
eDevantieAre you using external .as files and classes or are you using frame scripts directly in the timeline? Are you used to any other object oriented programming languages? Knowing more about other languages you might know would help a lot.
AS2 very informal and specialized to Flash. It relates to pretty much no other language out there, like JavaScript seldom relates. They're c-esque but only in a very distant 3rd cousin style.
AS3 is much more OOP oriented and typed versus the less formal, error-prone loose dynamic nature of AS2. While your game would benefit greatly from the speed increases and error reduction, I think you're really swinging for the fence on this one. While some classes may resemble their AS2 counterpart and the core global functions work the same, everything else is different. Starting off trying to convert 4,000 lines of code is a little steep.
As mentioned, the resources to learn AS3 are excessive and plentiful from video training to tutorials to the API reference itself. Google has it all.
I think you really should lower your target and just try some really simple, basic things. Draw a shape, add a listener, do something basic when clicked, etc. You'll get a good idea of how different things are with the new display list rather than tearing your hair out converting your as2 game. -
Xml slideshow with random PICTS and mx.transitions
Hi All,
I am building a web banner with a slideshow with random picts via xml,
but i want to use a iris transition to fade in while getting the pict, and fade out with the iris transition, the last action works but when getting i cannot get the transition to work below is a piece of the code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
pauseTime = 2000;
xmlImages = new XML();
xmlImages.ignoreWhite = true;
xmlImages.onLoad = loadImages;
xmlImages.load("images.xml");
function loadImages(loaded) {
if (loaded) {
xmlFirstChild = this.firstChild;
imageFileName = [];
totalImages = xmlFirstChild.childNodes[0].childNodes.length;
for (i=0; i<totalImages; i++) {
imageFileName[i] = xmlFirstChild.childNodes[0].childNodes[i].attributes.title;
randomImage();
function randomImage() {
if (loaded == filesize) {
var ran = Math.round(Math.random() * (totalImages - 1));
picture_mc._alpha = 0; // Start image clip as invisible
picture_mc.loadMovie(imageFileName[ran], 1); //Load random image from xml
var pictureTweenIn:Tween = new Tween(picture_mc, "_alpha", Normal.easeIn, 0, 100, 4, true); //WORKS!
mx.transitions.TransitionManager.start(picture_mc, {type:mx.transitions.Iris, direction:mx.transitions.Transition.OUT, duration:3, easing:mx.transitions.easing.Regular.easeInOut}); // DOES NOT WORK?
pictureTweenIn.onMotionFinished = function () { // When done fading
_root.pause(); // Start pause() function
function pause() {
myInterval = setInterval(pause_slideshow, pauseTime);
function pause_slideshow() {
clearInterval(myInterval);
var pictureTweenOut:Tween = new Tween (picture_mc,"_alpha",Normal.easeOut,100,0,5,true);//WORKS!
mx.transitions.TransitionManager.start(picture_mc, {type:mx.transitions.Iris, direction:mx.transitions.Transition.OUT, duration:3, easing:mx.transitions.easing.Regular.easeInOut}); //WORKS!
pictureTweenOut.onMotionFinished = function() {
_root.randomImage(); // Call next randomImage()
If anyone can help me out this would be great!
Mikki65Good question. Not sure about iDVD. But I know for a fact I can use random transitions within DVDSP. However, if I'm not mistaken in iDVD I may be limited to the same transition within any given slideshow. I know it's possible to bring in an album into iDvd. And I know it's possible to use KB effects. But let me do some more searching for you because I forgot the exact procedure/s. I'll post back here later.
In the meantime you may also wish to review these slideshow apps as well:
http://www.lqgraphics.com/software/phototomovie.php
http://www.boinx.com/fotomagico/overview/ -
Can anyone tell me what actionscript coding i should use in
order to get this gallery to autoplay instead of the use of
previous and next buttons? I just want my pics to load up, then
fade in and fade out, while going at a set timing rate. Any and all
help is appreciated, Thanks
Heres the link to the tutorial
The
XML Tutorial1. The next_btn.onRelease = function() name I changed to
nextSlide for
clarity. The setInterval(nextSlide, myMillis); is looking for
that function
named nextSlide. Here it is and add to frame 1:
nextSlide = function() {
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null) {
break;
} else {
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
2. In the function startSlideShow(success) after the
updateSlide(firstSlideNode); line add the line autoPlay();
currentIndex = 1;
updateSlide(firstSlideNode);
autoPlay();
3. Remove the autoPlay(); line from the end of the script.
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"fanmap81" <[email protected]> wrote in
message
news:[email protected]...
I dont know Motion Maker, i cant get it to work for some
reason. The first
picture loads and then just stays there. It dosent fade out
or anything.
here
is the entire code that i am using on the first frame of the
movie:
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("slides.xml");
slides_xml.ignoreWhite = true;
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
firstSlideNode = rootNode.firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
imagePath = newSlideNode.attributes.jpegURL;
slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
//-----------------------newest code-----------------------
var myNextInterval:Number;
var myMillis:Number = 2000;// 1000 = 1 second
function nextSlide()
nextSlideNode = currentSlideNode.nextSibling;
if (nextSlideNode == null)
clearInterval(myNextInterval);
break;
else
currentIndex++;
updateSlide(nextSlideNode);
currentSlideNode = nextSlideNode;
function autoPlay()
myNextInterval = setInterval(nextSlide, myMillis);
autoPlay();
What am i doing wrong? -
Well, I'm new to action scripting and have a simple question,
I'm looking to make an image scroller with "Pause" "Forward" and
"Previous" buttons, I also want this animation to loop. Would
anyone be able to point me into the direction for designing an
image scroller similar to this one
BSU.edu?
I'm working on a project for my company, using Flash 8
Professional and they wanted something similar to this. Any help
would be greatly appreciated. Thanks in advance!that's not really a scroller. the only thing that happens
when you click forward or back arrows is the next or previous image
pair fade-in.
create an array of your image pairs and two target
movieclips. initialize an array index (assign it zero) and if the
next button is pressed, increment the index, check if it exceeds
the array length (and, if so, re-assign to zero) and load the
corresponding pair of images listed in your array. when they both
complete loading, fade them in. similarly with the back
button. -
XML Slideshow v3 - thumbs not moving
I have selected a display from the Easy section. It has the
thumbs listed vertically on the left side of the frame. Although
there are many pics, the display or 3 thumbs stays static,
irrespective what is displayed or if the left/right arrows are
pressed. What is the solution, please?I have selected a display from the Easy section. It has the
thumbs listed vertically on the left side of the frame. Although
there are many pics, the display or 3 thumbs stays static,
irrespective what is displayed or if the left/right arrows are
pressed. What is the solution, please? -
Xml slideshow example with thumbnails?
Without being a programmer, I'm trying to tweak the example
from the Flash site to include thumbnails.
Can this be done easily? Can someone help me or point me to a
resource that might explain (in foolishly simple language) how I
can do it? Thanksyou can add a large image attribute to your slide tags as
shown below. then if edit the code in updateSlide() and add
preloadF() (and a target movieclip for the large image), the code
shown below should allow your images to load the large image when
pressed:
<Slides>
<slideNode jpegURL="images/image1.jpg"
large_jpegURL="images/largeImage1.jpg">A sea
horse</slideNode>
<slideNode jpegURL="images/image2.jpg"
large_jpegURL="images/largeImage2.jpg">Sea
anemone</slideNode>
<slideNode
jpegURL="images/image3.jpg"
large_jpegURL="images/largeImage3.jpg">Sardines!</slideNode>
<slideNode
jpegURL="images/image4.jpg"
large_jpegURL="images/largeImage4.jpg">Another sea
horse</slideNode>
<slideNode
jpegURL="images/image5.jpg"
large_jpegURL="images/largeImage5.jpg">Some kind of
jellyfish</slideNode>
</Slides>
Maybe you are looking for
-
If you could post a resolution or an explanation it would be much appreciated. Regards
-
Can't update or install any App due to a not enough memory message even when are 5Gb available
please your help, sisn two days ago, I can't update or install an app because says there is no enogth memory to do it, I have almost 5Gb available in the internal memory. I already check for virus with Bitdefender, and nothing, there is a bug in the
-
How to identify non-placed Photos in Aperture3
Today i switched to Aperture 3. In the past i've used a "intelligent album" to identify photos that do not carry GPS information. This task was pretty easy because any photo with valid GPS coordinates got an additional tag also (using Maperture). The
-
Calling default XML editor for system in Java
I'm looking for a way to call the system's default editor for xml files from a Java application. In other words, if I'm running on a Windows system, I might want to start Notepad, or if I'm on a Mac, maybe I want to start TextWrangler or oXygen, etc.
-
So, what happens to the archived messages on this board??
Why is there always only 1 page of messages on these boards? If Adobe would make all messages available I'm sure a lot of questions could be answered automatically.