RE: [Flashcoders] AS3 scripting, first try - some Q's
Hi Mike, I didnt know FlashCoders was a place to get one's code reviewed for silly mistakes in logic. Hence I just cleared your way from thinking its an AS3 problem. Anyways glad to know you figured it out. You're right, it's not and I did think it was an AS2 - AS3 translation problem, it wasn't, great, but it wouldn't have hurt too much to just post what the problem actually was as well would it? And for your second question, I had already replied to it. Hadn't seen this, looked back through the archive and found it now, for some reason it wasn't being grouped in the same subject. I had actually tried this approach - but it seemed to effect the whole document, not individual mc's - will revisit. Ta M ___ 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] AS3 scripting, first try - some Q's
Well, I was trying to make a light moment. Hope you saw the smiley in the answer. Again this is also a light moment :) . Chill out buddy :) - Original Message - From: Mike Mountain [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Friday, July 28, 2006 1:49 PM Subject: RE: [Flashcoders] AS3 scripting, first try - some Q's Hi Mike, I didnt know FlashCoders was a place to get one's code reviewed for silly mistakes in logic. Hence I just cleared your way from thinking its an AS3 problem. Anyways glad to know you figured it out. You're right, it's not and I did think it was an AS2 - AS3 translation problem, it wasn't, great, but it wouldn't have hurt too much to just post what the problem actually was as well would it? And for your second question, I had already replied to it. Hadn't seen this, looked back through the archive and found it now, for some reason it wasn't being grouped in the same subject. I had actually tried this approach - but it seemed to effect the whole document, not individual mc's - will revisit. Ta M ___ 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] AS3 scripting, first try - some Q's
Well my frustration was stoked by the vague error messages being churned out by the compiler. But no sweat. M -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Supriya Sent: 28 July 2006 09:40 To: Flashcoders mailing list Subject: Re: [Flashcoders] AS3 scripting, first try - some Q's Well, I was trying to make a light moment. Hope you saw the smiley in the answer. Again this is also a light moment :) . Chill out buddy :) ___ 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] AS3 scripting, first try - some Q's
its not an AS3 problem, its a small problem in your logic in the function moveme find it out :) - Original Message - From: Mike Mountain [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Thursday, July 27, 2006 9:07 PM Subject: [Flashcoders] AS3 scripting, first try - some Q's OK having a dabble in AS3 for the first time and I ported a simple particle script over to the timeline: [as] import flash.events.Event; var numBots:int = 50; var balls:Array=new Array(); // for(var i=0; i=numBots; i++){ var bl:Ball=new Ball(); var tmpBall=addChild(bl); tmpBall.xmin = tmpBall.width/2; tmpBall.ymin = tmpBall.height/2; tmpBall.xmax = 550-tmpBall.xmin; tmpBall.ymax = 400-tmpBall.ymin; // tmpBall.x = Math.floor(Math.random()*(550-tmpBall.width))+tmpBall.xmin; tmpBall.y = Math.floor(Math.random()*(400-tmpBall.height))+tmpBall.ymin; // tmpBall.xVel = Math.floor(Math.random()*20)-10; tmpBall.yVel = Math.floor(Math.random()*20)-10; tmpBall.alpha=Math.random()*1 tmpBall.scaleX=tmpBall.scaleY=Math.random()*1 balls.push(tmpBall); } addEventListener(Event.ENTER_FRAME, moveme); function moveme(event:Event):void{ var l=balls.length; for(var i=0; i=l; i++){ var bot:Ball = balls[i]; var nextX = bot.xVel+bot.x; var nextY = bot.yVel+bot.y; if (nextXbot.xmax) { bot.xVel = bot.xVel*-1; nextX = bot.xmax-(nextX-bot.xmax); } else if (nextXbot.xmin) { bot.xVel = bot.xVel*-1; nextX = bot.xmin+(bot.xmin-nextX); } if (nextYbot.ymax) { bot.yVel = bot.yVel*-1; nextY = bot.ymax-(nextY-bot.ymax); } else if (nextYbot.ymin) { bot.yVel = bot.yVel*-1; nextY = bot.ymin+(bot.ymin-nextY); } bot.x = nextX; bot.y = nextY; } } [/as] Gives me this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Timeline0_5bf5ad1effb5f4693f4c3e71f1bcfc7/moveme() What am I missing here? And while I'm at it, what's the simple AS3 scripting way (I know the class way) of doing myObj.onEnterFrame=function(){ this.x+=1 //Etc. } Cheers Mike ___ 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] AS3 scripting, first try - some Q's
for the second question myObj.addEventListener(enterFrame,fun) function fun(evt) { this.x++ } Supriya. - Original Message - From: Mike Mountain [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Thursday, July 27, 2006 9:07 PM Subject: [Flashcoders] AS3 scripting, first try - some Q's OK having a dabble in AS3 for the first time and I ported a simple particle script over to the timeline: [as] import flash.events.Event; var numBots:int = 50; var balls:Array=new Array(); // for(var i=0; i=numBots; i++){ var bl:Ball=new Ball(); var tmpBall=addChild(bl); tmpBall.xmin = tmpBall.width/2; tmpBall.ymin = tmpBall.height/2; tmpBall.xmax = 550-tmpBall.xmin; tmpBall.ymax = 400-tmpBall.ymin; // tmpBall.x = Math.floor(Math.random()*(550-tmpBall.width))+tmpBall.xmin; tmpBall.y = Math.floor(Math.random()*(400-tmpBall.height))+tmpBall.ymin; // tmpBall.xVel = Math.floor(Math.random()*20)-10; tmpBall.yVel = Math.floor(Math.random()*20)-10; tmpBall.alpha=Math.random()*1 tmpBall.scaleX=tmpBall.scaleY=Math.random()*1 balls.push(tmpBall); } addEventListener(Event.ENTER_FRAME, moveme); function moveme(event:Event):void{ var l=balls.length; for(var i=0; i=l; i++){ var bot:Ball = balls[i]; var nextX = bot.xVel+bot.x; var nextY = bot.yVel+bot.y; if (nextXbot.xmax) { bot.xVel = bot.xVel*-1; nextX = bot.xmax-(nextX-bot.xmax); } else if (nextXbot.xmin) { bot.xVel = bot.xVel*-1; nextX = bot.xmin+(bot.xmin-nextX); } if (nextYbot.ymax) { bot.yVel = bot.yVel*-1; nextY = bot.ymax-(nextY-bot.ymax); } else if (nextYbot.ymin) { bot.yVel = bot.yVel*-1; nextY = bot.ymin+(bot.ymin-nextY); } bot.x = nextX; bot.y = nextY; } } [/as] Gives me this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Timeline0_5bf5ad1effb5f4693f4c3e71f1bcfc7/moveme() What am I missing here? And while I'm at it, what's the simple AS3 scripting way (I know the class way) of doing myObj.onEnterFrame=function(){ this.x+=1 //Etc. } Cheers Mike ___ 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] AS3 scripting, first try - some Q's
function moveme(event:Event):void{ You aren't passing in an event there... so perhaps that is causing the vomit? - Eric On 7/27/06, Supriya [EMAIL PROTECTED] wrote: its not an AS3 problem, its a small problem in your logic in the function moveme find it out :) - Original Message - From: Mike Mountain [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Thursday, July 27, 2006 9:07 PM Subject: [Flashcoders] AS3 scripting, first try - some Q's OK having a dabble in AS3 for the first time and I ported a simple particle script over to the timeline: [as] import flash.events.Event; var numBots:int = 50; var balls:Array=new Array(); // for(var i=0; i=numBots; i++){ var bl:Ball=new Ball(); var tmpBall=addChild(bl); tmpBall.xmin = tmpBall.width/2; tmpBall.ymin = tmpBall.height/2; tmpBall.xmax = 550-tmpBall.xmin; tmpBall.ymax = 400-tmpBall.ymin; // tmpBall.x = Math.floor(Math.random()*(550-tmpBall.width))+tmpBall.xmin; tmpBall.y = Math.floor(Math.random()*(400-tmpBall.height))+tmpBall.ymin; // tmpBall.xVel = Math.floor(Math.random()*20)-10; tmpBall.yVel = Math.floor(Math.random()*20)-10; tmpBall.alpha=Math.random()*1 tmpBall.scaleX=tmpBall.scaleY=Math.random()*1 balls.push(tmpBall); } addEventListener(Event.ENTER_FRAME, moveme); function moveme(event:Event):void{ var l=balls.length; for(var i=0; i=l; i++){ var bot:Ball = balls[i]; var nextX = bot.xVel+bot.x; var nextY = bot.yVel+bot.y; if (nextXbot.xmax) { bot.xVel = bot.xVel*-1; nextX = bot.xmax-(nextX-bot.xmax); } else if (nextXbot.xmin) { bot.xVel = bot.xVel*-1; nextX = bot.xmin+(bot.xmin-nextX); } if (nextYbot.ymax) { bot.yVel = bot.yVel*-1; nextY = bot.ymax-(nextY-bot.ymax); } else if (nextYbot.ymin) { bot.yVel = bot.yVel*-1; nextY = bot.ymin+(bot.ymin-nextY); } bot.x = nextX; bot.y = nextY; } } [/as] Gives me this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Timeline0_5bf5ad1effb5f4693f4c3e71f1bcfc7/moveme() What am I missing here? And while I'm at it, what's the simple AS3 scripting way (I know the class way) of doing myObj.onEnterFrame=function(){ this.x+=1 //Etc. } Cheers Mike ___ 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] AS3 scripting, first try - some Q's
function moveme(event:Event):void{ You aren't passing in an event there... so perhaps that is causing the vomit? The event gets passed auotmatically, it traces out fine On 7/27/06, Supriya [EMAIL PROTECTED] wrote: its not an AS3 problem, its a small problem in your logic in the function moveme find it out :) Y'see if I could work it out I wouldn't have posted would I? This may be a wood for trees situation, but posts like that just aren't helpful, so what's the point in posting? M ___ 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] AS3 scripting, first try - some Q's
for(var i=0; il; i++){ Not for(var i=0; i=l; i++){ M -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Mountain Sent: 27 July 2006 17:17 To: Flashcoders mailing list Subject: RE: [Flashcoders] AS3 scripting, first try - some Q's function moveme(event:Event):void{ You aren't passing in an event there... so perhaps that is causing the vomit? The event gets passed auotmatically, it traces out fine On 7/27/06, Supriya [EMAIL PROTECTED] wrote: its not an AS3 problem, its a small problem in your logic in the function moveme find it out :) Y'see if I could work it out I wouldn't have posted would I? This may be a wood for trees situation, but posts like that just aren't helpful, so what's the point in posting? M ___ 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] AS3 scripting, first try - some Q's
Anyone got an answer to the second part: what's the simple AS3 scripting way (I know the class way) of doing myObj.onEnterFrame=function(){ this.x+=1 //Etc. } Cheers Mike ___ 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] AS3 scripting, first try - some Q's
add an event listener to the mc Obj? On 7/27/06, Mike Mountain [EMAIL PROTECTED] wrote: Anyone got an answer to the second part: what's the simple AS3 scripting way (I know the class way) of doing myObj.onEnterFrame=function(){ this.x+=1 //Etc. } Cheers Mike ___ 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] AS3 scripting, first try - some Q's
Y'see if I could work it out I wouldn't have posted would I? and u worked it out now! ~Arul Prasad On 7/27/06, Mike Mountain [EMAIL PROTECTED] wrote: for(var i=0; il; i++){ Not for(var i=0; i=l; i++){ M -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Mountain Sent: 27 July 2006 17:17 To: Flashcoders mailing list Subject: RE: [Flashcoders] AS3 scripting, first try - some Q's function moveme(event:Event):void{ You aren't passing in an event there... so perhaps that is causing the vomit? The event gets passed auotmatically, it traces out fine On 7/27/06, Supriya [EMAIL PROTECTED] wrote: its not an AS3 problem, its a small problem in your logic in the function moveme find it out :) Y'see if I could work it out I wouldn't have posted would I? This may be a wood for trees situation, but posts like that just aren't helpful, so what's the point in posting? M ___ 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] AS3 scripting, first try - some Q's
Hi Mike, I didnt know FlashCoders was a place to get one's code reviewed for silly mistakes in logic. Hence I just cleared your way from thinking its an AS3 problem. Anyways glad to know you figured it out. And for your second question, I had already replied to it. On 7/27/06, Mike Mountain [EMAIL PROTECTED] wrote: Anyone got an answer to the second part: what's the simple AS3 scripting way (I know the class way) of doing myObj.onEnterFrame=function(){ this.x+=1 //Etc. } Cheers Mike ___ 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