RE: [Flashcoders] hello, and interval management question
I've got a class here that manages intervals as well. It can be used to create intervals that fire off once (after a delay), continuously or a specified number of times. The events can then be applied to the parent object or another target object. Cheers, Karina /** * Delay class - executes callbacks, broadcasts messages and events the parent (or a passed target) after a set delay. * * @author Karina Steffens * @version 1.0 * @usage * @class */ class com.neoarchaic.util.Delay { public var parent:Object; private var events:Object; private var index:Number; function Delay (aparent:Object) { parent = aparent; index = 0; events = new Object (); } /**Broadcast the message to the parent after the delay. * @param target Object * @param evt String * @param delay Number */ public function doLater ():String { //target:Object, evt:String, delay:Number //_global.tt ("doLater", arguments) return storeMessage ("doLater", arguments); } /**Broadcast the message to the parent after the delay. * @param target Object * @param evt String * @param delay Number */ public function doLoop ():String { return storeMessage ("doLoop", arguments); } /**Broadcast the message to the parent after the delay. * @param target Object * @param evt String * @param delay Number * @param times Number */ public function doRepeat ():String { return storeMessage ("doRepeat", arguments); } /**Broadcast the EventListener to listeners after the delay. * @param target Object * @param evt String * @param delay Number */ public function dispatchEvent ():String { return storeMessage ("dispatchEvent", arguments); } /**Broadcast the EventListener to listeners after the delay. * @param target Object * @param evt String * @param delay Number */ public function broadcastEvent ():String { return storeMessage ("broadcastEvent", arguments); } /**Broadcast the message to listeners after the delay. * @param target Object * @param evt String * @param delay Number */ public function broadcastMessage ():String { return storeMessage ("broadcastMessage", arguments); } /**Interrupt the event before the interval. * @param id String */ public function interrupt (id:String) { var myEvent:Object; if (id == "all") { for (var i in events) { myEvent = events[i]; clearInterval (myEvent.interval); } events = new Object (); return; } myEvent = events[id]; if (myEvent == undefined) { for (var i in events) { if (events[i].evt == id || events[i].evtType == id) { myEvent = events[i]; break; } } } clearInterval (myEvent.interval); delete events[id]; } private function storeMessage (evtType:String, args:Array):String { //_global.tt ("storeMessage", evtType, args, typeof (args[0])) var myEvent:Object = new Object (); if (typeof (args[0]) != "string") { var target:Object = args.shift (); myEvent.target = target; } else { myEvent.target = parent; } var id:String = evtType + index++; var evt:String = String (args.shift ()); var delay:Number = Number (args.shift ()); switch (evtType){ case "doRepeat": myEvent.times = args.shift (); break; case "doLoop": myEvent.times = "unlimited"; break; default: myEvent.times = 1; } if (evtType.indexOf ("do") == -1) { //AbstractBroadcaster or EventDispatcher methods myEvent.evt = evtType; args.unshift (evt); } else {
Re: [Flashcoders] hello, and interval management question
cheers! On 10/17/06, Steven Sacks | BLITZ <[EMAIL PROTECTED]> wrote: Check out Kenny Bunch's interval manager class. http://www.kennybunch.com/index.php?p=16 Might help. ___ 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 -- Giles Bowkett http://www.gilesgoatboy.org ___ 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
RE: [Flashcoders] hello, and interval management question
Check out Kenny Bunch's interval manager class. http://www.kennybunch.com/index.php?p=16 Might help. ___ 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
Re: [Flashcoders] hello, and interval management question
I've played with Processing but it totally doesn't fit this situation unfortunately. On 10/15/06, Andrei Thomaz <[EMAIL PROTECTED]> wrote: hello Gilles, if you are doing an artwork, please, don't miss Processing ( www.processing.org). Maybe it can be useful, if you don't need to deploy a web app that works with Flash Player. []'s andrei On 10/15/06, Janis Radins <[EMAIL PROTECTED]> wrote: > > yes you can pass that interval ID > you can do something like this: > var intContainer:Object = new Object(); > intContainer.interval = setInterval(someFun, 50, intContainer); > > in this case intContainer will be to first argument of that functon and > you'll be able to refference it anytime as arguments[0].interval > > 2006/10/15, Giles Bowkett <[EMAIL PROTECTED]>: > > > > Hi, I'm mainly a coder, with some experience on the arts side as well. > > I've got a site where I need to be able to set and clear a bunch of > > intervals dynamically. It's a visualization application which involves > > node-link graphs with a potentially large number of nodes, and in > > which you can generate new graphs by exploring particular nodes. > > Various animations and things will have to happen, and one use of the > > application could conceivably involve hundreds of intervals being set > > and cleared. I need to be able to manage fade-outs, fade-ins, and > > movement for all these different nodes without any of the interval > > clearing or setting obliterating pre-existing intervals used in > > different functions. > > > > I've been reading various books and googling for a while and I really > > just haven't found any sophisticated technique for doing what I want > > to do. > > > > There are limitations, too. The system is a prototype and has to be > > finished very quickly. It's not object-oriented, it's in AS 2, and > > I've probably made a number of hideous mistakes as my prior experience > > is generally limited to bit101 tutorials and Jared Tarbell style art > > experiments. > > > > My question is, is there a way to pass an interval to the function > > you're calling within setInterval? Should I create a NodeFader class > > and pass it the interval? > > > > nodefader = new NodeFader() ; > > nodefader.interval = setInterval(nodefader, 50, node_to_fade) ; > > > > Something like that? > > > > My second question is, did I just answer my first question in the > > process of asking it? > > > > -- > > Giles Bowkett > > http://www.gilesgoatboy.org > > ___ > > 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 > ___ 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 -- Giles Bowkett http://www.gilesgoatboy.org ___ 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
Re: [Flashcoders] hello, and interval management question
Cheers Janis. I got it running but it was acting really weird. I'm trying a different approach with onEnterFrame now. On 10/15/06, Janis Radins <[EMAIL PROTECTED]> wrote: yes you can pass that interval ID you can do something like this: var intContainer:Object = new Object(); intContainer.interval = setInterval(someFun, 50, intContainer); in this case intContainer will be to first argument of that functon and you'll be able to refference it anytime as arguments[0].interval 2006/10/15, Giles Bowkett <[EMAIL PROTECTED]>: > > Hi, I'm mainly a coder, with some experience on the arts side as well. > I've got a site where I need to be able to set and clear a bunch of > intervals dynamically. It's a visualization application which involves > node-link graphs with a potentially large number of nodes, and in > which you can generate new graphs by exploring particular nodes. > Various animations and things will have to happen, and one use of the > application could conceivably involve hundreds of intervals being set > and cleared. I need to be able to manage fade-outs, fade-ins, and > movement for all these different nodes without any of the interval > clearing or setting obliterating pre-existing intervals used in > different functions. > > I've been reading various books and googling for a while and I really > just haven't found any sophisticated technique for doing what I want > to do. > > There are limitations, too. The system is a prototype and has to be > finished very quickly. It's not object-oriented, it's in AS 2, and > I've probably made a number of hideous mistakes as my prior experience > is generally limited to bit101 tutorials and Jared Tarbell style art > experiments. > > My question is, is there a way to pass an interval to the function > you're calling within setInterval? Should I create a NodeFader class > and pass it the interval? > > nodefader = new NodeFader() ; > nodefader.interval = setInterval(nodefader, 50, node_to_fade) ; > > Something like that? > > My second question is, did I just answer my first question in the > process of asking it? > > -- > Giles Bowkett > http://www.gilesgoatboy.org > ___ > 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 -- Giles Bowkett http://www.gilesgoatboy.org ___ 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
Re: [Flashcoders] hello, and interval management question
hello Gilles, if you are doing an artwork, please, don't miss Processing ( www.processing.org). Maybe it can be useful, if you don't need to deploy a web app that works with Flash Player. []'s andrei On 10/15/06, Janis Radins <[EMAIL PROTECTED]> wrote: yes you can pass that interval ID you can do something like this: var intContainer:Object = new Object(); intContainer.interval = setInterval(someFun, 50, intContainer); in this case intContainer will be to first argument of that functon and you'll be able to refference it anytime as arguments[0].interval 2006/10/15, Giles Bowkett <[EMAIL PROTECTED]>: > > Hi, I'm mainly a coder, with some experience on the arts side as well. > I've got a site where I need to be able to set and clear a bunch of > intervals dynamically. It's a visualization application which involves > node-link graphs with a potentially large number of nodes, and in > which you can generate new graphs by exploring particular nodes. > Various animations and things will have to happen, and one use of the > application could conceivably involve hundreds of intervals being set > and cleared. I need to be able to manage fade-outs, fade-ins, and > movement for all these different nodes without any of the interval > clearing or setting obliterating pre-existing intervals used in > different functions. > > I've been reading various books and googling for a while and I really > just haven't found any sophisticated technique for doing what I want > to do. > > There are limitations, too. The system is a prototype and has to be > finished very quickly. It's not object-oriented, it's in AS 2, and > I've probably made a number of hideous mistakes as my prior experience > is generally limited to bit101 tutorials and Jared Tarbell style art > experiments. > > My question is, is there a way to pass an interval to the function > you're calling within setInterval? Should I create a NodeFader class > and pass it the interval? > > nodefader = new NodeFader() ; > nodefader.interval = setInterval(nodefader, 50, node_to_fade) ; > > Something like that? > > My second question is, did I just answer my first question in the > process of asking it? > > -- > Giles Bowkett > http://www.gilesgoatboy.org > ___ > 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 ___ 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
Re: [Flashcoders] hello, and interval management question
yes you can pass that interval ID you can do something like this: var intContainer:Object = new Object(); intContainer.interval = setInterval(someFun, 50, intContainer); in this case intContainer will be to first argument of that functon and you'll be able to refference it anytime as arguments[0].interval 2006/10/15, Giles Bowkett <[EMAIL PROTECTED]>: Hi, I'm mainly a coder, with some experience on the arts side as well. I've got a site where I need to be able to set and clear a bunch of intervals dynamically. It's a visualization application which involves node-link graphs with a potentially large number of nodes, and in which you can generate new graphs by exploring particular nodes. Various animations and things will have to happen, and one use of the application could conceivably involve hundreds of intervals being set and cleared. I need to be able to manage fade-outs, fade-ins, and movement for all these different nodes without any of the interval clearing or setting obliterating pre-existing intervals used in different functions. I've been reading various books and googling for a while and I really just haven't found any sophisticated technique for doing what I want to do. There are limitations, too. The system is a prototype and has to be finished very quickly. It's not object-oriented, it's in AS 2, and I've probably made a number of hideous mistakes as my prior experience is generally limited to bit101 tutorials and Jared Tarbell style art experiments. My question is, is there a way to pass an interval to the function you're calling within setInterval? Should I create a NodeFader class and pass it the interval? nodefader = new NodeFader() ; nodefader.interval = setInterval(nodefader, 50, node_to_fade) ; Something like that? My second question is, did I just answer my first question in the process of asking it? -- Giles Bowkett http://www.gilesgoatboy.org ___ 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