Thanks all! I have the code working now. I will be sure to hang on to the replies, so I can have them for reference. THANKS.
Paul Vdst ----- Original Message ----- From: "Omar Fouad" <[EMAIL PROTECTED]> To: <flashcoders@chattyfig.figleaf.com> Sent: Wednesday, February 28, 2007 9:02 PM Subject: Re: [Flashcoders] Getting frustrated. regarding set Interval,and for loop. > Link Updated > :D > http://www.proeye.net/omarfouad/myClasses/SetTimer.rar > > > On 3/1/07, Omar Fouad <[EMAIL PROTECTED]> wrote: > > > > well I've actually created a class called SetTimer.as that executes a > > function after a given time in seconds and can loop the function many times > > u want.. > > > > see just put the class in the same directory of the fla and use: > > > > import SetTimer; > > var myTimer:SetTimer = new SetTimer(2, function () {myFunction();}, 5); > > > > where "2" is the time to wait in seconds, the second attribute is the > > function to be executed and finally "5" are "how many times the function > > will be repeated". if u don't set this last parameter the function will be > > repeated only once... > > > > hope this will help... > > > > here is the class http://www.proeye.net/omarfouad/myClasses/SetTimer.as > > > > Good luck! > > > > > > On 3/1/07, Kalani Bright <[EMAIL PROTECTED]> wrote: > > > > > > When I was using AS2 I found that no matter what there were always > > > memory > > > leaks with set interval and even after I explicitly tell Flash to remove > > > the > > > interval it never got removed... > > > > > > So even though I never wrote it I would offer the following advice, > > > which is > > > to *almost* not use setInterval at all. Just use it once, for the > > > root... > > > 1) Move all functionality for intervals to a script on the root > > > 2) The root is always available, and you won't have intervals all over > > > the > > > place > > > 3) Create only one interval for a function on the root which is > > > responsible > > > for calling functions > > > 4) The function should get the same sort of information as whats > > > required by > > > setInterval. > > > 5) Call functions based on the timer. Time since movie started. A > > > little > > > math should test if the objects which are registered with your script > > > should > > > be called again. I would also recommend enabling this function to > > > support > > > something like "call this function X times every 1000 ms). Rather than > > > call this object every 1000ms. That way you can delete it automatically > > > if > > > its reached that number. > > > 6) That script keeps information on what intervals are set > > > 7) The script periodically checks for objects which no longer exists and > > > deletes them from the interval array. > > > 8) Intervals are set or removed by calling a root function. Use the > > > delegate class to say which function gets the interval callback and also > > > > > > pass a reference to the object. > > > > > > Good luck, > > > > > > Kalani > > > > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of Omar > > > Fouad > > > Sent: Wednesday, February 28, 2007 5:18 PM > > > To: Paul V.; flashcoders@chattyfig.figleaf.com > > > Subject: Re: [Flashcoders] Getting frustrated. regarding set > > > Interval,and > > > for loop. > > > > > > assign the setInterval to a variable than clear the interval this way : > > > > > > var myInterval = setInterval(blah blah blah); clearInterval(myInterval); > > > > > > read about clearInterval on the docs... U'll realize it more > > > > > > On 3/1/07, Paul V. <[EMAIL PROTECTED]> wrote: > > > > > > > > Let me explain the problem I am having and then I will send you some > > > > code. I want to load up images in a slide show with set interval, > > > > with the images being called image1 image2 image 3 etc. I want to be > > > > coding a dynamic slide show so that if I change the images I can just > > > > replace the mc images. > > > > > > > > here is the code I am working on, I am a little new to setInterval > > > > (completely new to that function actually) - I do understand the basic > > > > syntax, setInterval( function (){ //entire function here;},1000); > > > > > > > > But I don't know how to run a for loop inside it and pass a variable > > > > to it. (I am a newbie). > > > > > > > > function loadImages(){ //Ihave this here so I can run an > > > external > > > > for loop. > > > > for(i=1;i<6;i++){ > > > > setInterval(function(){ //set interval and begins anonymous > > > > function i.e function() -no name > > > > attachMovie("image"+i,"image"+i,41); //trying to attach the > > > images, > > > > image1 - image5 > > > > image = eval("image"+i); //instance assigned > > > to > > > > variable 'image' > > > > image._x = ((Stage.width / 2)-(image._width/2)); //positioning > > > > image._y = > > > > (yFactor); //positioning > > > > oldwidth = image._width; > > > //saving > > > > dimensions for resizing formula > > > > oldheight = > > > image._height; //saving > > > > dimensions for resizing formula > > > > > > > > image._height = yheight; //image > > > > height set to variable > > > > image._width = ((oldwidth*yheight)/oldheight); //image width > > > set to > > > > proportions of original > > > > },1000); > > > > //interval to 1 sec. 1000 milliseconds > > > > } > > > //end > > > > for loop > > > > } //end > > > > container function > > > > > > > > I am trying to set the images up for a second and then have them > > > switch. > > > > Help me out if you you know a solution. Or even if you see some > > > > obvious errors. Like I said I am new with the set interval. by the > > > > way if you like that little resizing technique, you can use it. Thank > > > you. > > > > > > > > Looking forward to a response on this one. > > > > > > > > Paul Vdst > > > > _______________________________________________ > > > > Flashcoders@chattyfig.figleaf.com > > > > To change your subscription options or search the archive: > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > > > Brought to you by Fig Leaf Software > > > > Premier Authorized Adobe Consulting and Training > > > > http://www.figleaf.com http://training.figleaf.com > > > > > > > > > > > > > > > > -- > > > Omar Fouad - Digital Emotions... > > > > > > Love is always patient and kind. It is never jealous. Love is never > > > boastful > > > nor conceited It is never rude or selfish. It does not take offense and > > > is > > > not resentful. Love takes no pleasure in other people's sins...but > > > delights > > > in the truth. It is always ready to excuse, to trust, to hope... and to > > > endure... whatever comes. > > > _______________________________________________ > > > Flashcoders@chattyfig.figleaf.com > > > To change your subscription options or search the archive: > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > Brought to you by Fig Leaf Software > > > Premier Authorized Adobe Consulting and Training > > > http://www.figleaf.com > > > http://training.figleaf.com > > > > > > > > > _______________________________________________ > > > Flashcoders@chattyfig.figleaf.com > > > To change your subscription options or search the archive: > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > Brought to you by Fig Leaf Software > > > Premier Authorized Adobe Consulting and Training > > > http://www.figleaf.com > > > http://training.figleaf.com > > > > > > > > > > > -- > > Omar Fouad - Digital Emotions... > > > > Love is always patient and kind. It is never jealous. Love is never > > boastful nor conceited It is never rude or selfish. It does not take offense > > and is not resentful. Love takes no pleasure in other people's sins...but > > delights in the truth. It is always ready to excuse, to trust, to hope... > > and to endure... whatever comes. > > > > > > -- > Omar Fouad - Digital Emotions... > > Love is always patient and kind. It is never jealous. Love is never boastful > nor conceited It is never rude or selfish. It does not take offense and is > not resentful. Love takes no pleasure in other people's sins...but delights > in the truth. It is always ready to excuse, to trust, to hope... and to > endure... whatever comes. > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com