View Full Version : Count files in directory / duplicateMovieClip
I am working on a site for my friend's band. They are going to be uploading new pictures of their shows every week. I have to make it as dummy proof as possible so I want to create a dynamic thumbnail gallery so all they have to do is upload the jpegs. Well, each week there are going to be a different number of pictures so I need to count the number of files in the directory. I just started this and I'm already stuck. (It's hard for a dummy to dummy proof something I guess).The text box (just for testing purposes) displays the correct number of files in the directory, but the duplicateMovieClip() doesn't work. If I hard code the variable, it does. Can someone tell me what I'm doing wrong? It's got to be something simple I'm guessing. Thanks in advance.
<?
function parse_dir($dir,$level){
$dp=opendir($dir);
while (false!=($file=readdir($dp))){
if ($file!="." && $file!=".."){
$countervar=$countervar+1;
if (is_dir($dir."/".$file)) parse_dir($dir."/".$file,$level+1);
else print "&path".$countervar."=".$dir."/".$file;
print "&numberOFfiles=".$countervar;
}
}
}
$start_dir="thumbs";
$level=1;
parse_dir($start_dir,$level);
?>
loadVariablesNum("thumbcounter.php", 0);
for (i=1; i<_root.numberOfFiles; i++) {
duplicateMovieClip("box", "box"+i, i);
this["box"+i]._x = box._x+box._width*i*2;
}
The next feat will be to duplicate the movie clips in rows. I'll be searching in the meantime. If anyone's got a link handy, by all means.... :D
unless your using flash5, don't use loadvariarblesnum, use LoadVars object instead. the problem in your current code, is that you don't give the swf enough time to load the file in before trying to use values contained in the file.
if you have to use it, then do a quick search on the term 'swonk' here (boy its been a long time since i've suggested that). you will find many examples on how to set up your fla to use loadvariables()& loadvariablesnum().
CyanBlue
07-12-2004, 07:05 PM
Try this...
count_lv = new LoadVars();
count_lv.onLoad = function(ok)
{
if (ok)
{
trace(unescape(this));
_level0.num_txt.text = this.numberOfFiles;
for (i = 1 ; i <= parseInt(this.numberOfFiles) ; i++)
{
_level0.box.duplicateMovieClip("box" + i, i + 1000);
_level0["box" + i]._x = _level0.box._x + _level0.box._width * i * 2;
}
}
}
count_lv.load("http://localhost/vman/thumbcounter.php");
I don't know how correct the PHP script is though...
<?php
function parse_dir($dir, $level)
{
$dp = opendir($dir);
while (false != ($file = readdir($dp)))
{
if ($file != "." && $file != "..")
{
if (isset($countervar))
$countervar = $countervar + 1;
else
$countervar = 1;
if (is_dir($dir."/".$file))
parse_dir($dir."/".$file, $level + 1);
else
print "&path".$countervar."=".$dir."/".$file;
print "&numberOFfiles=".$countervar;
}
}
}
$start_dir = "thumbs";
$level = 1;
parse_dir($start_dir, $level);
?>
CyanBlue
Well, no doubt your AS worked. I got the php script from another forum. I'm really not familiar with php, but I know it was returning the correct number of files because the text box was displaying it. I'll have to do some reading when I get home to figure out what you did here because, while it surely works, if I don't understand what was wrong with it in the first place, I'm no better off! ;) As always, you've been a great help. Thanks a lot!
CyanBlue
07-12-2004, 08:12 PM
Well... tg already mentioned where the problem is... and that's exactly what this was all about...
the problem in your current code, is that you don't give the swf enough time to load the file in before trying to use values contained in the file.
Just a friendly advice... REMOVE loadVariables()/loadVariablesNum() out of your memory as long as you are exporting your movie for FMX and above... That'll make your life whole lot easier... :)
loadVariables()/loadVariablesNum()? What's that? :D
This is what I tried first:
myLV = new LoadVars();
myLV.onLoad = function(success){
if (success){
for (i=1; i<_root.numberOfFiles; i++) {
duplicateMovieClip("box", "box"+i, i);
this["box"+i]._x = box._x+box._width*i*2;
}
} else {
trace("file failed to load");
}
}
myLV.load(thumbcounter.php);
I want to figure out why that didn't work.
Thanks again.
CyanBlue
07-12-2004, 09:15 PM
Two things...
this within the myLV.onLoad handler means the myLV not the _level0 you hoped it to be... That's why you were not able to duplicate any boxes...
and you, actually, lostinbeta, are missing double quotes in the load() line...
Ah, got it. I thought that since the myLV.onLoad handler was in the _root level that "this" would refer to it. The double quotes was just a silly overlook (that can make all the diffrence in the world). I had them in the first post. :)
So you spend time on Kirupa too, huh? Do you ever sleep? Do you use the same handle over there? 'cause I don't see your name pop up there. I started going there a while ago cause for a while I wasn't getting too many responses here. Maybe my questions were stupid ones. Is that considered cross-posting? :D
I can't imagine how you ever have time for yourself. Anyways, thanks again for the help. Hopefully, I'll be able to work out the grid portion of duplicateMovieClip on my own. :rolleyes:
anytime your inside a method/event of an object, this will always refer to that object.
CyanBlue
07-12-2004, 09:56 PM
Um... I do not have my own time... I am actually a robot... A robot cannot have its own time without the permission of its master... :D
Kirupa... I don't really post there anymore cuz I know my brain would probably explode if I try to... (My brain is not like ones from senocular's...)
I just visit the server side scripting forum at the Kirupa to see if there is any interesting thread going on... My handle... Hm... You probably can guess what it is... :D
Now, go back to Flash and play with the grid stuff... (I think I might have a couple of threads that go with the grid stuff in my list if you want to take a look... :))
Yeah, that would be great. Unfortunately, I don't have time to play with Flash until I get home from work. Work which unfortunately doesn't even remotely have anything to do with Flash. If it did, I'm sure I'd have a pretty good handle on this stuff by now.
And thanks tg for the explanation. :)
Have a good one.
If it did, I'm sure I'd have a pretty good handle on this stuff by now.
most assuridly.
Well,
I got the grid thing done ok thanks to the help from one of CyanBlue's most helpful threads. It loads in the jpegs, but I can't get the onRelease() to function properly.
It works fine like this:
numberOfFiles = 14;
numColumns = 6;
cnt = 1;
startX = startY=0;
for (i=1; i<=numberOfFiles; i++) {
this.attachMovie("box", "box"+i, i, {_x:startX, _y:startY});
this["box"+i].container.loadMovie("Arra/thumbs/"+[i]+".jpg");
this["box"+i].targNum = i;
this["box"+i].onRelease = function() {
_level0.containerMC.loadMovie("Arra/pic"+this.targNum+".jpg");
};
startX = (cnt%numColumns == 0) ? 0 : startX+_level0["box"+i]._width;
startY = (cnt%numColumns == 0) ? startY+_level0["box"+i]._height : startY;
cnt++;
}
But, since I need the number of duplicated mc's to change weekly, it needs to be more dynamic. This next bit does that, but I can't get the onRelease() to work:
count_lv = new LoadVars();
count_lv.onLoad = function(ok) {
if (ok) {
numColumns = 6;
cnt = 1;
startX = startY=0;
for (i=1; i<=parseInt(this.nof); i++) {
mc = _level0.attachMovie("box", "box"+i, i, {_x:startX, _y:startY});
_level0["box"+i].container.loadMovie("Arra/thumbs/"+[i]+".jpg");
_level0["box"+i].targNum = i;
_level0["box"+i].onRelease = function() {
_level0.containerMC.loadMovie("Arra/pic"+level0.targNum+".jpg");
};
startX = (cnt%numColumns == 0) ? 0 : startX+_level0["box"+i]._width;
startY = (cnt%numColumns == 0) ? startY+_level0["box"+i]._height : startY;
cnt++;
}
}
};
count_lv.load("thumbcounter.php");
Any ideas as to where I screwed up? Been at it for 4 hours now.
I guess 4 hours and 2 minutes was the magic number. Got it. :D
_level0["box"+i].onRelease = function() {
_level0.containerMC.loadMovie("Arra/pic"+this.targNum+".jpg");
};
CyanBlue
07-13-2004, 06:05 PM
To me, it looks like you've done it in two minutes... :)
Do me a favor and give yourself some room... No clue on what I mean???
"Arra/pic"+this.targNum+".jpg"
"Arra/pic" + this.targNum + ".jpg"
I can't breathe... :D
Still not sure what you mean. What's the difference? :confused: :)
I always auto format before I test and Flash will squeeze it together anyway.
CyanBlue
07-13-2004, 06:26 PM
I meant that it'd be abit easier to read the code, especially if it is from another person, if you have some room in between the operators and varialbe names... ;)
You can set the option for the Auto Format to customize it further...
The default has nothing selected, but I have 1, 2, 3, 5 selected to make me abit less dizzy... :D
Gotcha! I'll keep that in mind for my future posts (which I'm sure won't be far away). Maybe that's why my eyes hurt and I always have headaches. :D
CyanBlue
07-13-2004, 06:30 PM
I don't think that's the reason... I have constant headache and my eye hurts every time I see my monitor... I think it is either the Flash or the air in Chicago that's causing it... :D
I think you may be right. :)
you both just need a bit more 'hair of the dog'.
CyanBlue
07-13-2004, 08:13 PM
A bit more??? I've got two dogs at home already and I know how much of their hair I inhale everyday... :(
Yeah, I have 1 dog and 3 cats here. I try to stay away from dark colored clothes. Anyways, this little project is turning out nicely for me so far. Thanks again for the help guys. If you'd like to check it out, here's a link.
http://www.thezplane.com/test.htm
Now that I have the functionality, all I need to do is make it look nice. You can tell I didn't get a whole lot of "work" done today. :D
Don't mind the pictures of my house, it looks much better now that it's done. :)
CyanBlue
07-13-2004, 09:13 PM
Looking very nice... Yeah... Go get your hands dirty and make the site nice... :)
Cats and dog??? Lovely... ;)
nice. i like seeing house like that. thats kinda what mine looks like but mine has a bunch of furniture in it also... and kids toys.
now you just got to get a couple of those photos to re-orient themselves to vericle.
Nah.... I'm thinking it would be easier to just do it before they're uploaded! :D
Well,
I just talked with a few of the guys from the band tonight and a wrench just got thrown in to my whole plan here. Now in addition to showing new pics of their shows every week, they want the visitors to be able to view archived pitures from past shows. These pics would be in different directories for each show.
I've been thinging about how this would be possible and this is what I came up with.
This is the code that would have to be changed to access the files in different directories:
_level0["box" + i].container.loadMovie ("Arra/thumbs/" + [i] + ".jpg");
_level0["box" + i].targNum = i;
_level0["box" + i].onRelease = function ()
{
_level0.containerMC.loadPic ("Arra/pics/pic" + this.targNum + ".jpg");
};
Now they may have to be changed from a button outside of the swf because I'm making this site half Flash and half html so they can update it easily themselves (not that I wouldn't be interested in doing it for them for some extra $$$). But they're only a cover band. :D I thought maybe I'd have a blank mc in there with an onEnterFrame() function that checks for a change in variables and perform an action.
count_lv.load ("thumbcounter.php");
This would probably be placed in every thumbs folder so the php script wouldn't have to change.
Am I headed in the right direction here or is this a bad way of going about it? Just looking for some advise. Thanks. :confused:
CyanBlue
07-14-2004, 04:30 AM
Well... I'd do this...
The directory structure will be like this...
gallery01/thumbs
gallery02/thumbs
gallery03/thumbs
gallery04/thumbs
And, there's got to be some sort of way you can choose which gallery the user wants to see... Something like a combo box would be good if you don't want to add additional picture menu for it...
When a certain gallery is selected, I'd set a variable like this...
selectedGallery = 1;
Then, the only script you need to change are these to accomodate the changed path...
_level0["box" + i].container.loadMovie("gallery0" + selectedGallery + "/thumbs/" + i + ".jpg");
_level0.containerMC.loadMovie("gallery0" + selectedGallery + "/pic"+level0.targNum+".jpg");
I thought maybe I'd have a blank mc in there with an onEnterFrame() function that checks for a change in variables and perform an action.
What do you mean and why would you want to do that??? Why don't you just leave it up to the user to select the pictures??? If I were you, I'd just get a chunk of image path data from the PHP file everytime gallery is changed... I won't leave that onEnterFrame unattended like that... ;)
Hope they are paying you good money for it... ;)
Hope they are paying you good money for it...
Working for friends = me poor. :( But it's the experience that counts, right? :p
Doesn't that mean that the swf (combo box) would have to be updated every week? It would be possible if I knew their schedule for the rest of the year. What they want is for someone to be able to click on a link that would have the format of "Walter Payton's Roundhouse 7/4/04". This would get the pics from Arra/Pics/WP directory or something like that. Then another link "Synergy" 7/11/04" would get the pics from Arra/Pics/Synergy.
I wanted to come up with a way that the swf doesn't have to be updated(manually) so they could manage their site themselves without my help. Know what I mean jellybean? Maybe I'm not following you. :confused:
Oh, btw, I got rid of those horrible pics of my home remodeling and replaced them with honeymoon pics instead. I figured as long as I'm experimenting, might as well let the friends and family have a look. :)
CyanBlue
07-14-2004, 05:09 AM
Nope... The combo box should be initialized with the data you get from the PHP file...
For example, you can return this extra string when the PHP file is called...
comboData=Walter Payton's Roundhouse 7/4/04|Gallery01~Somebody Else's Synergy 08/04/04|Gallery02~Whatever 09/05/04|Gallery03
That way, the value for comboData can be parsed and used to build the combo box, and the directory names(Gallery01, Gallery02) can be passed to read further information if necessary...
I am strongly against with your directory naming convention... You will get into more trouble if you let your customer name the directory whatever way they want... For example, they can use the quote or space in the directory name that might make the image file not loading and whatnots... Stick to simple naming convention like I have suggested and have your clients accustomed with it... (Same thing goes with the file name as well...)
The bottom line is that your should be able to pass the directory name to your PHP file so that it will read the image files form the given directory and return it to you so that you can display them properly in the Flash... and the PHP file should return the name of the directories as I have mentioned at least once in the Flash movie so that you can generate the combo box...
:)
Ok, I understand what you're saying now. It seems I have some research to do as I am pretty php illiterate. I'm still pretty confused as to how the different languages pass information back and forth to each other. Not so much on the flash side but the php. I just acquired a book on php a few days ago though so I better start reading.
Just so I'm clear, then the php file would have to be updated as more directories are generated, yes? My head hurts again.
I think I need to go to bed and think about his more in the AM. You're an hour ahead of us. What are you still doing up?! Go to bed so I can bug you some more in the morning. :D Thanks for your time CyanBLUE.
CyanBlue
07-14-2004, 01:59 PM
Um... Abit more on the PHP side... I do not mean that you have your PHP file updated every time directory has been made...
It'd be something like this...
#1. PHP script scans whole directory under the Arra directory and generates comboData... (This #1 gets executed only once for your user... Your user won't need to have this comboData refreshed all the time...)
#2. There's got to be a PHP function that scans directory and that directory name should be supplied from the Flash and if it is not supplied, then the first directory name that you have from the #1 should be used to generate the lists of the images in the directory...
Whenever your user selects comboBox to see the different gallery, you should only run #2 in PHP script to get the new data set for the next gallery...
See this component for abit better visualized gallery that goes with multiple galleries...
http://www.mr10.net/components/gallery/combobox/
#1. PHP script scans whole directory under the Arra directory and generates comboData... (This #1 gets executed only once for your user... Your user won't need to have this comboData refreshed all the time...)
Ok, I understand that the php script will scan the Arra directory and evrything in it, including the subdirectories that will be added weekly. This data will be retrieved using loadVars() object, right? This will update the comboData and dynamically add a directory(or gallery) to the drop down list?
#2. There's got to be a PHP function that scans directory and that directory name should be supplied from the Flash and if it is not supplied, then the first directory name that you have from the #1 should be used to generate the lists of the images in the directory...
Not sure I'm following this one. Within that same php file (or a different one?), there is a function that will execute, loading (by default) Gallery1 for instance, if nothing is picked from the combobox. So every time they add new pictures, these should go in to the Gallery1 directory so it loads by default. Then the following week, the pictures that were in Gallery1 would be removed and added to a different directory so the new pictures can be added to Gallery1? Sorry if I seem thick here. Please understand that I'm not familiar with the possibilities of php. I'm afraid I haven't acquired the logical programming sense that you have yet. :( If worse comes to worse, since I am getting paid, I may have to sub this portion (the php scripting) out to someone. That way, at least I can disect what they have done so the next time I can do it myself. It just seems like this will take a little while and a lot of frustration for me to pick up and actually get it functional by the time they want it.
Ah, forget what I said about subbin' this out. I'm determined to tackle this on my own. It would be nice to provide them with an interface that they login to with a password and let them update and upload things from there. After reading up on php, you can do a lot of pretty cool things with it like moving files, renaming directories and so forth. I just need to get my butt in gear here. :)
CyanBlue
07-15-2004, 04:37 AM
It looks like it's been 11 or 12 hours have passed since you posted your last reply... What's the progress??? ;)
Well, yesterday I was searching through some tutorials at codewalkers.com, weberdev.net and php.net. didn't get anything to work yet, but I did manage to shorten the first one I used though. I can't figure out how to count JUST the folders in a specific directory. I'm still trying to get a handle on AS. Php is a whole other animal. :)
I was also trying to figure out how to update the paths in the for loop, 'cause once they're loaded, they don't change. That's why I was talking about using onEnterFrame() the other day. So I created a couple functions. Just need to dynamically generate some buttons (or a combobox to call em).
So here's what I came up with yesterday. It's a little different because I don't have php installed on my comp. I'll just have to update it with the loadVars().
num = 26;
thumbs = "thumbs1";
pics = "Pics1";
changeGallery = function ()
{
nums = num;
numColumns = 6;
cnt = 1;
startX = 50;
startY = 10;
for (i = 1; i <= nums; i++)
{
this.attachMovie ("box", "box" + i, i, {_x:startX, _y:startY});
this["box" + i].container.loadMovie ("Arra/" + [thumbs] + "/" + [i] + ".jpg");
this["box" + i].targNum = i;
this["box" + i].onRelease = function ()
{
_root.containerMC.loadPic ("Arra/" + [pics] + "/pic" + this.targNum + ".jpg");
};
this["box" + i].onRollOver = function ()
{
this.gotoAndPlay ("play");
};
startX = (cnt % numColumns == 0) ? 50 : startX + _level0["box" + i]._width + 5;
startY = (cnt % numColumns == 0) ? startY + _level0["box" + i]._height + 5 : startY;
cnt++;
}
};
changeGallery ();
spacing = 10;
containerMC._alpha = 0;
MovieClip.prototype.loadPic = function (pic)
{
containerMC._alpha = 0;
this.loadMovie (pic);
_root.onEnterFrame = function ()
{
var t = containerMC.getBytesTotal (), l = containerMC.getBytesLoaded ();
bar._visible = 1;
per = Math.round ((l / t) * 100);
if (t != 0 && Math.round (l / t) == 1 && containerMC._width != 0)
{
var w = containerMC._width + spacing, h = containerMC._height + spacing;
border.resizeMe (w, h);
bar._visible = 0;
loadText.text = "";
delete _root.onEnterFrame;
} else
{
bar._width = per;
//gives the bar a max width 100
loadText.text = per + " % loaded";
}
};
};
MovieClip.prototype.resizeMe = function (w, h)
{
var speed = 3;
this.onEnterFrame = function ()
{
_root.border._width += (w - this._width) / speed;
this._height += (h - this._height) / speed;
if (Math.abs (this._width - w) < 1 && Math.abs (this._height - h) < 1)
{
this._width = w;
this._height = h;
_root.containerMC._x = this._x - this._width / 2 + spacing / 2;
_root.containerMC._y = this._y - this._height / 2 + spacing / 2;
_root.containerMC._alpha += 9;
if (_root.containerMC._alpha > 90)
{
_root.containerMC._alpha = 100;
delete this.onEnterFrame;
}
}
};
};
removeMC = function ()
{
for (i = 1; i <= nums; i++)
{
_level0["box" + i].removeMovieClip ();
}
num = nof;
changeGallery ();
};
_root.containerMC.loadPic ("Arra/" + [pics] + "/pic1.jpg");
on button:
on (release) {
_root.thumbs = "thumbs2";
_root.pics = "Pics2";
_root.containerMC.loadPic ("Arra/" + [_root.pics] + "/pic1.jpg");
_root.nof = 10;
_root.removeMC ();
}
I'll be out of the office today, so if you reply, I can't get back till later. Just don't want you to think I'm ignoring you. :D
CyanBlue
07-15-2004, 01:53 PM
(Please delete the duplicate... It's confusing... :D)
Well... I am not really going to comment on your codes... You had working code and you should know what to fix if there is any problem... ;)
I was just thinking if it is really necessary to permit the use of the sub directories within the directory because it will only cause you more trouble, which it sounds like you are already having one, and I think it'd be best if you just ignore what's in the sub directory and let your client know that he's not supposed to use one... That'll make your life whole lot easier... ;)
I don't think subbing the project is really necessary because I think you are about 80% there to finish the job and there is no point of subbing it to somebody else when it can be a perfect learning opportunity for you, as you have mentioned of course...
Anyways... Keep us posted with the progress... (I'm sorta busy with the projects at work and I don't have time to visit the AS.org as often as I used to... :()
Now wait a minute! It sounds to me like you may be implying that there is a little something wrong here or I'm doing something silly (which may very well be the case. My brain works strangely sometimes). :D If there is and you have a suggestion, by all means share. :p
I was just thinking if it is really necessary to permit the use of the sub directories within the directory because it will only cause you more trouble, which it sounds like you are already having one, and I think it'd be best if you just ignore what's in the sub directory and let your client know that he's not supposed to use one... That'll make your life whole lot easier...
Now I'm confused. How would I distinguish photos from different show dates if they don't utilize subdirectories? :confused: What I was thinking about doing was have another for loop that dynamically creates a number of buttons based on the number of subdirectories there are (if I could only get that to work. It should be very similar to the one I'm using to count the files in the directory.) When these are created, they will have an onRelease() function, something like dir = "Arra/thumbs"+[j] which will be sent to the file-counting "thumbcounter.php". Does this sound convoluted to you?
Anyways, the script I have above works (link below). I just need to change it to fit my master(and I use the term lightly) plan. :D
gallery (http://www.thezplane.com/test2.htm)
(I'm sorta busy with the projects at work and I don't have time to visit the AS.org as often as I used to...
I hear ya. I just got assigned 4 projects that need to be engineered by the time I go on vaction (7/26). I'm PMing them as well. I see a lot of long days ahead. :(
Well, I've had absolutely no success whatsoever. This is what I got and I don't know what else to do at this point. When it loads, it only loads 9 clips. There are 26 in the opening directory. When I hit the first button then the 26 load. But only if I hit the first button first. If I hit either of the other 2, nothing happens. Here's the as if you care to look CyanBlue. (or anyone else) I took out the irrelevant code for easier reading.
dirchange = "thumbs1";
thumbs = "thumbs1";
pics = "pics1";
loadVariablesNum ("thumbcounter.php", 0, "POST");
changeGallery = function ()
{
count_lv = new LoadVars ();
count_lv.onLoad = function (ok)
{
if (ok)
{
numColumns = 5;
cnt = 1;
startX = 20;
startY = 20;
trace (unescape (this));
_level0.testtext.text = this.nof;
for (i = 1; i <= parseInt (this.nof); i++)
{
mc = _level0.attachMovie ("box", "box" + i, i, {_x:startX, _y:startY});
_level0["box" + i].container.loadMovie ("Arra/" + [thumbs] + "/" + [i] + ".jpg");
_level0["box" + i].targNum = i;
_level0["box" + i].onRelease = function ()
{
_level0.containerMC.loadMovie ("Arra/" + [pics] + "/pic" + this.targNum + ".jpg");
};
_level0["box" + i].onRollOver = function ()
{
this.gotoAndPlay ("play");
};
startX = (cnt % numColumns == 0) ? 20 : startX + _level0["box" + i]._width + 5;
startY = (cnt % numColumns == 0) ? startY + _level0["box" + i]._height + 5 : startY;
cnt++;
}
}
};
count_lv.load ("thumbcounter.php");
};
changeGallery ();
removeMC = function ()
{
for (i = 1; i <= nof; i++)
{
_level0["box" + i].removeMovieClip ();
}
changeGallery ();
};
_root.containerMC.loadPic ("Arra/" + [pics] + "/pic1.jpg");
On the buttons 1,2,&3 (dirchange changes respectively):
on (release) {
_root.containerMC.loadPic ("Arra/" + [_root.pics] + "/pic1.jpg");
_root.dirchange = "thumbs2";
loadVariablesNum ("thumbcounter.php", 0, "POST");
_root.removeMC ();
}
<?php
$count = 0;
$dir = "Arra/$dirchange";
if (is_dir($dir)){
if ($dh = opendir($dir)){
while (($filename = readdir($dh)) !== false) {
if (($filename != ".") && ($filename != ".."))
{
$count ++;
}
}
closedir($dh);
}
}
print "&nof=".$count;
?>
Any advise would be greatly appreciated. :rolleyes:
CyanBlue
07-16-2004, 01:28 PM
Now wait a minute! It sounds to me like you may be implying that there is a little something wrong here or I'm doing something silly
Uh... No... I didn't see you saying if there is problem with the code or not, so I thought that you posted your code so that other people can use it later on... That's all... :)
How would I distinguish photos from different show dates if they don't utilize subdirectories?
I guess there is some confusion... I thought that I'd make one gallery out of one show... I mean one galley contains all the pictures from one show and another gallery has pictures from different show... That way you are getting rid of the need of the sub directories... That's what I meant... :)
I just got assigned 4 projects that need to be engineered by the time I go on vaction (7/26). I'm PMing them as well. I see a lot of long days ahead.
That doesn't sound good... Hope the projects are not the big ones... :(
As for the code... I thought that I've told you to remove loadVariables() function from your memory and I see that you are still using it... :D
I don't think that has anything to do with the problem you are having right now... But I fail to see what might be causing it... Can you make simple sample with PHP and image files and post it??? That's got to be quicker way to fix the problem... (if I can come back to AS.org again later on, of course...)
I thought that I've told you to remove loadVariables() function from your memory and I see that you are still using it...
Ionly used it 'cause it was getting late and I know it worked for my form email. I was goin to use loadVars.send() but didn't want to cause more problems with something new to me.
Here's the link to a zip with everything in it. If it's too big for you I can upload a smaller version later. I appreciate you taking the time to help me out.
http://www.thezplane.com/New3.zip
CyanBlue
07-16-2004, 03:30 PM
Well... Not much time at the moment, but here is some run down on what you have... Not sure if you will like the change or not... :D
This is the script for the frame 1... (prototypes are omitted...)
dirchange = "thumbs1";
thumbs = "thumbs1";
pics = "pics1";
spacing = 10;
containerMC._alpha = 0;
//loadVariablesNum ("thumbcounter.php", 0, "POST");
init_lv = new LoadVars();
init_lv.dirchange = dirchange;
init_lv.thumbs = thumbs;
init_lv.pics = pics;
init_lv.onLoad = function (ok)
{
if (ok)
{
trace(unescape(this));
trace("this.thumbs = " + this.thumbs);
changeGallery(this.dirchange, this.thumbs, this.pics);
}
else
{
trace("Error!!!");
}
}
init_lv.sendAndLoad("http://localhost/vman/New3/thumbcounter.php", init_lv, "POST");
changeGallery = function (argDir, argThumbs, argPics)
{
trace("Function changeGallery : argDir = " + argDir + " argThumbs = " + argThumbs + " argPics = " + argPics);
count_lv = new LoadVars ();
count_lv.dirchange = argDir;
count_lv.thumbs = argThumbs;
count_lv.pics = argPics;
count_lv.onLoad = function (ok)
{
if (ok)
{
removeMC();
numColumns = 5;
cnt = 1;
startX = 20;
startY = 20;
trace (unescape (this));
_level0.testtext.text = this.nof;
for (i = 1; i <= parseInt (this.nof); i++)
{
mc = _level0.attachMovie ("box", "box" + i, i, {_x:startX, _y:startY});
_level0["box" + i].container.loadMovie ("Arra/" + argThumbs + "/" + [i] + ".jpg");
_level0["box" + i].targNum = i;
_level0["box" + i].onRelease = function ()
{
_level0.containerMC.loadPic ("Arra/" + argPics + "/pic" + this.targNum + ".jpg");
};
_level0["box" + i].onRollOver = function ()
{
this.gotoAndPlay ("play");
};
startX = (cnt % numColumns == 0) ? 20 : startX + _level0["box" + i]._width + 5;
startY = (cnt % numColumns == 0) ? startY + _level0["box" + i]._height + 5 : startY;
cnt++;
}
_root.containerMC.loadPic ("Arra/" + argPics + "/pic1.jpg");
}
};
count_lv.sendAndLoad("http://localhost/vman/New3/thumbcounter.php", count_lv, "POST");
};
removeMC = function ()
{
for (i = 1; i <= nof; i++)
{
_level0["box" + i].removeMovieClip ();
}
// changeGallery ();
};
The script for button 1...
on (release) {
// _root.containerMC.loadPic ("Arra/" + [_root.pics] + "/pic1.jpg");
// _root.dirchange = "thumbs1";
// loadVariablesNum ("thumbcounter.php", 0, "POST");
// _root.removeMC ();
this.dirchange = "thumbs1";
this.thumbs = "thumbs1";
this.pics = "pic1";
_root.changeGallery(this.dirchange, this.thumbs, this.pics);
}
for button 2...
on (release) {
this.dirchange = "thumbs2";
this.thumbs = "thumbs2";
this.pics = "pic2";
_root.changeGallery(this.dirchange, this.thumbs, this.pics);
}
for button 3...
on (release) {
this.dirchange = "thumbs3";
this.thumbs = "thumbs3";
this.pics = "pic3";
_root.changeGallery(this.dirchange, this.thumbs, this.pics);
}
Not sure why you have dirchange and thumbs but I didn't change anything in there...
The PHP file...
<?php
$count = 0;
if (!isset($dirchange))
{
$dirchange = "";
}
$dir = "Arra/$dirchange";
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($filename = readdir($dh)) !== false)
{
if (($filename != ".") && ($filename != ".."))
{
$count ++;
}
}
closedir($dh);
}
}
print "&nof=".$count;
?>
I can see that you are missing the part where you read the file names and return it back, so that part is omitted on my interpretation as well...
Hopefully that'll get you going abit further... ;)
Cyan Blue, Thanks a bunch for taking the time to help me again. I can't really do anything while I'm swamped at work, but I'll take a look and try to figure out what you have done as soon as I get home this evening.
Not sure why you have dirchange and thumbs but I didn't change anything in there... Not sure what you mean by this?
I can see that you are missing the part where you read the file names and return it back, so that part is omitted on my interpretation as well...
Not really concerned with the file names since they are specified in the changeGallery for loop right? I just need to count them, right?
CyanBlue
07-16-2004, 04:52 PM
Well... That means that I can go back to my work as well... :D
Not sure what you mean by this?
Oh... I just said that because you have the same value assigned to both variables... Tell me why you have created the variable dirchange for and what the thumbs is for... :)
Not really concerned with the file names since they are specified in the changeGallery for loop right? I just need to count them, right?
Um... I don't think that is the case...
How do I know what the thumbnail file name is and the file name to load in is???
You used to have the 'print "&path".$countervar."=".$dir."/".$file;' in your PHP file but you don't anymore... How will Flash know what the file name to load is??? Know what I mean??? ;)
I thought that by sending
_root.dirchange = "thumbs3";
(form my original file) to the php form that
$dir = "Arra/$dirchange";
would then be
$dir = "Arra/thumbs3";
How do I know what the thumbnail file name is and the file name to load in is???
by this
dirchange = "thumbs1";
thumbs = "thumbs1";
pics = "pics1";
loadVariablesNum ("thumbcounter.php", 0, "POST");
and this
_level0["box" + i].container.loadMovie ("Arra/" + [thumbs] + "/" + [i] + ".jpg");
_level0["box" + i].targNum = i;
_level0["box" + i].onRelease = function ()
{
_level0.containerMC.loadPic ("Arra/" + [pics] + "/pic" + this.targNum + ".jpg");
};
Or at least I thought :confused:
CyanBlue
07-16-2004, 06:14 PM
by this
dirchange = "thumbs1";
thumbs = "thumbs1";
pics = "pics1";
loadVariablesNum ("thumbcounter.php", 0, "POST");
and this
_level0["box" + i].container.loadMovie ("Arra/" + [thumbs] + "/" + [i] + ".jpg");
_level0["box" + i].targNum = i;
_level0["box" + i].onRelease = function ()
{
_level0.containerMC.loadPic ("Arra/" + [pics] + "/pic" + this.targNum + ".jpg");
};
Or at least I thought :confused:Okay... Here is my question... I know that you 'know' that the file name is for the images that need to be loaded... (pics = "pics1";)
But you are making a program that does not need your help to create this image gallery that your client can upload the images and the image gallery updates automatically...
In other words, the value of that variable for galleryx can be 'whatever1' or 'none1'... And there is no guarantee that the file name will be in the sequence as you have right now... Well... You could tell them to make the file name to be in that rule but it all depends on the file your client upload and how smart your client is, right??? :)
That's why you need to get the the file names loaded initially so that you can display them properly...
Yeah, I guess I should have explained my thought process to you. I was planning on telling the client that he has to maintain a naming convention for the files eg. pic1.jpg, pic2.jpg, etc. for the pictures and 1.jpg, 2.jpg, etc. for the thumbs. Same goes for the directories. Arra/pics1, Arra/pics2 and so on. Arra/thumbs1, Arra/thumb2, etc.
I was using this
dirchange = "thumbs1";
thumbs = "thumbs1";
pics = "pics1";
loadVariablesNum ("thumbcounter.php", 0, "POST");
to specify the initial directory to go to.
from php:
$dir = "Arra/$dirchange";
Then, when they click a button, the $dirchange variable in the php will become "thumbs2" or "thumbs3" or whatever, thus having the files from those directories get called up in the for loop.
on (release) {
_root.containerMC.loadPic ("Arra/" + [_root.pics] + "/pic1.jpg");
_root.dirchange = "thumbs2";
loadVariablesNum ("thumbcounter.php", 0, "POST");
_root.removeMC ();
} {
I guess I was trying to make it easier on myself with my lack of php knowledge (and Flash for that matter) :D
I don't think it matters what order the files load in. As long as "thumbs1/1.jpg" corresponds with "pics1/pic1.jpg" the [i] will do the rest, right? It didn't seem like a whole lot to ask of the client.
Remember when I said that my logical programming sense wasn't as good as yours. Well....
CyanBlue
07-16-2004, 07:20 PM
Um... Did anybody say mine is good??? I don't think that is true...
Anyways... Try that and see how it goes... and that's when you tell us where you are at... There isn't much thing coming out if you are not in front of the code and wetting your fingers... So, stop think about that and start working on your projects... You can always take care of the project when you get home... ;)
Yeah, good idea. What I just explained to you is where I was at yesterday with nothing working. So I'll use the previous php code that printed the $filename and try the code you posted. The less I have to rely on the client, the better. I'm determined to get this working by the time I go to the Cubs game tomorrow (fat chance). Is your hotline open on Friday evenings? :p Just kidding.
CyanBlue
07-16-2004, 07:53 PM
So, basically you won't be able to make the Cubs game if you can't get the image gallery working, right??? :)
Hm... Come to think of it, I've never been to the baseball game while I was living in Chicago... Sad... :(
So, basically you won't be able to make the Cubs game if you can't get the image gallery working, right???
Don't think so. My computer may be out the window tonight (by my wife's hands). My problem is that I obsess about these things and I don't give up until I get something working. My wife is ready to kill me. She'll come into my office and talk to me and I don't hear a word she's saying. She quizzez me too! :D "What'd I just say?" . No clue. I've been at this for a few days now and she doesn't get it. Can't say I blame her. :p
Never was at a Cubs game, huh? That is sad. Nothing like good ol' Wrigley field. I haven't been to one in years. I'm making a point to go to at least a couple games this year. Although I'll probably have AS on my mind the whole time. :rolleyes:
CyanBlue
07-16-2004, 08:49 PM
Oh, I've been around that place more than I should...
Lotcha good restaurants around that place... :)
One thing you can do, which I was not able to make it happen yet, is to teach your wife how to Flash... Um... Doesn't sound good... How to talk ActionScript... That's better... How's that??? :D
For me when you've lived here as long as I have, you take it for granted. I harldy ever go into the city anymore.
One thing you can do, which I was not able to make it happen yet, is to teach your wife how to Flash... Um... Doesn't sound good... How to talk ActionScript... That's better... How's that???
Never, ever, EVER gonna happen! :D
Hey I couldn't wait and I tried your code. It loads the thumbs from the different directories, but the removeMC() doesn't work. It didn't work for me yesterday either. It's weird, because the code from post #38 did. It's the same. Also, when the initial gallery loads, all of the corresponding pics load as well. When you click on the 2nd button, it should load 10 pics of my bike. The the other 16 from the 1st gallery remain and are the only ones that work. The 3rd buttons hoses everything. Check it out if you like.
http://www.thezplane.com/test/new.htm
BTW, I believe I have learned a little something from your examples. Thanks.
CyanBlue
07-16-2004, 09:58 PM
Um... I am not sure what's going on in there but I am sure you should be able to figure it out... The reason why, I think, the removeMC() function is not working is because the value of nof in the for loop is not defined when you run it... (which will be done quick when you do that with the LoadVars() object...)
See if you can pull it out and let me know how it goes... and post the sample if you have problem... I've got lots of things to do at home over the weekend even though I'd love to do Flash all day long... But if my wife will probably kick me out if I ever do that... I'll see if I can sneak in from time to time... :D
You bet. Enjoy your weekend! I'll try working this out on my own. You've given me quite a bit of material to work with, so hopefully I can sort through it. Thanks again. :)
Well,
1:15 AM here and I finally got it working. Added this to the for loop:
for (i=1; i<=parseInt(this.nof); i++) {
_root.remClip = i;
And this to the removeMC()
removeMC = function () {
for (i=1; i<=remClip; i++) {
_level0["box"+i].removeMovieClip();
}
Thought of that on the way home from work. That was easy. ;) The rest was spent just me being an idiot. Well, I just installed Apache server and php on my machine at home. So I'm just getting familiar with running a localhost. You know in your example
init_lv.sendAndLoad("http://localhost/vman/New3/thumbcounter.php", init_lv, "POST");
Well, I deleted everything before thumbcounter.php. I didn't know you had to include the whole path. I thought it would work the same way it would on my Web hosts server. Just include the rest of the path from where it's currently located. Everything was exactly the same as I had uploaded and I couldn't for the life of me figure out what the deal was. :( So I do a phpinfo to see what version of php I've got and it turns out to be a few versions older than what my hosting service has. So I figure maybe you used something in the php code that my version didn't like. So I download the latest version of php and install it (manually), which is a pain in the *ss in itself. After all that it STILL didn't work. :mad: Then about 11:30 or so, after looking through the same code about 1000 times over, something finally made me try using the whole path and voila. FINALLY! :D It still wasn't perfect so it tokk me a little while to figure out that I had to move
containerMC._alpha = 0;
back into the prototype. Moved a few other things around that weren't quite in the right spot and here I am.
Now all I have to do is dynamically create the buttons based on how many directories there are and some dynamic text and put the buttons and thumbs in a MC so they move with the width of the border and it's done. The rest should be easier I think. :D
Here it is if you want a peek
http://www.thezplane.com/test/new.htm
Thanks again for all of your help with this and all the other times. I'm gonna have to put you on my Christmas list and send a little something to your office. :) Have a great weekend! (now I can go to see the Cubbies)
Not sure why you have dirchange and thumbs but I didn't change anything in there...
You're right. That was redundant. I got rid of dirchange. :)
CyanBlue
07-17-2004, 08:22 PM
Hey, man... It's nice... Good job... So, you probably are in the ball game... Good for you... :)
As for the full path in the PHP call... It's wise thing not to add any path within the sendAndLoad() function so that you don't have to do anything when you move around from one host to another... I just used the full path so that I can test it from the Flash itself... But that's not really a good way to take care of things... You need to test it from the web browser because there is going to be some problem if you test it from the Flash...
Creating the gallery buttons will be probably the same thing as you did with the thumbnail buttons... So, that's not much of an issue...
Good job... :)
Thanks Cyan Blue. It's still not much to look at, but it's functional. Still got quite a bit to do on it. I changed the for loop that loads the thumbs to an onEnterFrame so they load one at a time and not all at once. I put them in a MC so they now move with the border as it resizes. Tonight I'm working on creating a mask and scroller w/buttons so that the thumbs won't extend beyond the height of the border. So far so good. You'll be the first to know if I run into a road block. :p Ran into a few so far, but it's more gratifying to figure the stuff out by myself instead of posting right away. ;)
I just used the full path so that I can test it from the Flash itself Yeah, I just didn't know you had to include the whole path to do this. I installed php for exactly this reason. So I wouldn't have to upload every time to test. Oh well, live and learn. :)
Cubbies won! Yeah! :D
CyanBlue
07-19-2004, 01:06 AM
Hey... Sounds like you are on the right track... Glad to hear that... :)
As for the PHP... It's all good to test the script on the localhost but you do need to test the same thing from time to time on the host where your movie will be hosted permanently... Especially it is important if you are on IIS at home yet Apache is running on the host and so much more cases... Don't cry when your project is fully done and when you're supposed to go on vacation yesterday... :D
Well, here's where I stand right now. Gotta go to sleep now. Been trying for hours to figure out a problem with the scrolling. If you're in the first gallery and you scroll down to the bottom, then you click on the 2nd gallery(the middle one), I can't figure out how to reset the scroller. Oh, well tomorrows another day. :rolleyes:
http://www.thezplane.com/test/new.htm
CyanBlue
07-19-2004, 01:45 PM
Tomorrow's another day... That's the spirit... :)
Looking better and better... The scroller is very minor job to do once you are this far... and it isn't that hard... Get this job done soon so that you will have more time for another projects... and enjoy your vacation... ;)
Well, I I'm not leaving till Sunday. This week at work is going to be tough. Gotta get as much done as possible before I leave.
The scroller is very minor job to do once you are this far... and it isn't that hard
Maybe for you my friend! I was at it for a while yesterday. Had it close. I think I just have to get the y value of the dragger to 0 before I call the changeGallery function. Anyways, have a great Monday. :)
CyanBlue
07-19-2004, 03:02 PM
Well... What I had before was... (I am sure it has to be pretty much the same in your case as well...)
Get the number of rows that thumbnails will be...
Check if it is bigger than the maximum number of lines that I can house in the screen...
Add the scroller if it is necessary... (Now, you know how much you can scroll from the previous numbers...)
That's pretty much of the whole process... ^___^
Anyways... Take some more stab at it and you should be able to get it working... ;)
That's pretty much what I'm doing. I have this for my scrolling AS:
targY = 0;
dragger._x = theMask._x-5;
dragger.onPress = function() {
startDrag(this, false, this._x, 0, this._x, (_root.border._height)-this._height);
};
dragger.onRelease = dragger.onReleaseOutside=function () {
stopDrag();
};
thumbScroller.onEnterFrame = function() {
if (this._height<_root.border._height) {
dragger._visible = false;
} else {
dragger._visible = true;
scrollAmount = (this._height-(_root.thumbFrame._height)/1.05)/(_root.thumbFrame._height-dragger._height);
targY = -dragger._y*scrollAmount;
this._y -= (this._y-targY)/5;
}
};
The MC that the thumbs are created in are actually inside the scrolling MC now. To get this to work I changed my removeMC () to this:
removeMC = function () {
thumbMC.swapDepths(1048000);
thumbMC.removeMovieClip();
};
Seems like not the best wat to do it. But I'm not sure what else to do. It seems pretty stable. Check the link again and tell me what you think.
This is everything on frame 1 now. If you have any spare time to chaeck it out, let me know if you spot anything that seems messed up or just bad scripting. (It's alot to look at)
thumbs = "thumbs1";
pics = "pics1";
spacing = 10;
thumbFrame._visible = false;
init_lv = new LoadVars();
init_lv.thumbs = thumbs;
init_lv.pics = pics;
init_lv.onLoad = function(ok) {
if (ok) {
trace(unescape(this));
trace("this.thumbs = "+this.thumbs);
changeGallery(this.thumbs, this.pics);
} else {
trace("Error!!!");
}
};
init_lv.sendAndLoad("thumbcounter.php", init_lv, "POST");
changeGallery = function (argThumbs, argPics) {
trace("Function changeGallery : argThumbs = "+argThumbs+" argPics = "+argPics);
count_lv = new LoadVars();
count_lv.thumbs = argThumbs;
count_lv.pics = argPics;
count_lv.onLoad = function(ok) {
if (ok) {
removeMC();
i = 0;
numColumns = 3;
cnt = 1;
startX = 0;
startY = 0;
trace(unescape(this));
_level0.testtext.text = this.nof;
_root.attachMovie("thumbhold", "thumbMC", 0);
thumbMC._visible = false;
thumbMC._x = -1;
thumbMC._y = -2;
thumbMC.thumbScroller.thumbHolder.onEnterFrame = function() {
i++;
if (i<=parseInt(_root.count_lv.nof)) {
_root.remClip = i;
this.attachMovie("box", "box"+i, i, {_x:startX, _y:startY});
this["box"+i].container.loadMovie("Arra/"+argThumbs+"/"+[i]+".jpg");
this["box"+i].targNum = i;
this["box"+i].onRelease = function() {
containerMC.loadPic("Arra/"+argPics+"/pic"+this.targNum+".jpg");
};
this["box"+i].onRollOver = function() {
this.gotoAndPlay("play");
};
startX = (cnt%numColumns == 0) ? 0 : startX+this["box"+i]._width+5;
startY = (cnt%numColumns == 0) ? startY+this["box"+i]._height+5 : startY;
cnt++;
if (i == parseInt(count_lv.nof)) {
delete this.onEnterFrame;
}
}
};
}
};
count_lv.sendAndLoad("thumbcounter.php", count_lv, "POST");
containerMC.loadPic("Arra/"+argPics+"/pic1.jpg");
};
MovieClip.prototype.loadPic = function(pic) {
containerMC._alpha = 0;
this.loadMovie(pic);
_root.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
bar._visible = 1;
per = Math.round((l/t)*100);
if (t != 0 && Math.round(l/t) == 1 && containerMC._width != 0) {
var w = containerMC._width+spacing, h = containerMC._height+spacing;
border.resizeMe(w, h);
bar._visible = 0;
loadText.text = "";
delete _root.onEnterFrame;
} else {
bar._width = per;
loadText.text = per+" % loaded";
}
};
};
MovieClip.prototype.resizeMe = function(w, h) {
var speed = 3;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
thumbMC._visible = true;
thumbFrame._visible = true;
thumbFrame._x = (this._x-(this._width/2));
thumbFrame._y = (this._y-(this._height/2));
thumbFrame._height = this._height;
thumbFrame._width = 203;
thumbMC._x = (this._x-(this._width/2)-(thumbMC.thumbScroller.thumbHolder._width)-5);
thumbMC._y = (this._y-this._height/2);
if (_root.thumbMC.dragger._y>=_root.thumbFrame._height || this._width<this._height) {
_root.thumbMC.dragger._y = _root.thumbFrame._height-_root.thumbMC.dragger._height;
}
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
this._width = w;
this._height = h;
containerMC._x = this._x-this._width/2+spacing/2;
containerMC._y = this._y-this._height/2+spacing/2;
containerMC._alpha += 9;
if (containerMC._alpha>96) {
containerMC._alpha = 100;
delete this.onEnterFrame;
}
}
};
};
removeMC = function () {
thumbMC.swapDepths(1048000);
thumbMC.removeMovieClip();
};
Thanks as always CyanBlue
CyanBlue
07-19-2004, 08:27 PM
me == too lazy and the code look whole lot harder to look at... Please post the file if you can so that I can take a look... That's got to be whole lot easier and faster... ;)
You know what I noticed that I find strange is that when the thumbs load, the first row loads from right to left and each row after that loads left to right. Funny since the startX and startY are both 0. :confused:
CyanBlue
07-20-2004, 02:14 AM
You totally got me on that part... It looks like it's got to work alright... :(
Weird, huh? Did you notice it? My comp at work is a real dog so it was plain as day. With a good CPU you can't really tell. It bothers me a little bit, but I'm not gonna lose any sleep over it....well....maybe a little.
Got my gallery changing buttons to load dynamically! WooHoo! Just gotta get 'em to do something now. Should be an hour or so. I'll be back!
CyanBlue
07-20-2004, 04:14 AM
Yeah... I was able to see what yuo really meant when I tried it at home... But then, it's very minor thing that won't really bother anybody... You've got to spend more time on the scroller than that one... :)
You think the scroller is that messed up?
CyanBlue
07-20-2004, 04:21 AM
Uh... That I wouldn't know because I have not seen the working scroller yet... :D
Yet, I get to see the thumbnails loaded just fine now... I guess that's because the images are in the cache right now... Now, go back to the scroller and have it done... :)
You can see the scroller working here
http://www.thezplane.com/test/test2.swf
It gets a little buggy once in a while. When I was doing it, it just didn't seem like the right way to do it. It works but not that well. I just don't know how to do it with a window that resizes. I got rid of the onEnterFrame for the loading of the thumbs and went back to a for loop. That was causing problems too I think. I've about had it with this whole thing.
CyanBlue
07-20-2004, 02:58 PM
A scroller still is not working... Or, I don't know how to press button... :D
The menu look very nice... It'd be great if you could have it disappear when it is not needed... Rather than that, it looks great... ;)
binkyboo
07-20-2004, 03:35 PM
The scroller is a little deceiving since it’s not clear that it’s draggable. I did the same thing and tried clicking the up and down arrows.
By the way this was/is an excellent thread. I’ve learned a lot from it! Thank you both!!
CyanBlue
07-20-2004, 03:40 PM
DRAGGABLE scroller??? DOH!!! No wonder it wasn't working when I was keep pressing the button... You just made me really dumb, binkyboo... :(
(How's it going, by the way??? :))
Now, when that's done and when your vacation is over(I know you don't want to hear that, Vman...), start working on the PHP script that can generate the thumbnail from the image files... That'd be the last request that I will be placing... ;)
It's getting close to being finished. Sometimes when I click on the buttons to change the galleries, the thumbs will load incorrectly, meaning that the second column's _x value will = the left border.
Oh, BTW, I changed the link so that's maybe why it wasn't working. Try this
http://www.thezplane.com/test/test2.swf
Can you guys, if you have some spare time, just beat the crap out of it...you, just click and drag and tell me some of the bugs you experience?
CyanBlue, did you by any chance see the code for the scroller I sent yesterday? Did it look screwed up?
Now, when that's done and when your vacation is over(I know you don't want to hear that, Vman...), start working on the PHP script that can generate the thumbnail from the image files... That'd be the last request that I will be placing...
Heck, I would have done that for this one. Wouldn't it take for ever for the thumbs to load though? It would still be loading the full file size of the image would't it?
All in all, this has been a pretty good learning experience for me the novice.
By the way this was/is an excellent thread. I’ve learned a lot from it! Thank you both!!
This has been a great thread, especially for me. :D I'm surprised that there weren't more participants. CyanBlue has been awesome (can't thank you enough for the help).
CyanBlue
07-20-2004, 04:22 PM
Can you guys, if you have some spare time, just beat the crap out of it...you, just click and drag and tell me some of the bugs you experience?
It looks okay to me... The only one that I see is several empty drop down menus which should not be there if you have no image in the directory...
CyanBlue, did you by any chance see the code for the scroller I sent yesterday? Did it look screwed up?
The code looked okay to me... The only thing that bugged me was the onEnterFrame on that specific code, but I believe you got rid of it, right???
Heck, I would have done that for this one. Wouldn't it take for ever for the thumbs to load though? It would still be loading the full file size of the image would't it?
Uh... PHP file reads the directory and there is an image file called image01.jpg and there is no thumbnail file, so PHP creates image01_tn.jpg in the appropriate directory, and Flash loads that image01_tn.jpg file for the thumbnail file not the image01.jpg... It's pretty straight forward process and the code to do it is pretty much in the PHP manual already... (I know that because that's what and how I did before...)
This has been a great thread, especially for me. I'm surprised that there weren't more participants.
Well... I am sure you will get lots of questions sooner or later... The image gallery is one of the most famous thing people want to add... What about some tutorial??? I think you should be able to make one if you stay at home over your vacation period... :D
CyanBlue has been awesome (can't thank you enough for the help).
Well... You're the one who did all the job... Cheers... :)
It looks okay to me... The only one that I see is several empty drop down menus which should not be there if you have no image in the directory...
I just added empty folders to the /Arra directory so there would be more than 3 buttons. :p I have a separate php file that counts the files in this directory.
The code looked okay to me... The only thing that bugged me was the onEnterFrame on that specific code, but I believe you got rid of it, right???
Actually, I put it back in, but I'm going to take it out again and change to the for loop. I don't like it either and I think it's causing problems somewhere.
As far as the php creating the thumbnail goes, wouldn't it keep the same proportions of the image, just scaled down? If that's the case then my grid wouldn't look to nice (if the images are different sizes). Or if it scales them to a specific width and height, then they would be distorted, right? Maybe I'm not following you.
What about some tutorial??? I think you should be able to make one if you stay at home over your vacation period...
Well, I would love to be able to contribute a tutorial for this. Unfortunately, this whole project is a compilation of stuff I picked up from different threads from here and Kirupa.com. And there are 1 or 2 bits of code in here that I'm having a hard time following. Some of which is yours :p . Therefore, I'd be afraid of doing more harm than good! :D
As this whole thing stands right now, all the client has to do is scale and optimize the photos for the Web and create thumbnails from these. Both of which I have created droplets for (Adobe ImageReady). Then he has to do a batch rename and upload. The whole process takes like 2 minutes. Oh, and add a variable/string to the php for the text on the buttons. Do you think that's scary? :D Maybe I should jut do that for them. :p
CyanBlue
07-20-2004, 04:58 PM
I just added empty folders to the /Arra directory so there would be more than 3 buttons. I have a separate php file that counts the files in this directory.
Yeah... That's what I thought... You just need a routine that checks if the directory is empty or not so that you can decide whether you will display the drop down menu...
Actually, I put it back in, but I'm going to take it out again and change to the for loop. I don't like it either and I think it's causing problems somewhere.
Um... Make it onMouseMove at least... That's whole lot better than onEnterFrame... :D
As far as the php creating the thumbnail goes, wouldn't it keep the same proportions of the image, just scaled down? If that's the case then my grid wouldn't look to nice. Or if it scales them to a specific width and height, then they would be distorted, right? Maybe I'm not following you.
It's your choide whether you crop the full image to create the thumbnail image or just resize it... That's your option when you want to create the thumbnail images via PHP... But don't go too much in there... Be pelased where you are at and you should be able to get paid with no problem... and attach that when you have some more time after the vacation... What you have with the ImageReady should do the trick for them... ;)
Well, I would love to be able to contribute a tutorial for this. Unfortunately, this whole project is a compilation of stuff I picked up from different threads from here and Kirupa.com. And there are 1 or 2 bits of code in here that I'm having a hard time following. Some of which is yours . Therefore, I'd be afraid of doing more harm than good!
Well... Holler me if you need my help on that... That's totally up to you... ;)
Um... Make it onMouseMove at least... That's whole lot better than onEnterFrame...
Something tells me we're not talking about the same thing. :D Which onEnterFrame are you talking about? I was talking about how the thumnails load one at a time.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.