Slideshow Actionscript

Version:
Flash MX
I’ve found an a script that plays random images with a
fade in and fade out effect, just like a slideshow expect it
doesn’t have navigation buttons. I came across two problems:
when the movie plays in an HTML
document it snaps to the bottom right of the movie, I checked the
movie clip on the stage and everything seems to be lined up
correctly
whe script is set to fade out and fade in quickly to the next
photo, the first image comes up, blinks once, and comes up again
without loading the second image until the third interval, this may
be due to that right now I only have two images but it should still
go to the second image
Thanks for any feedback. Here is the script:
this.pathToPics = "images/";
// fill this array with your pics
this.pArray = ["seat_banner01.jpg", "seat_banner02.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
// MovieClip methods ----------------------------------
// d=direction; should 1 or -1 but can be any number
//loads an image automatically when you run animation
loadMovie(this.pathToPics+this.pArray[0], _root.photo);
MovieClip.prototype.changePhoto = function(d) {
// make sure pIndex falls within pArray.length
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.length;
this.onEnterFrame = fadeOut;
MovieClip.prototype.fadeOut = function() {
if (this.photo._alpha>this.fadeSpeed) {
this.photo._alpha -= this.fadeSpeed;
} else {
this.loadPhoto();
MovieClip.prototype.loadPhoto = function() {
// specify the movieclip to load images into
var p = _root.photo;
p._alpha = 0;
p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
this.onEnterFrame = loadMeter;
MovieClip.prototype.loadMeter = function() {
var i, l, t;
l = this.photo.getBytesLoaded();
t = this.photo.getBytesTotal();
if (t>0 && t == l) {
this.onEnterFrame = fadeIn;
} else {
trace(l/t);
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
this.randomPhoto = function() {
this.pIndex = Math.floor(Math.random()*pArray.length);
this.onEnterFrame = fadeOut;
interval = setInterval(this, "randomPhoto", 3000);
]

Hi
The script is working fine as far as I can see the reson why
the you dont get the next picture is because its random
(this.pIndex = Math.floor(Math.random()*pArray.length); ) and you
only have 2 pics, so its just 50/50.
If you dont whant it random chance
from this
this.randomPhoto = function() {
this.pIndex = Math.floor(Math.random()*pArray.length);
this.onEnterFrame = fadeOut;
to this
this.randomPhoto = function() {
this.pIndex ++
if(this.pIndex>=pArray.length)this.pIndex = 0
this.onEnterFrame = fadeOut;
regards
Ómar

Similar Messages

  • Actionscript Slideshow horror!!!

    Hey everyone,
    I've got a simple random actionscript slideshow that loads
    external jpgs into a mc. Everything works good but i can't get the
    darn jpgs to fade in and out. Could someone please help, the
    deadline approaches.
    Here is the AS for the movieclip, it's in the 1st frame:
    mc = function() {
    num = (Math.round(Math.random()*2));
    // 50 being the number of your jpg, rename them from 0.jpg to
    49.jpg
    totalfilename = num + ".jpg";
    picLoader.loadMovie("
    http://www.venture-multimedia.com/factory/flash/"
    + totalfilename);
    // _root.picLoader being an empty movie clip instance name
    picLoader, just rename it to watever is
    //your movieClip name and rename the address of your site and
    folder where your images are
    mc();
    // If you want them to come on an interval of 20 seconds
    clearInterval(mc.intID);
    mc.intID = setInterval(mc, 3000);
    An here is the AS for making it fade in and out. This is applied
    to the mc itself:
    onClipEvent (load)
    this._alpha = 0;
    onClipEvent (enterFrame)
    if (this._alpha < 100)
    this._alpha = this._alpha + 5;
    } // end if
    if (this._alpha >= 100)
    this._alpha = 100;
    } // end if
    Thanks for your help!

    So the end of this message got cut off
    I'm wondering how to get the images to fade on ans opposed to
    just showing up?
    Thanks:
    Graphic Graeme

  • Actionscript in a Custom Component

    Can anyone tell me if you can put actionscript inside of a
    custom component? It throws errors anytime I try to do it.
    I have a horizontallist component that is being populated
    with an itemrenderer which holds an image component. The
    horizontallist takes fifteen images and loads them into the
    itemrenderers, creating a scrollable image slideshow.
    I am trying to get it to check to see if the image loaded
    successfully, and if not, either set the visibility of that image
    component to false, or remove it.
    Here is the code for the horizontallist:
    <mx:HorizontalList
    id="imageBar"
    itemRenderer="listingImage"
    height="330"
    width="925"
    paddingLeft="5"
    paddingRight="5"
    rollOverColor="#FFFFFF"
    selectionColor="#FFFFFF"
    >
    And the code for the custom component.....
    <mx:Canvas
    xmlns:mx="
    http://www.adobe.com/2006/mxml"
    height="320"
    width="400"
    verticalScrollPolicy="off"
    horizontalScrollPolicy="off"
    >
    <mx:Image
    source="
    http://www.urladdress.com/idx/rmls/images/resimages/{data.id}_{data.imageNum}.jpg"
    height="300" scaleContent="true"
    />
    </mx:Canvas>
    I'm pretty new to Flex, so any help would be great!

    just insert the script tags in the custom component and place
    your actionscript within those script tags. So in your case just
    insert the following script tags above the image control...
    <mx:Script>
    <![CDATA[
    // actionscript goes here
    ]]>
    </mx:Script>
    - Tony

  • Need to learn how to create a slideshow in Flash

    Hello All,
    I'm new to Flash and I need to learn how to do a slideshow with exactly the same features as can be found in this link:
    http://www.esppromo.com/index.asp
    Just like at the link above, it needs to play through the slides automatically once the page is loaded, each slide needs to link to a specific URL, and I need controls similar to the boxes at the bottom so the viewer can click on any specific slide they wish to view (I'd like to have numbers in the boxes though). The transitions don't have to slide across like this. If a fade is easier, that would be fine.
    Since I've looked online, but can't find any tutorials for doing this in Flash Professional, I think I'll pick up a book on Flash. There are some online tutorials that are close but nothing that is exactly what I'm looking for.
    I'm just wondering if anyone can recommend a particular book that covers creating this type of slide show with the links and controls exactly as I need it to be. I see these types of slide shows on a lot of sites now, so I'm hoping that maybe someone else on this forum has had to learn how to do this and can recommend a book they used?
    I was looking at Adobe Flash Professional CS5 Classroom in a Book and it looked like it may be what I'm after, but I am rather cautious, as I don't want to end up with instructions that are close to what I am looking for, but not quite right.
    Actually, I thought I'd be able to do this fairly easily with Flash Catalyst, so I updated to Adobe CS5 Design Premium. I found that Flash Catalyst can be used to create a slide show like this, but unfortunately it won't play automatically when the page loads and the viewer has to manually click through the slides, which is not what I need. I could be wrong, but from what I've read, I need Flash Builder to add code so the slide show will play automatically if I create it in Flash Catalyst. Since it's not an option for me to buy more software at this time, I've decided to learn how to do this in Flash Professional.
    I really want to learn how to do this. I expect to go on and create more using Flash, but for now I just REALLY need to figure this slide show out.
    If anyone can help out, I'd really appreciate it!
    Thanks,
    William

    Edit:
    i'm sorry. it is a huge work to type this and will be confusing as hell. i'm already up to 1 full word page of explanation. Though i am able to do it, explaning it in full lengh is ... well.. very hard. Way harder than it is to make your flash itself.
    I can however point you to some element you should read about how to make them:
    - How to use timeline in flash cs4
    - how to create a button in flash cs4
    - How to make "CLASSIC TWEEN" in flash cs4
    - How to use ActionScript 2 ( AS2) basic command like : GetUrl, Gotoandplay, Stop and how to put those script in the right location. ( AS2 allow you to put script directly on the button itself. however it is best to put it in the Action Layer that you will have to build in the timeline.
    - How to import thing in library.
    keep in mind that what you want to make is mostly a Logic probleme...
    - Image 1 click = GetURL X,
    - After Y time, Switch image 1 to image 2 with animation. Do the same for the button.
    - If you click on button 1 while being on image 3, you have to set all the reverse animation in the timeline, and use a lot of Gotoandplay.
    Hope this help you a little.
    I'm sorry. i really wanted to help you do it, but it is just a monstruous job to write all this.

  • Help with Portfolio Slideshow

    I'm fairly new to ActionScript 3.0 so forgive me if this question is easy, but I'm having issues with my portfolio slideshow.
    I have a few thumbnails and when you click on one the image slides in from the right. That part is fine. What I really want is for the user to click on a different random thumbnail and have the current image slide out as the new image slides in. My code so far:
    arizona1_btn.addEventListener(MouseEvent.CLICK, arizona1Clicked)
    function arizona1Clicked(event:MouseEvent) {
    if(currentFrame == 45) {
    gotoAndPlay(46);
    if(currentFrame == 70) {
    gotoAndPlay(71);
    gotoAndPlay(5);
    Basically, when arizona1_btn is clicked I want it to ultimately go to frame 5 where it'll play the image sliding in the from the right. The if(currentFrame) code is meant to tell it that if it's on one of the other two images, which stop at 45 & 70, then it should play the next frame with the images sliding out.
    As of now, images they don't slide out, they just disappear as the next images rolls in. I know it has to do with my if(currentFrame) code, but I'm not sure how to fix it.
    I know this is probably a quick fix, but I'm new and need help fast.
    Thank You!
    Message was edited by: Frederick Stahl

    usually, to check the currentframe, you need to use a loop (like Event.ENTER_FRAME) to repeatedly check for the currentframe.

  • Slideshow problems

    Hi,
    Hope someone can help.  I was able to take an existing Flash file created in '06 and make a simple slideshow.  See it at:
    http://prosol1.com/index99.html
    Now I've been asked to add buttons and make the slides fade instead of slide into each other.  They want it like this:
    http://prosolassociates.com
    So I created a very simple mock up:
    http://prosol1.com/slideshow_buttons.swf
    I just can't get the buttons to work like the prosolassociates one above.  I have attached the FLA here for anyone's review.
    I'd appreciate any help on this.  Thanks very much!
    Deaf Guy

    What version of Flash are you using? What version of Actionscript do you want to use? My guess is that you are using CS3. If this is true and you want to use AS2, then you need to set your publishing options for AS2. If you are just learning Flash and are using CS3 or CS4 then you should be learning to use AS3. There is no need to learn AS2 at all.
    If you want to use AS2, then change the settings for the Flash options in the Publish Settings window. This will allow you to attach code directly to a button on the stage.

  • How to create a SlideShow in GoLiveCS2 using Actions

    Good day to all,
    I was wondering if anyone has an idea how to make a photo slideshow in GoLive CS2 using the Actions? I have no experience in JavaScript, Actionscript and am not a programmer. Any information would be highly appreciated.
    I know how to create remote rollovers using Actions but not Slideshows.
    Please advise
    Regards,
    Alek

    I suggest hopping over to this address:
    http://www.mindpalette.com/actions/index.php
    and downloading the SlideShow Kit Action. It has more than you probably need, but should do the trick. Make sure to read the documentation, it explains how to use it.

  • Creating Slideshow with audio

    Hello!
    I'm working on a Flash CS3 file (with Actionscript 3.0) and
    I'm trying to create a slideshow with an audio track. I have 12
    slide images and a 12 minute long audio presentation. I want to
    pause the images for variable times during the presentation - 20
    seconds during the first slide, 60 seconds for the second slide, 80
    seconds for the third, etc. I've been able to write a script that
    loops along the timeline for the given time over the image then
    moves on to the next slide image. It works great if I don't want to
    pause and restart the movie, but I'd like to do that.
    I've been able to create a single button that pauses and
    plays the sound. Here's the tutorial I used to create this:
    http://twf23.wordpress.com/2008/02/06/start-and-stop-sound-with-actionscript-30/
    But, I cannot get it to pause the timeline at the same time.
    I can create a separate button that stops and starts the timeline.
    I want one button to do both. It seems like I should be able attach
    a function to the play_mc clip that also pause the timeline.
    Eventually this will be a template for other such
    presentations - where I can swap out the images and the audio thus
    creating a PowerPoint-like slideshow for distribution on the
    Internet.
    Any thoughts?
    Thanks!

    Welcome to the Apple Discussions.
    iMovie is a very straightforward way to do this.
    Import your sound and your images, stitch them together and then export them in an iPod compatible format.
    Job done.
    Regards
    TD

  • Interactive slideshow with JPGs

    Hi Flash experts,
    I have to build a Flash project. The challenges are:
    1. Preload 5 JPG images onto a movieclip container
    2. Produce a slideshow which loads the 5 external JPGs
    3. Autoplay and transition between pictures
    4. Have 5 buttons to go straight to the relevant image on the
    slideshow and
    smart enough continue playing the slideshow from that point
    5. A clickable area within the slideshow image to display the
    larger version
    of the image (can use emptymovieclip actionscript function)
    6. When user click to open the large version of the image,
    the
    transition/autoplay should pause and continue when it closes
    I have done the first 3.5 points of the challenge but stuck
    on the rest. If
    anyone can suggest or direct me with an approach or example
    to solve this
    challenge that would be very much appreciated.
    Thanks.
    Jay

    That QT button behavior won't do what you want. It does a lot different things but its not designed to move one frame forward or back. A behavior like this wil do the job. Depending on your QT movie, you may need to adjust the number of frames that are moved each time the button is used. This is the next frame behavior:
    property QTSprite
    property thisDuration
    property thisMember
    property customCursor
    property thisSprite
    on getPropertyDescriptionList
      myPropList = [:]
      myPropList.addProp(#QTSprite,[#comment:"enter the Quicktime sprite number:",#format:#integer,#default:""])
      myPropList.addProp(#customCursor,[#comment:"pick a cursor:",#format:#cursor,#default:280])
      return myPropList
    end
    on beginSprite me
      thisSprite = me.spriteNum
      thisMember =  sprite(QTSprite).member
      thisDuration = thisMember.duration
      sprite(thisSprite).cursor = customCursor
    end
    on endSprite me
      sprite(thisSprite).cursor = 0
    end
    on mouseUp me
      if sprite(QTSprite).movieTime < thisDuration then
        sprite(QTSprite).movieTime = sprite(QTSprite).movieTime + 1
      end if
    end
    and this is the previous button behavior:
    property QTSprite
    property thisMember
    property customCursor
    property thisSprite
    on getPropertyDescriptionList
      myPropList = [:]
      myPropList.addProp(#QTSprite,[#comment:"enter the Quicktime sprite number:",#format:#integer,#default:""])
      myPropList.addProp(#customCursor,[#comment:"pick a cursor:",#format:#cursor,#default:280])
      return myPropList
    end
    on beginSprite me
      thisSprite = me.spriteNum
      thisMember =  sprite(QTSprite).member
      sprite(thisSprite).cursor = customCursor
    end
    on endSprite me
      sprite(thisSprite).cursor = 0
    end
    on mouseUp me
      if sprite(QTSprite).movieTime > 1 then
        sprite(QTSprite).movieTime = sprite(QTSprite).movieTime - 1
      end if
    end
    Try these and see if they work for you.

  • Want to trigger an event in Javascript using Actionscript

    Hello forum,
    I am trying to trigger an event in Javascript from an SWF.  In HTML the triggering event is this:
    <a href="#" onclick="return GB_showFullScreenSet(page_setWEB1, 1)"><img src="images/Thumbnails/IMAGE-NAME.jpg" /><br />Link Label</a>
    This line trggers a pop-up style portfolio image slideshow.  I am trying to figure out how to trigger this event from actionscript.  I am not sure what this would even be called so any help would be great.
    Thanks,
    Brett

    The communication works both ways.  Here's the description from that page.
    "From ActionScript, you can call any JavaScript function on the HTML page. It passes any number of arguments of any data type, and receives a return value from the call.
    From JavaScript on the HTML page, you can call an ActionScript function in Flash Player. The ActionScript function can return a value. JavaScript receives it immediately as the return value of the call."
    It can be a bit confusing to implement, so you might want to search for other examples/tutorials if you can't get it working from the one linked already.

  • White flash inexplicably appears in photo slideshow

    In iMovie, the white frame does not appear at all, but when the slideshow is imported into iDVD, it shows up in the slideshow. I removed the clip before and after it, and put the new photos and title slide in, and it still appeared in iDVD. Any solutions for this problem?

    Your best bet is to search Google using "AS# slideshow tutorial", replacing the # with 2 or 3 depending on which version of actionscript you plan to use.  You are not likely to find one exactly like that one, so you should look for one that behaves similarly in some way and then figure out how to change it to be what you want.  My guess would be that most you might find that have automatic slide changes might change them horizontally, or might just fade one in atop another, so if that is all you can find, then you just need to figure out how to adapt it to work vertically instead.

  • Slideshow navigation buttons in AS3

    Can anyone help. I want to create the same slideshow that
    ships with Flash CS3 but in actionscript 3. The one shipped is
    actionscript 2 and useless if you are creating a project in
    actionscript 3. I am having particular trouble with how to do a
    play/pause/stop button. Not sure how to use the timer class.
    Help
    Christine

    at the end of each class description in the flash help files
    is (often) an "how to use" example. the timer class has sample
    code.
    if you're not sure how to make an interactiveobject respond
    to mouse events, check the end of the interactiveobject class for
    sample code.

  • Create A Slideshow Banner

    I've seen this site referenced quite a bit in my searches on how to make a slideshow banner.
    Would anyone be willing/able to make a step by step tutorial for this on putting all the info together, after downloading the forms etc.?
    http://www.wyodor.net/iWebBlogTest/Wyodor_1/WebBanner.html

    Thank you for reply and assistance.
    I was doing some testing on my side regarding the size and if I do a single box rotaing ad, it will be 180 W x 220 H
    If I do the banner style it will be 540 W x 220 H that will have 3 boxes similar to this:
    Where the images will rotate right to left every 10 seconds and repeat once they have reach the last item.
    The image holders will be 100 x 125
    The fields that will change will be:
    Name - Ex. Clear, 6" Polycarbonate Bud Vases, 12 Pack
    Price - Ex. $26.28
    Brand - Ex. Cambro: BV6CW-135
    Image - URL http://www.deiequipment.com/core/media/media.nl?id=4239&c=562544&h=d2979ac8391cf36bfcb3
    I am using Flash Professional CS5, I am not too familiar with the actionscripts yet, but I have done programming in the past so I can do research on how to work with those.
    Once again, thank you for your help!

  • Convert gallery to slideshow

    Hi
    I've got a user-controlled gallery on a webpage which is
    working fine at the moment:
    Aztec site
    The client now wants it to be a slideshow however. Rather
    than start from scratch, is there any way to keep it as it is, but
    make it act as if the user is clicking on each thumbnail every 10
    seconds or so. I'd be hiding the thumbnails.
    In effect, I want to convert it from an interactive gallery
    to a passive slideshow, but keep the scrolling effect.
    Here's the flash file:
    link
    And here's the ActionScript:
    this.createEmptyMovieClip("images", 100);
    this.attachMovie("mask", "mask", 101);
    mask._x = images._x =5;
    mask._y = target = 5;
    images.setMask(mask);
    images._y = -1000;
    speed = 5;
    for (var i = 0; i<8; i++) {
    var img = images.attachMovie("image"+i, "image"+i, i);
    img._y = img._height*i;
    var thumb = this["thumb"+i];
    thumb._alpha = 60;
    thumb.pos = target+(i*-img._height);
    thumb.onPress = function() {
    target = this.pos;
    thumb.onRollOver = function() {
    this._alpha = 100;
    thumb.onRollOut = function() {
    this._alpha = 60;
    this.onEnterFrame = function() {
    images._y += (target-images._y)/speed;

    place your thumb.pos values in an array and initialize a
    timer (setInterval) that will reassign target to be one of the
    array values peroidically.

  • HTML-page into flash slideshow?

    Hi,
    I'm am trying to load a HTML-page into a flash slideshow. The slideshow is going to run locally on the computer and the HTML-page (or RSS-feed if that is easier) is recieved from the company´s web-page. I'm totaly new to flash, and I would be very grateful if anyone knew any way to do this. Is there any simple string I can use, like URLloader?
    Thanks in advance!
    Franz

    You can do this only with AIR  :
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/html/HTMLLoader.h tml

Maybe you are looking for

  • Problem in mapping the fields for 0FI_GL_4

    Hi,   can I get any document regarding the mapping the fields at BW side. I need to give Profit and loss Account report. Regards kamineni

  • Urgnt help in import user schema

    Dear all, when i make import from user schema , i faced the problem of __arabic__ data corrupted ( ????????????) this warning is appeared in the log file of import can any one help me to solve this problem . import done in AR8MSWIN1256 character set

  • Not getting the image no in ipad

    how can i transfer my image from my windows pc with the perticular iamage no. rite now i have transeferred all the images but the design no is not showing in my ipad ratina display.please help me for that iPhone 4

  • Billing output with Header & Item data fields

    Hello Friends, I liked to create new access for Billing output with Sales Orgn/Bill to party(Billing Header data) & Material number (Item data). I tried but system not recognizing the field Material number from billing item level. Please guide me how

  • Adobe Flash player quit working on YouTube.

    The Flash player symbol shows on the screen when a video is selected but does not change to the play arrow or start the video. Flash player and Firefox versions are the most current ones. Mac OS 10.6.8, iPhoto '09 8.1.2, Quicktime player 10.0, Flip4M