Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 10-06-2002, 11:24 AM   #1
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 924
Default syntax problem.........maybe

Hi,
I am dynamically loading images into a dynamically created mc,
Originally I used a stack of if/if else statments with setInterval to laod the images automatically one after the after - this worked fine.
I now want to turn all that AS into a short while loop - like this:



function changeimageHolder1(){
var i = 1;
while (i<5){
imageHolder1.loadMovie("image.jpg"+i, i);
i++;

}


}
setInterval(changeimageHolder1,2000);

I get an error message telling me that Flash cannot open image1.jpg, image2.jpg etc etc - so, obviously the images are not loading in, but clearly the code is executing. All the files are located in the same folder

Any ideas on what I have got wrong !!!

Cheers

Vosgien
vosgien is offline   Reply With Quote
Old 10-06-2002, 11:55 AM   #2
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,578
Default

theres a few problems with your code

you can't load a jpg into a depth

your function is loading all 4 images each time it is run...is that what you wanted?

try something like

Code:
i=1;
function changeimageHolder1(){
	if(i<5){
imageHolder1.loadMovie("image"+i+".jpg"); 
i++; 
} 
}
setInterval(changeimageHolder1,2000);
this will load a new image every 2 seconds until it gets to the fourth - is that what you wanted?
__________________
Billy
Online Galleries
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 10-06-2002, 12:20 PM   #3
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 924
Default

Hi BillyT,
Thanks, that is exactly what I need ( for now ), I had been pouring over Moocks book, not thinking to set the var before the function.
When I say for now, the above code is the beginning and I am building block by block, so, I will try to get the next two blocks done myself - expect me back later ( lol!!!)

Thanks again

Vosgien
vosgien is offline   Reply With Quote
Old 10-06-2002, 09:46 PM   #4
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 924
Default

Hi,
Back again, as I promised, tho' this time not a syntax prob, more to do with code
First the project came in three parts
1) to load in images one after the other using setInterval as opposed to a button click

2) get the images to go back to the start and load in again

3) this is the difficult bit, at the moment my for loop is set to load in a fixed number of images( see code below), however in the final application I will not know how many images there are - my client wants to put his own images in, and the number will be different on a day to day basis. I have tried using .length & Max. - but to no avail.If I set the for loop to a very large number then there is a blank screen between the last actual image and the first, which is something I want to avoid. I know how to do this when using an array, but have no idea with jpegs as this is pretty new stuff to me.

So to recap, how can I change my code so that when the last image is loaded in, it goes back to "image1.jpeg" without me knowing how many images actually exist.
Does that make sense - I hope so

Thanks again

Vosgien
vosgien is offline   Reply With Quote
Old 10-06-2002, 10:46 PM   #5
pom
Allez les Bleus!!!
 
pom's Avatar
 
Join Date: Oct 2002
Location: Paname
Posts: 2,495
Default

What do you mean you don't how many images you have? You have to know their names when you load them, don't you? And if you have their names, well, you must be able to know how many there are.

Enfin je me comprends
pom is offline   Reply With Quote
Old 10-06-2002, 11:34 PM   #6
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,578
Default

OK attcahed is a fairly dodgy solution. Gives an error when running in flash (which was to be expected) but works fine online

cheers
Attached Files
File Type: zip imageswapper.zip (56.5 KB, 444 views)
__________________
Billy
Online Galleries
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 10-07-2002, 07:15 AM   #7
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 924
Default

Hi BillyT,
No time to test in line but I can see how that works - pretty simple really. One Q. in the last line of the code :

I++; is the captial "I" signifcant or should it read "i++".
Will test later and let you know.

Pom - please re - read the post, my client is going to load in his own images to the site, he will do this on a daily basis and the number of images will vary from day to day - as I will not be involved in this process, I will not know how many images there will be on a day to day basis. If I was involved, I would not want to change the code on a daily basis - therefore, I seek the solution in Flash - and with a little help from the good and kindly people at ActionScript.org - I believe we have finally got there.
perhaps I should also tell you the guy is an estate agent, the images that load in and loop as described above will be photographs of the rooms ( internal) of a house for sale. At any one time he has over a 100 properties on his books that come in all different shapes and sizes...................
Hope that clears it up for you.

btw - I haven't got this job yet - I will be pitching for it today, if succesful it will be my first job in MX and also my very first French client - fingers crossed.

Thanks v. much again

Vosgien
vosgien is offline   Reply With Quote
Old 10-07-2002, 07:28 AM   #8
Billy T
Oops I did it again
 
Billy T's Avatar
 
Join Date: Oct 2001
Location: Melbourne
Posts: 8,578
Default

yeah should be a "i" but it doesnt seem to make a difference

good luck with the pitch
__________________
Billy
Online Galleries
Free Flash Video Tutorials
Photo Website Template

Don't email or PM me questions...
Billy T is offline   Reply With Quote
Old 10-07-2002, 02:23 PM   #9
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 924
Default

Hi BillyT,
Hope you are still following this thread as I am experiencing serious problems, I think they may be of a tech nature which is beyond my scope. I'll explain:
First of all the code works fine in the test environment - all that happens is that Flash throws up an error message once it has been through the images once saying it cannot find the next file ( that isn't there to be found)
Second it works well in the swf and html pages no problems.

It is not working on line.

At first I published my movie in html and renamed the html doc index.html ( normal )
It wouldn't load in - worse after trying to load it, I couldn't get any other site to load in afterwards - had to shut down my connection and reconnect ????
Tried this in my i.e browser and my AOL browser

Next - tried the same with your file(imageswap.swf & html) and images - same thing.

So then I created an fla ( called index) with a single button that loads in imageswap.swf - exactly the same thing - nothing happens, no images at all. And it is still blocking my browser and I cannot fathom out why.
If you have the time you can see the test here . You will see a white background with a black circle - this is a button, just click it and imageswap should load in. I will be interested to know if it works on other PC's /browsers.
Any ideas to why this is happening.............

Cheers

Vosgien
vosgien is offline   Reply With Quote
Old 10-07-2002, 06:18 PM   #10
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 924
Default

Hi,
I've now changed the file to the original, this had a set if else if statements in it that load the images at 2 second intervals to a maximum of four - still not working. This was the first file I put together after doing your tute, the text loads in fine, but no images - and still blocking my browser whenever I try the site. I have triple checked the code ( for typo's and stuff ), but it all seems to be fine. So now I'm stuck and can't really work why this happening - I am beginning to wonder if it has anything to do with my PC. If anyone has the time to check and get back to me and let me know what is going on I will be very grateful.
What should happen is this:
When site opens there is a large round black button ( I am not going for any design awards here - just want to get the functionality working OK), click the button, another swf will load with four buttons and a blue text box, to the right of this there should be a black square, above the black square, changing images, only the first two ( square ) buttons are active.
If anyone can let me kknow...........please
Click here

Cheers

Vosgien
vosgien is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:22 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.