Solved

Flash using Swishmax

Posted on 2004-08-24
7
250 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now