Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 20th, 2011, 10:18 AM
malibusmile malibusmile is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 2 malibusmile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m
Reputation Power: 0
ActionScript 3 - Adding links to flash slideshow

I'm new to action script coding and i had found a tutorial to create a flash slideshow which worked great, but now i'm trying to add links to each slide and i can't find a tutorial that i can figure out to work with my existing coding.

i've added the link and target attributes to my xml file:

<?xml version="1.0" encoding="utf-8"?>
<SLIDESHOW SPEED="2">
<IMAGE URL="photowed.png" link="photowed.htm" target="_self"/>
<IMAGE URL="photofam.png" link="photofam.htm" target="_self"/>
<IMAGE URL="photochild.png" link="photochild.htm" target="_self"/>
<IMAGE URL="photorand.png" link="photorand.htm" target="_self"/>
</SLIDESHOW>

what do i have to add to my actionscript to make it work?

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

var my_speed:Number;
var my_total: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_timer:Timer;

var my_xml_loader:URLLoader = new URLLoader();
my_xml_loader.load(new URLRequest("photogallery.xml"));
my_xml_loader.addEventListener(Event.COMPLETE, processXML);

function processXML (e:Event):void{

var my_xml:XML = new XML(e.target.data);
my_speed=my_xml.@SPEED;
my_images=my_xml.IMAGE;
my_total=my_images.length();
loadImages();

}

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);

}
}

function onComplete(e:Event):void{
my_success_counter++;
if (my_success_counter == my_total){
startShow();

}
}

function startShow():void{

addChild(my_slideshow);
my_slideshow.addChild(my_image_slides);

nextImage();

my_timer = new Timer(my_speed*1000);
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;
new Tween(my_image,"alpha",Strong.easeOut,0,1,1,true);
}

function timerListener (e:TimerEvent):void{

my_playback_counter++;
if (my_playback_counter == my_total){
my_playback_counter =0;
}
nextImage();


}


any help would be appreciated

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > ActionScript 3 - Adding links to flash slideshow

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap