RE: [Flashcoders] Operator Help!!
Your code works fine for me this end. Paul -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl DeSaulniers Sent: 21 May 2009 06:15 To: Flash Coders List Subject: [Flashcoders] Operator Help!! EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
The code does not show any errors, but you are trying to index an array of strings using a string - the indexes of the arrays sunrise and sunset will still be numbers so sunrise[hours] and sunset[hours] may not work if hours is a string... I did this with a sunrise and sunset number before: var sunrise:Number = 6; var sunset:Number = 20; var hour:Number = new Date().getHours(); if(sunrise = hour sunset hour) { //do sunrise stuff } else { do sunset stuff... } Paul Steven wrote: Your code works fine for me this end. Paul -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl DeSaulniers Sent: 21 May 2009 06:15 To: Flash Coders List Subject: [Flashcoders] Operator Help!! EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Really!? Hmm thats weird. I wonder why its throwing an error on my end. I take it you pub with AS2? or did you pub with AS3 as the script lang? Karl On May 21, 2009, at 4:26 AM, Paul Steven wrote: Your code works fine for me this end. Paul -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl DeSaulniers Sent: 21 May 2009 06:15 To: Flash Coders List Subject: [Flashcoders] Operator Help!! EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Hi, I pasted into a Flash file (AS2) and checked the syntax - did not publish as I don't have the MovieClips, etc.. Glen Karl DeSaulniers wrote: Really!? Hmm thats weird. I wonder why its throwing an error on my end. I take it you pub with AS2? or did you pub with AS3 as the script lang? Karl On May 21, 2009, at 4:26 AM, Paul Steven wrote: Your code works fine for me this end. Paul -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Karl DeSaulniers Sent: 21 May 2009 06:15 To: Flash Coders List Subject: [Flashcoders] Operator Help!! EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Hi, I *think* this does what you're trying to do, which would be to fade the alpha of an image in and out again over 24h. I don't have AS2 so I can't test, but when you do, you can set minutesPerDay to however long you may wish to sit there and watch the magic happen. If it happens, that is, because as I said it's untested. Please, reconsider putting it into an enterFrame handler. It's really enough to run it every couple of minutes. Also, no, unfortunately I have no idea why Flash is acting up for you. The operator use appears to be correct. var sunrise : Number = 6; // hour of day when sun begins to rise var maxAlpha : Number = 100; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes(); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha; BKGND.BKGND_Grad._alpha = alpha; HTH, Mark On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers k...@designdrumm.com wrote: EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Thanks Mark. That is an interesting approach. Pardon me for asking, but what part in your code initiates the sunset part? Karl Sent from losPhone On May 21, 2009, at 3:34 PM, Mark Winterhalder mar...@gmail.com wrote: Hi, I *think* this does what you're trying to do, which would be to fade the alpha of an image in and out again over 24h. I don't have AS2 so I can't test, but when you do, you can set minutesPerDay to however long you may wish to sit there and watch the magic happen. If it happens, that is, because as I said it's untested. Please, reconsider putting it into an enterFrame handler. It's really enough to run it every couple of minutes. Also, no, unfortunately I have no idea why Flash is acting up for you. The operator use appears to be correct. var sunrise : Number = 6; // hour of day when sun begins to rise var maxAlpha : Number = 100; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes(); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha; BKGND.BKGND_Grad._alpha = alpha; HTH, Mark On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers k...@designdrumm.com wrote: EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
On Thu, May 21, 2009 at 10:43 PM, Karl DeSaulniers k...@designdrumm.com wrote: Thanks Mark. That is an interesting approach. Pardon me for asking, but what part in your code initiates the sunset part? Nothing really, if you mean how the change is triggered. But whenever the code runs, it will adjust the alpha. For testing, you can put all of it into an onEnterFrame(), but for production use you should run it only once when the page loads. If you really expect visitors to spend hours on your site, then use setInterval() to update it every couple of minutes. The general idea of the code is to calculate what fraction of 12h the current time is away from the begin of sunset, and then adjust the alpha accordingly. So, sunset here really means that it's the darkest minute of the day, just when it begins to get brighter. Mark Karl Sent from losPhone On May 21, 2009, at 3:34 PM, Mark Winterhalder mar...@gmail.com wrote: Hi, I *think* this does what you're trying to do, which would be to fade the alpha of an image in and out again over 24h. I don't have AS2 so I can't test, but when you do, you can set minutesPerDay to however long you may wish to sit there and watch the magic happen. If it happens, that is, because as I said it's untested. Please, reconsider putting it into an enterFrame handler. It's really enough to run it every couple of minutes. Also, no, unfortunately I have no idea why Flash is acting up for you. The operator use appears to be correct. var sunrise : Number = 6; // hour of day when sun begins to rise var maxAlpha : Number = 100; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes(); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha; BKGND.BKGND_Grad._alpha = alpha; HTH, Mark On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers k...@designdrumm.com wrote: EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Hmm... maybe I misunderstood what you were trying to do. Do you want to have a continuous sunrise and -set over 24h, or do you want to have a sudden sunset or -rise twice a day? Mark On Thu, May 21, 2009 at 10:57 PM, Mark Winterhalder mar...@gmail.com wrote: On Thu, May 21, 2009 at 10:43 PM, Karl DeSaulniers k...@designdrumm.com wrote: Thanks Mark. That is an interesting approach. Pardon me for asking, but what part in your code initiates the sunset part? Nothing really, if you mean how the change is triggered. But whenever the code runs, it will adjust the alpha. For testing, you can put all of it into an onEnterFrame(), but for production use you should run it only once when the page loads. If you really expect visitors to spend hours on your site, then use setInterval() to update it every couple of minutes. The general idea of the code is to calculate what fraction of 12h the current time is away from the begin of sunset, and then adjust the alpha accordingly. So, sunset here really means that it's the darkest minute of the day, just when it begins to get brighter. Mark Karl Sent from losPhone On May 21, 2009, at 3:34 PM, Mark Winterhalder mar...@gmail.com wrote: Hi, I *think* this does what you're trying to do, which would be to fade the alpha of an image in and out again over 24h. I don't have AS2 so I can't test, but when you do, you can set minutesPerDay to however long you may wish to sit there and watch the magic happen. If it happens, that is, because as I said it's untested. Please, reconsider putting it into an enterFrame handler. It's really enough to run it every couple of minutes. Also, no, unfortunately I have no idea why Flash is acting up for you. The operator use appears to be correct. var sunrise : Number = 6; // hour of day when sun begins to rise var maxAlpha : Number = 100; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes(); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha; BKGND.BKGND_Grad._alpha = alpha; HTH, Mark On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers k...@designdrumm.com wrote: EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Oh no, I am just wanting to check what time of day it is and have my background fade from dark to light accordingly. The code you supplied, I think will do that, just haven't got off work yet to try out. :) I am more so wanting to know why, if my code is correct, why its throwing this operand error. very mysterious and bugging me to no end :-P My code checks to see if the hour that is current is in the sunrise or sunset array and so for my code, how would I check to see if theHour is one of the values in either array and if its not in one, check the other? That is basically what I am trying to accomplish I should say. Thanks for your help.. Best, Karl On May 21, 2009, at 4:04 PM, Mark Winterhalder wrote: Hmm... maybe I misunderstood what you were trying to do. Do you want to have a continuous sunrise and -set over 24h, or do you want to have a sudden sunset or -rise twice a day? Mark On Thu, May 21, 2009 at 10:57 PM, Mark Winterhalder mar...@gmail.com wrote: On Thu, May 21, 2009 at 10:43 PM, Karl DeSaulniers k...@designdrumm.com wrote: Thanks Mark. That is an interesting approach. Pardon me for asking, but what part in your code initiates the sunset part? Nothing really, if you mean how the change is triggered. But whenever the code runs, it will adjust the alpha. For testing, you can put all of it into an onEnterFrame(), but for production use you should run it only once when the page loads. If you really expect visitors to spend hours on your site, then use setInterval() to update it every couple of minutes. The general idea of the code is to calculate what fraction of 12h the current time is away from the begin of sunset, and then adjust the alpha accordingly. So, sunset here really means that it's the darkest minute of the day, just when it begins to get brighter. Mark Karl Sent from losPhone On May 21, 2009, at 3:34 PM, Mark Winterhalder mar...@gmail.com wrote: Hi, I *think* this does what you're trying to do, which would be to fade the alpha of an image in and out again over 24h. I don't have AS2 so I can't test, but when you do, you can set minutesPerDay to however long you may wish to sit there and watch the magic happen. If it happens, that is, because as I said it's untested. Please, reconsider putting it into an enterFrame handler. It's really enough to run it every couple of minutes. Also, no, unfortunately I have no idea why Flash is acting up for you. The operator use appears to be correct. var sunrise : Number = 6; // hour of day when sun begins to rise var maxAlpha : Number = 100; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes (); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ var alpha : Number = Math.abs( 0.5 - cycleElapsed ) * 2 * maxAlpha; BKGND.BKGND_Grad._alpha = alpha; HTH, Mark On Thu, May 21, 2009 at 7:14 AM, Karl DeSaulniers k...@designdrumm.com wrote: EEEk.. anyone!!! What am I doing wrong?? This is AS2. var sunrise:Array = new Array(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17); var sunset:Array = new Array(18, 19, 20, 21, 22, 23, 0, 1, 2, 3, 4, 5); var time:Date = new Date(); var hour:Number = time.getHours(); var hours:String = hour.toString(); var snRSE:String = sunrise[hours]; var snSET:String = sunset[hours]; this.onEnterFrame = function() { if (hours == snRSE) { BKGND.BKGND_Grad._alpha -= BKGND.BKGND_Grad._alpha + 8.333; } else if (hours == snSET) { BKGND.BKGND_Grad._alpha += BKGND.BKGND_Grad._alpha + 8.333; } }; I feel this is probably so easy, but it is eluding me for some reason. flash says for this line: if (hours == snRSE) { - operator = must be followed by an Operand ??? Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
On Thu, May 21, 2009 at 11:44 PM, Karl DeSaulniers k...@designdrumm.com wrote: Oh no, I am just wanting to check what time of day it is and have my background fade from dark to light accordingly. The code you supplied, I think will do that, just haven't got off work yet to try out. :) Well, it fades out for 12h, then fades back in for 12h, beginning at 6am each day. But now I think I really know what you mean. We can recycle most of the lines: var sunrise : Number = 6; // hour of day when sun begins to rise var fadeDuration = 100; // as number of frames var framesElapsed : Number = 0; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes(); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ BKGND.BKGND_Grad.onEnterFrame = function () { var progress : Number = framesElapsed / fadeDuration; // here we check if the sun is supposed to set or to rise: if( cycleElapsed .5 ) { // the sun is still rising this._alpha = (1 - progress) * 100; } else { // the sun is setting this._alpha = progress * 100; } }; I am more so wanting to know why, if my code is correct, why its throwing this operand error. very mysterious and bugging me to no end :-P Yeah, I'd like to know that, too. Possibly, closing and restarting Flash will fix it? It has its mysterious ways sometimes, at least that's how it used to be. :/ Mark ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Oh, I forgot to remove the onEnterFrame when it's no longer needed. Please add this line to the end of the function: if( progress = 1 ) delete this.onEnterFrame; Mark On Fri, May 22, 2009 at 12:18 AM, Mark Winterhalder mar...@gmail.com wrote: On Thu, May 21, 2009 at 11:44 PM, Karl DeSaulniers k...@designdrumm.com wrote: Oh no, I am just wanting to check what time of day it is and have my background fade from dark to light accordingly. The code you supplied, I think will do that, just haven't got off work yet to try out. :) Well, it fades out for 12h, then fades back in for 12h, beginning at 6am each day. But now I think I really know what you mean. We can recycle most of the lines: var sunrise : Number = 6; // hour of day when sun begins to rise var fadeDuration = 100; // as number of frames var framesElapsed : Number = 0; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes(); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ BKGND.BKGND_Grad.onEnterFrame = function () { var progress : Number = framesElapsed / fadeDuration; // here we check if the sun is supposed to set or to rise: if( cycleElapsed .5 ) { // the sun is still rising this._alpha = (1 - progress) * 100; } else { // the sun is setting this._alpha = progress * 100; } }; I am more so wanting to know why, if my code is correct, why its throwing this operand error. very mysterious and bugging me to no end :-P Yeah, I'd like to know that, too. Possibly, closing and restarting Flash will fix it? It has its mysterious ways sometimes, at least that's how it used to be. :/ Mark ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
I will try that and let you know. One question, sort of off-sub, but in regards to what you just wrote. When you delete something does this remove it completely? or would it be available if that frame was played again? Karl Thanks for taking the time.. really appreciate it. On May 21, 2009, at 5:19 PM, Mark Winterhalder wrote: Oh, I forgot to remove the onEnterFrame when it's no longer needed. Please add this line to the end of the function: if( progress = 1 ) delete this.onEnterFrame; Mark On Fri, May 22, 2009 at 12:18 AM, Mark Winterhalder mar...@gmail.com wrote: On Thu, May 21, 2009 at 11:44 PM, Karl DeSaulniers k...@designdrumm.com wrote: Oh no, I am just wanting to check what time of day it is and have my background fade from dark to light accordingly. The code you supplied, I think will do that, just haven't got off work yet to try out. :) Well, it fades out for 12h, then fades back in for 12h, beginning at 6am each day. But now I think I really know what you mean. We can recycle most of the lines: var sunrise : Number = 6; // hour of day when sun begins to rise var fadeDuration = 100; // as number of frames var framesElapsed : Number = 0; var minutesPerDay : Number = 24 * 60; var time : Date = new Date(); var minuteOfDay : Number = time.getHours() * 60 + time.getMinutes(); var deltaMinutes : Number = (minuteOfDay - sunrise * 60 + minutesPerDay) % minutesPerDay; var cycleElapsed : Number = deltaMinutes / minutesPerDay; // [0...1[ BKGND.BKGND_Grad.onEnterFrame = function () { var progress : Number = framesElapsed / fadeDuration; // here we check if the sun is supposed to set or to rise: if( cycleElapsed .5 ) { // the sun is still rising this._alpha = (1 - progress) * 100; } else { // the sun is setting this._alpha = progress * 100; } }; I am more so wanting to know why, if my code is correct, why its throwing this operand error. very mysterious and bugging me to no end :-P Yeah, I'd like to know that, too. Possibly, closing and restarting Flash will fix it? It has its mysterious ways sometimes, at least that's how it used to be. :/ Mark ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
On Fri, May 22, 2009 at 12:28 AM, Karl DeSaulniers k...@designdrumm.com wrote: I will try that and let you know. I just found another bug. :/ This line: var progress : Number = framesElapsed / fadeDuration; should really be like this: var progress : Number = framesElapsed++ / fadeDuration; otherwise there wouldn't be a fade. Sorry for that. One question, sort of off-sub, but in regards to what you just wrote. When you delete something does this remove it completely? or would it be available if that frame was played again? If the code on that page would play again, then the onEnterFrame = ... part would get executed again, and the function would get reassigned to onEnterFrame. It would also reset the framesElapsed counter, so it wouldn't work if executed each frame. So, run it only once. If you have to run it more than once, it gets complicated. Let me know if that's the case. Mark ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
:) On May 21, 2009, at 5:38 PM, Mark Winterhalder wrote: On Fri, May 22, 2009 at 12:28 AM, Karl DeSaulniers k...@designdrumm.com wrote: I will try that and let you know. I just found another bug. :/ This line: var progress : Number = framesElapsed / fadeDuration; should really be like this: var progress : Number = framesElapsed++ / fadeDuration; otherwise there wouldn't be a fade. Sorry for that. One question, sort of off-sub, but in regards to what you just wrote. When you delete something does this remove it completely? or would it be available if that frame was played again? If the code on that page would play again, then the onEnterFrame = ... part would get executed again, and the function would get reassigned to onEnterFrame. It would also reset the framesElapsed counter, so it wouldn't work if executed each frame. So, run it only once. If you have to run it more than once, it gets complicated. Let me know if that's the case. Mark ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Operator Help!!
Well, I do plan on people spending quite a while on my site, and so, if someone came around sunset and stayed for say an hour or two, (if Im lucky :P) they would see the change happen? or am I asking for a bogdown-nightmare-to-happen ? Karl On May 21, 2009, at 5:38 PM, Mark Winterhalder wrote: If the code on that page would play again, then the onEnterFrame = ... part would get executed again, and the function would get reassigned to onEnterFrame. It would also reset the framesElapsed counter, so it wouldn't work if executed each frame. So, run it only once. If you have to run it more than once, it gets complicated. Let me know if that's the case. Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders