Solved

Flash using Swishmax

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tidtcpserver connection lost handle 2 88
Export Table to CSV - Access to CSV - using python 18 142
When i run adoquery my application freezes 26 166
Advice in Xamarin 21 80
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.
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.

821 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