⚠ Forum Archived — The THSCC forums were discontinued (last post: 2024-05-18). This read-only archive preserves club history. Visit thscc.com →  |  Search this archive with Google: site:forums.thscc.com your search terms

THSCC Forums

Tarheel Sports Car Club Forums
It is currently Tue Apr 07, 2026 10:06 am

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Any (Macromedia) Flash experts out there?
PostPosted: Sun Jan 28, 2007 11:24 pm 
Offline
User avatar

Joined: Wed Aug 20, 2003 11:05 pm
Posts: 1895
Location: lost but making good time
We're looking for someone who's good with Flash to help us with the club website. You may have noticed that on the upper left corner of the site there's a list of sponsor images that fade in and out. You may have also noticed that that list of sponsors is pretty out of date. I made that thing a couple years ago when I knew just a little bit about Flash, but I've since forgotten it all. :oops:

The ideal solution would rotate through a list of image files in a directory, so whenever sponsors change we could just swap out the old images and in with the new, but for now if we could just get it updated with a current set of sponsor logos that would be great.

Alternatively, if someone knows how to get a similar effect using some other technology, that would be cool too.

I should mention we're looking for volunteers and/or donated time for this project, but we're interesting in talking to anyone who thinks they can get it done.

Thanks in advance!

_________________
Carl Fisher

Be Cool to the Pizza Dude:
http://www.npr.org/templates/story/stor ... Id=4651531


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 1:01 am 
Offline
User avatar

Joined: Wed May 04, 2005 10:09 pm
Posts: 39
Location: Raleigh, NC
Carl, I'd been willing to help. I've done this for a couple people so I should have the source files sitting around somewhere, if not I should be able to whip something up quickly. Let me know.

-Johnathan

_________________
83 Porsche 911SC
07 Ford F150


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 8:43 am 
Offline
User avatar

Joined: Wed Aug 20, 2003 11:05 pm
Posts: 1895
Location: lost but making good time
Hi Johnathan,

Thanks for the offer. Do you think you'd be able to figure out something that would use Flash to read a list of files from somewhere (a directory, for example, or a text file), and then fade them in and out in sequence?

After posting this last night, I think I found a way to do it using Javascript, so if you don't think you can do that then it's OK. But if you can do it then that's a couple hours I don't have to spend messing with it, and that would be much appreciated right now! :D

Thanks again,

_________________
Carl Fisher

Be Cool to the Pizza Dude:
http://www.npr.org/templates/story/stor ... Id=4651531


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 8:55 am 
Offline
Not spectacular just decent
User avatar

Joined: Thu Aug 28, 2003 5:12 pm
Posts: 1213
Location: Heading back to base for debriefing and cocktails.
Scripting would be easier since you can just point it at the same directory.

Sponsors come in, you add a file to the directory (keeping the same proportions). Sponsor leaves, delete the graphic file from the same directory.

There might be a couple of naming conventions you'll want to follow to keep it easier, but other than that it's really straight forward.

I've done this for a client, let me know if you want to take a leap from the same script.

_________________
Not spectacular just decent.
I'm not sure what I'm driving.
Maybe an ITR in DS.
Or half-assed STX prepped 330.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 10:51 am 
Offline
User avatar

Joined: Wed May 04, 2005 10:09 pm
Posts: 39
Location: Raleigh, NC
If we can use version 7 of the flash player this shouldn't be a problem (they're on version 9 of the player now). As it has some nice features for fading external images in and out, and dynamically loading and testing if images have been loaded. It is also possible to have flash resize the images once loaded so there isn't as much need to resize the images before hand except to conserve bandwidth. I think the best way as David mentioned is to have a directory with the sponsor images named sequentially. Then just load one after another.

Scripting is definitely an option as it doesn't require the user to have flash installed and it's easier to maintain as there's no separate source files.

_________________
83 Porsche 911SC
07 Ford F150


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 11:33 am 
Offline
Got Powah?
User avatar

Joined: Wed Aug 20, 2003 9:15 pm
Posts: 4724
http://www.dyn-web.com/scripts/rotate-rand/

Uses php to get the image list, passes it to javascript. I'm a javascript newbie but I managed to get the rotator script to work locally.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

<?php
$path_to_images = "images/";  // path to your images
$num_to_rotate = 12; // number or "ALL" (to rotate all images in directory)

// returns string to echo into JavaScript images array 
function getJSRandomized($path, $list, $num) {
    $str = '"';
    mt_srand( (double)microtime() * 1000000 );
    shuffle($list);
    if ( $num == "ALL" ) $num = count($list);
    for ($i=0; $i<$num; $i++) {
        $str .= $path . $list[$i] . '", "';
    }
    // remove last comma and space
    $str = substr($str, 0, -3);
    return $str;
}

function getImagesList($path) {
    $ctr = 0;
    if ( $img_dir = @opendir($path) ) {
        while ( false !== ($img_file = readdir($img_dir)) ) {
            // add checks for other image file types here, if you like
            if ( preg_match("/(\.gif|\.jpg)$/", $img_file) ) {
                $images[$ctr] = $img_file;
                $ctr++;
            }
        }
        closedir($img_dir);
        return $images;
    } else {
        return false;
    }
}
?>

<head>
<title>Rotate Random Images from a Directory</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
@import "style/demo.css";
td { vertical-align:top }
</style>
<script src="/javascript/rotate-img/src/dw_rotator.js" type="text/javascript"></script>
<script src="/javascript/rotate-img/src/dw_random.js" type="text/javascript"></script>
</head>
<body onload="dw_Rotator.start()">
<!-- resorting to table for ns4 -->
<table border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="2"><h1>Rotate Random Images</h1></td>
    </tr>
    <tr>
        <td>
<p>This example combines the JavaScript random image rotation code with a PHP listing of images from a directory. The PHP array of images is transferred into a JavaScript array for use by the rotator code. </p>

<p>You can specify the number of images to include in the random rotation. You can also adjust the rate of rotation. Multiple sets of rotating images in a document are supported.</p>

<p>The images in the example are not linked, but they could be. The JavaScript rotator code provides the capability to specify functions to be called onclick which could be used creatively in combination with the file names from the directory listing.</p>

<p id="ref">Information about this code is available from <a href="http://www.dyn-web.com/scripts/rotate-rand/">Rotate Random Images - PHP/JS</a>.</p>

<p>&nbsp;</p>

<p><a href="http://www.dyn-web.com">www.dyn-web.com</a></p>

        </td>
        <!-- random image here -->
        <td>

      <?php if ( $image_list = getImagesList($path_to_images) ) : ?>

<script type="text/javascript">
/*************************************************************************
    This code is from Dynamic Web Coding at dyn-web.com
    Copyright 2001-5 by Sharon Paine
    See Terms of Use at dyn-web.com/bus/terms.html
    regarding conditions under which you may use this code.
    This notice must be retained in the code as is!
   
    See full source code at dyn-web.com/scripts/rotate-rand/
*************************************************************************/
var imgList = [
  <?php echo getJSRandomized($path_to_images, $image_list, $num_to_rotate); ?>
  ];
var rotator1 = new dw_RandRotator(4000); // rotation speed
// images array, width and height of images, transition filter (boolean)
rotator1.setUpImage(imgList, null, null, false);
</script>

<?php else : ?>
<!-- image to display if directory listing fails -->
<img src="images/smile.gif" width="88" height="88" alt="">

<script type="text/javascript">dw_Rotator.start = function() {};</script>

<?php endif; ?>

</td>
    </tr>
</table>

<script type="text/javascript">
function displayCodeInfo(id) {
    function getPath(pn) {
        return pn.slice(0, pn.lastIndexOf("/") + 1);
    }

    if ( !window.opener || getPath(window.opener.location.pathname) != getPath(window.location.pathname) ) {
        var el = document.getElementById? document.getElementById(id): null;
        if (el) el.style.display = "block";
    }
}

// in case not opened by presenting doc
displayCodeInfo('ref');
</script>

</body>
</html>

_________________
Mike Whitney
whit32@gmail.com, 919-454-5445
V10, V8, V8t, I6, I6, V6, F4t, I4, I4, I4, I4, I2, 1, 1


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 1:07 pm 
Offline
User avatar

Joined: Wed Aug 20, 2003 11:05 pm
Posts: 1895
Location: lost but making good time
That's pretty slick Mike- good find! The only trouble I see with it, though, is that the outer "wrapper" is PHP. Not that there's anything wrong with that by itself, but this little Flash diddie we've got is part of the main page template, so incorporating this script would mean changing the template (a pain), plus changing the name of every file on the site to a .php extension so that it would always be able to run. The advantage of a Flash solution is that we should just be able to replace the old & busted sponsors.swf file with the new hotness one and be on our way.

Johnathan and Dave, do you think one (or both) of you can figure out a way to do this in Flash, so that it looks for a list of files in a directory, then (ideally randomly, but sequentially would be OK) display them either fading in and out (as we have currently), or using a dissolve transition?

That would be really awesome if so! Since it looks like the question's been answered, let's continue this via email with webmaster@thscc.com.

Thanks!

_________________
Carl Fisher

Be Cool to the Pizza Dude:
http://www.npr.org/templates/story/stor ... Id=4651531


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 1:51 pm 
Offline
Got Powah?
User avatar

Joined: Wed Aug 20, 2003 9:15 pm
Posts: 4724
Carl Fisher wrote:
That's pretty slick Mike- good find! The only trouble I see with it, though, is that the outer "wrapper" is PHP. Not that there's anything wrong with that by itself, but this little Flash diddie we've got is part of the main page template, so incorporating this script would mean changing the template (a pain), plus changing the name of every file on the site to a .php extension so that it would always be able to run. The advantage of a Flash solution is that we should just be able to replace the old & busted sponsors.swf file with the new hotness one and be on our way.


I understand the limitations - and I understand why you'd want to avoid PHP. Out of curiosity I'm curious how else this could work with javascript -- apparently the authors of that script use PHP for server-side file access. They have a version of the script with hard-coded file names which doesn't need PHP.

Is there any other client-side way for javascript to get a list of file names from a directory?

I'm also worried that flash will have the same problem -- getting a DIR list is a server-side operation. Dunno anything about flash though, maybe it's all good.

Could a sponsors.txt file be posted somewhere on the site where you'd need to manually make a list of the files in the /sponsors/ directory, and do a simple read from that txt file to build the javascript array of file names?

Like I said, just curious, and I have almost zero web programming experience. The funny thing is, I have learned a fair amount of javascript working on automating some of my datamining queries and output files at work, and now this has me interested enough to dabble in web scripting :)

_________________
Mike Whitney
whit32@gmail.com, 919-454-5445
V10, V8, V8t, I6, I6, V6, F4t, I4, I4, I4, I4, I2, 1, 1


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 2:28 pm 
Offline
User avatar

Joined: Wed Aug 20, 2003 11:05 pm
Posts: 1895
Location: lost but making good time
I'm not completely sure about this, but I believe the Flash file is never on the client. Taking a look at the source code on the thscc.com home page (via View Source) I see that there is an embedded Flash Player object there. Whether that lives on the server, or just makes a connection to it somehow, I don't know, but in any event my understanding is that the Flash object does have access to server files.

_________________
Carl Fisher

Be Cool to the Pizza Dude:
http://www.npr.org/templates/story/stor ... Id=4651531


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 01, 2007 1:44 pm 
Offline
User avatar

Joined: Wed Aug 20, 2003 11:05 pm
Posts: 1895
Location: lost but making good time
Hey- BIG THANKS to Johnathan Eshleman for whipping up a great new Flash file for us in a jiffy! Now adding and removing sponsors from the fader is as easy for us as adding and removing files from a folder. That's slick! :thumbsup: (y'all may not care about this stuff, but just be thankful that your Webmasters are as detail-oriented as they are... :user: ) Feel free to check out his handiwork at http://www.thscc.com. As before, clicking on the fader takes you to the sponsors page.

Of course the sponsor list is still out of date, but I know our Manager of Business Development, Jonathan Rodriguez, is working on getting that all straight. Right, Jonbo?
So once again, major props out to Johnathan-with-an-H for making your Webmasters' lives a lot easier! :clap: :clap: :clap: :clap: :clap:

_________________
Carl Fisher

Be Cool to the Pizza Dude:
http://www.npr.org/templates/story/stor ... Id=4651531


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group