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] pass variables between classes in AS3
I could not get your problem exactly, but is this what you are looking for? //The document class package { import flash.display.MovieClip; public class myClass extends MovieClip { public static var myArr:Array=[1,2,3]; private var myC2 = new myClass2 function myClass() { sendArrays() } function sendArrays() { var someArr = [5,6,7] myC2.getArrays(myArr,someArr) } } } // the other class package { import flash.display.MovieClip; public class myClass2 extends MovieClip { function myClass2() { } function getArrays(a,b) { trace(hey = +a) trace(hey2 = +b) } } } If this is not what you are looking for, could you explain your question a bit more in detail? thanks - Original Message - From: Carl Welch [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Thursday, July 27, 2006 12:39 PM Subject: [Flashcoders] pass variables between classes in AS3 I have an AS3 document class where I load and parse an xml file into an array. I would like to pass that array to a movieclip(?) class - basically its a button that will create new movieclips that will differ based on my xml array. How in the world do I get the array from the document class to other classes... arggg! as3 is blowing my mind. I've googled but I can't find anything that make sense to my as2 brain. Thanks again. -- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 ___ 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
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
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
Re: [Flashcoders] as3 and attachmovie
In the library, right click on the symbol , click on Linkage. There select the checkbox Export for ActionScript. Give a name (gf) in the class field, flash will autogenerate a class for you with that name Now on timeline do this var myGf = new gf() this.addChild(myGf) this is equivalent to attachMovie - Original Message - From: Carl Welch [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Wednesday, July 26, 2006 2:44 PM Subject: Re: [Flashcoders] as3 and attachmovie OK. I am trying to learn how to use classes and have had some success - But what I just can't seem to grasp in this situation is if I use this: var newMC=new MovieClip(); this.addChild(newMC); instead of this: attachmovie(gf,gf+_root.getNextHighestDepth(),_root.getNextHighestDepth How do I select gf as the movieclip to be added to the stage? Thanks. On 7/25/06, Meinte van't Kruis [EMAIL PROTECTED] wrote: Carl, Everything in AS3 is classes, so you can't do anything without using classes. It's actually easier than attachmovie. Just make a var newMC=new MovieClip(); this.addChild(newMC); feels alot cleaner that attachmovie(gf,gf+_root.getNextHighestDepth(),_root.getNextHighestDepth()); doesn't it ;). good luck! Meinte ps. you can checkout senocular.com , he has some excellent tutorials on AS3 On 7/25/06, eka [EMAIL PROTECTED] wrote: Hello :) read in french : - http://iteratif.free.fr/blog/index.php?2006/07/11/44-bibliotheque-partagee-sous-flash-9 attachMovie is remove in AS3 :) Use [embed(source=)] metadata and create the instance with new MyClass and addChild() method :) eKA+ :) 2006/7/25, Carl Welch [EMAIL PROTECTED]: I just downloaded the demo of Flash 9 / as3 and I noticed you can't use attachmovie anymore. I've found some new methods on google but it seems like the only way I can do it is by using classes. Is there another way to handle an attachmovie equivilent without using a class in as3? thanks. -- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 ___ 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 -- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 ___ 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] send and read datas
I think you need to specify allowDomain(www.laurentcuchet.fr) in sys1.swf in B - Original Message - From: Laurent CUCHET [EMAIL PROTECTED] To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com Sent: Tuesday, July 25, 2006 4:29 PM Subject: [Flashcoders] send and read datas Hi I try to read data as this and I meet security problem : Theres two domains A : http://www.laurentcuchet.fr/test/ B : http://www.aniblog.com 1. index.swf from A load sys1.swf from A : sys1 can read index.swf datas 2. index.swf from A load sys1.swf from B : sys1 can¹t read index.swf datas Actionscript from index : System.security.allowDomain(www.aniblog.fr,aniblog.fr,http://www.aniblo g.fr); var link = http://www.aniblog.com/;; this.var1.text = test; stop(); Wwhen button is clicked you load local from A or external from B There¹s ³crossdomain.xml² on each basedomain, ?xml version=1.0? !DOCTYPE cross-domain-policy SYSTEM http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd; cross-domain-policy allow-access-from domain=www.aniblog.com / allow-access-from domain=www.laurentcuchet.fr / allow-access-from domain=aniblog.com / allow-access-from domain=laurentcuchet.fr / allow-access-from domain=* / /cross-domain-policy HTML : security: allowScriptAccess=always Thank for your help Laurent Msn : [EMAIL PROTECTED] ___ 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