Groups | Blog | Home
all groups > flash actionscript > march 2005 >

flash actionscript : random flash images in html


rentme
3/21/2005 11:18:28 PM
I have two flash movies that I want to randomly appear each time an html page
refreshes. I have this code that I found on another site that works perfectly
when viewing the file outside of html, but when I load the file onto an html
page, all I get is a blank screen where the movie should be. The action script
that I have in the first frame of a blank movie is:

var basename = "TNE";
var totalmovies = 2;
var movietoload = basename+Math.ceil((Math.random()*totalmovies))+".swf";
_root.loadMovie(movietoload);

This randomly loads up the two other flash movies, but like I said, when put
the SWF on a webpage, it doesnt work. Does anyone know why this is?
geo_fry
3/22/2005 1:21:53 AM
Just to clarify:
1. You are putting that code inside of <script></script> tags, correct? Just
putting in the html won't work.
2. What do you mean when you say you "view the file outside of html"?
3. Right click in the blank area. Does it give you the flash menu (IE with
controls for play and loop and quality etc.) or the regular HTML right click
menu? (This would tell you if it's just not loading the right movie [ie bad
filename] or if the flash isn't loading at all.)

Post these clarifications and I'll see what I can do to help
rentme
3/22/2005 3:55:23 AM
I'm using Dreamweaver to insert Flash SWF files as part of my site. All the
other flash movies I use in my site load up correctly, but they dont use
actionscript to call up other files. What I mean by 'view outside of html' is
view using regular Flash Player. The file works when I view it using only Flash
Player- It loads up the other two SWF files randomly, but when I use
Dreamweaver to put the same SWF on my site, it doesn't load. All that appears
is a white space the size of my movie and if I right click on it, I only get '
Movie not loaded... and About Macromedia Flash Player 7' I have the two files
that it should load up saved into the same folder in my site as the one that
loads them.
AddThis Social Bookmark Button