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 (nextX>bot.xmax) { bot.xVel = bot.xVel*-1; nextX = bot.xmax-(nextX-bot.xmax); } else if (nextX<bot.xmin) { bot.xVel = bot.xVel*-1; nextX = bot.xmin+(bot.xmin-nextX); } if (nextY>bot.ymax) { bot.yVel = bot.yVel*-1; nextY = bot.ymax-(nextY-bot.ymax); } else if (nextY<bot.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