Solved

Flash using Swishmax

Posted on 2004-08-24
7
253 Views
Last Modified: 2010-04-17
I've created a website using SwishMax, which is an easy to use Flash .swf creator.

I have a static picture on one of the pages that I would like to change every few seconds.  I woul'd like it to work very much like the changing logos on the experts-exchange home under "Who's Using EE?".

Any suggestions?
0
Comment
Question by:Flashvue
  • 3
7 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11887114
Post your question to the Flash forum:
http://www.experts-exchange.com/Web/WebDevSoftware/Flash/
0
 
LVL 4

Accepted Solution

by:
jcrumble earned 250 total points
ID: 11887243
I think what you are looking for is something like an Image rotator.  Don't know if it has to be a part of the menu you designed in Swift or not but here is a link to an image rotator on www.flash-kit.com (generally a good source for flash development examples with sample code) that should server your purposes:

http://www.flashkit.com/movies/Applications/Banner_A-Brian_We-7949/index.php

Good Luck,
Jeff
0
 
LVL 3

Assisted Solution

by:IceColdas
IceColdas earned 250 total points
ID: 11901356
Drag a sprite on the stage, and name it Background.
Then, create a function for that loads an external image
The function below loads an image with the index given as a parameter; i.e. : if index = 0, then it will load image0.jpg, which must exist in the same location with the movie.

function LoadImage(index) {
       tellTarget (("/Background")) {
        loadMovie("image"add(index)add(".jpg"));
    }
}

Now, the complete program :
Create 2 scenes. In the first scene make the initializations.

onFrame (1) {
_root.timer1 = 0;
_root.index = 0;
gotoSceneAndPlay("Scene_2",1);
}

In the second scene, drag the sprite on the scene, then use this script

function LoadImage(index) {
    tellTarget (("/Background")) {
        loadMovie("image"add(index)add(".jpg"));
    }
}

onEnterFrame() {    
    //after image5, it start again with image0
    _root.index ++;
    if (_root.index>5)
        _root.index = 0;
   
    /* timer1 is increased at every frame enter (that means 12 times/second at a movie rate of 12 frames/second
        so, if timer1 = 12, means one second passed; if timer1 = 120 means that 10 second passed */
    _root.timer1++;
    if (_root.timer1 > 120)
      {
          _root.timer1 = 0;
          LoadImage(_root.index);
      }
     
}

p.s. : the program will show the images only when u run the exported .swf movie, and will not show them in the Swish enviroment.
0
 
LVL 3

Expert Comment

by:IceColdas
ID: 11901395
one correction (the index must increase after the image change, not at every frame enter) :
onEnterFrame() {    
    _root.timer1++;
    if (_root.timer1 > 120)
      {          
          _root.timer1 = 0;
          LoadImage(_root.index);

            _root.index ++;
            if (_root.index>5)
                 _root.index = 0;      
      }  
}
0
 
LVL 3

Expert Comment

by:IceColdas
ID: 11901442
oh, seems like it doesnt work without using onFrame(1) statement. So final script for Scene_2 (tested and retested and reretested) :

function LoadImage(index) {
    tellTarget (("/Background")) {
        loadMovie("image"add(index)add(".jpg"));
    }
}
onFrame (1) {
    stop();
}
onEnterFrame() {
    if (_root.timer1 == 0)
      LoadImage(_root.index);
    _root.timer1++;
    if (_root.timer1 > 120)
    {
        _root.timer1 = 0;    
        _root.index ++;
        if (_root.index>5)
        {
           _root.index = 0;
         }
    }
}
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Advice in Xamarin 21 97
How to Convert a Quote to an Order in SalesForce 2 81
Generate Unique ID in VB.NET 21 62
programming a polycom voip phone 3 24
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is about my first experience with programming Arduino.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

837 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