Re: [Flashcoders] access a mc in stage from a class
thanks jason. I'll do that. any good (easy to understand) oop book out there? - Original Message - From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 7:55 PM Subject: RE: [Flashcoders] access a mc in stage from a class Forget the timeline. Associate each of your movieclips in your library with a corresponding class that extends Sprite or MovieClip. Then instantiate and add each as children to your document class. I won't go into design patterns like MVC and how you would do that, but this would be a basic setup and allow you total control over all instances. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 6:44 PM To: Flash Coders List Subject: Re: [Flashcoders] access a mc in stage from a class the first version I tried to do was like you mentioned. but had the first problem (access the mc on stage) and swiched to the document class.. the project is a recorder, so I did 3 classes, connection, mic and recorder. in the main timeline I import all the 3 classes then I create a instance of each (timeline code not document class). the problem start here because i want a mic and recorder instance ONLY if the connection class could connect. that is different from : //this will ceatae them all at once without care about connection ok or no.. mymic:CustomMic = new CustomMic() myconn:CustomConn = new CustomConn() myRecorder:CustomRec = new CustomRec() how can I have something like listening for the connection class event NetConnection.Connect.Success and then this something would create the mic and the recorder instances. I can not tie any creation of new instances of the recorder and mic class to the NetConnection.Connect.Success because this conn class will be used in other projects and it's not always that i would need them. thanks, rodrigo. - Original Message - From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 3:49 PM Subject: RE: [Flashcoders] access a mc in stage from a class Not to the constructor of a document class, but you should think about what you're trying to accomplish. I would recommend if you're moving to AS3 classes, you break this project into varying classes that are instantiated from the document class. You can of course send arguments to the constructors of other classes. I wouldn't recommend mixing timeline code and external classes. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 2:43 PM To: 'Flash Coders List' Subject: Re: [Flashcoders] access a mc in stage from a class cor, jason. that did the trick thanks and led to a new problem. declaring as a class document makes the contructor rum automatically when the movie loads correct? can I pass some parameters to the document class constructor? - Original Message - From: Cor c...@chello.nl To: 'Rodrigo Augusto Guerra' rodr...@alumni.org.br; 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 1:25 PM Subject: RE: [Flashcoders] access a mc in stage from a class Did you set this one Class as Document Class in the properties panel? Groeten, Cor van Dooren -- There are only 10 types of people in the world: Those who understand binary and those who don't. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: donderdag 9 september 2010 18:18 To: Flash Coders List Subject: [Flashcoders] access a mc in stage from a class hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage
Re: [Flashcoders] access a mc in stage from a class
Amazon.com is your friend. Reviews are helpful. Google Voice: (508) 656-0622 Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki http://blog.ericd.net On Fri, Sep 10, 2010 at 10:23 AM, Rodrigo Augusto Guerra rodr...@alumni.org.br wrote: thanks jason. I'll do that. any good (easy to understand) oop book out there? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] access a mc in stage from a class
hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage in order to access i´'s properties and methods? tried with addChild too but had no luck. thanks, rodrigo. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] access a mc in stage from a class
Did you set this one Class as Document Class in the properties panel? Groeten, Cor van Dooren -- There are only 10 types of people in the world: Those who understand binary and those who dont. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: donderdag 9 september 2010 18:18 To: Flash Coders List Subject: [Flashcoders] access a mc in stage from a class hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage in order to access i´'s properties and methods? tried with addChild too but had no luck. thanks, rodrigo. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.851 / Virusdatabase: 271.1.1/3123 - datum van uitgifte: 09/08/10 19:41:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] access a mc in stage from a class
Is foo the Document class in your .fla? If so, you can just call the instance name from that class. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 12:18 PM To: Flash Coders List Subject: [Flashcoders] access a mc in stage from a class hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage in order to access i´'s properties and methods? tried with addChild too but had no luck. thanks, rodrigo. ___ 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] access a mc in stage from a class
Not to the constructor of a document class, but you should think about what you're trying to accomplish. I would recommend if you're moving to AS3 classes, you break this project into varying classes that are instantiated from the document class. You can of course send arguments to the constructors of other classes. I wouldn't recommend mixing timeline code and external classes. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 2:43 PM To: 'Flash Coders List' Subject: Re: [Flashcoders] access a mc in stage from a class cor, jason. that did the trick thanks and led to a new problem. declaring as a class document makes the contructor rum automatically when the movie loads correct? can I pass some parameters to the document class constructor? - Original Message - From: Cor c...@chello.nl To: 'Rodrigo Augusto Guerra' rodr...@alumni.org.br; 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 1:25 PM Subject: RE: [Flashcoders] access a mc in stage from a class Did you set this one Class as Document Class in the properties panel? Groeten, Cor van Dooren -- There are only 10 types of people in the world: Those who understand binary and those who don't. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: donderdag 9 september 2010 18:18 To: Flash Coders List Subject: [Flashcoders] access a mc in stage from a class hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage in order to access i´'s properties and methods? tried with addChild too but had no luck. thanks, rodrigo. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.851 / Virusdatabase: 271.1.1/3123 - datum van uitgifte: 09/08/10 19:41:00 ___ 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] access a mc in stage from a class
Of course I agree with Jason. Another option in this case is not using the Document class (which is the best practice), but in your first frame at the top of your actionscript, something like this: var myFoo:Foo = new Foo(); Groeten, Cor van Dooren -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: donderdag 9 september 2010 20:50 To: Flash Coders List Subject: RE: [Flashcoders] access a mc in stage from a class Not to the constructor of a document class, but you should think about what you're trying to accomplish. I would recommend if you're moving to AS3 classes, you break this project into varying classes that are instantiated from the document class. You can of course send arguments to the constructors of other classes. I wouldn't recommend mixing timeline code and external classes. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 2:43 PM To: 'Flash Coders List' Subject: Re: [Flashcoders] access a mc in stage from a class cor, jason. that did the trick thanks and led to a new problem. declaring as a class document makes the contructor rum automatically when the movie loads correct? can I pass some parameters to the document class constructor? - Original Message - From: Cor c...@chello.nl To: 'Rodrigo Augusto Guerra' rodr...@alumni.org.br; 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 1:25 PM Subject: RE: [Flashcoders] access a mc in stage from a class Did you set this one Class as Document Class in the properties panel? Groeten, Cor van Dooren -- There are only 10 types of people in the world: Those who understand binary and those who don't. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: donderdag 9 september 2010 18:18 To: Flash Coders List Subject: [Flashcoders] access a mc in stage from a class hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage in order to access i´'s properties and methods? tried with addChild too but had no luck. thanks, rodrigo. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.851 / Virusdatabase: 271.1.1/3123 - datum van uitgifte: 09/08/10 19:41:00 ___ 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 Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.851 / Virusdatabase: 271.1.1/3123 - datum van uitgifte: 09/08/10 19:41:00 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] access a mc in stage from a class
Rodrigo Augusto Guerra skriver: can I pass some parameters to the document class constructor? Well, who is instantiating the class? The one instantiating it has to know what arguments to pass. That one is the player and the player has no idea what to pass. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] access a mc in stage from a class
the first version I tried to do was like you mentioned. but had the first problem (access the mc on stage) and swiched to the document class.. the project is a recorder, so I did 3 classes, connection, mic and recorder. in the main timeline I import all the 3 classes then I create a instance of each (timeline code not document class). the problem start here because i want a mic and recorder instance ONLY if the connection class could connect. that is different from : //this will ceatae them all at once without care about connection ok or no.. mymic:CustomMic = new CustomMic() myconn:CustomConn = new CustomConn() myRecorder:CustomRec = new CustomRec() how can I have something like listening for the connection class event NetConnection.Connect.Success and then this something would create the mic and the recorder instances. I can not tie any creation of new instances of the recorder and mic class to the NetConnection.Connect.Success because this conn class will be used in other projects and it's not always that i would need them. thanks, rodrigo. - Original Message - From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 3:49 PM Subject: RE: [Flashcoders] access a mc in stage from a class Not to the constructor of a document class, but you should think about what you're trying to accomplish. I would recommend if you're moving to AS3 classes, you break this project into varying classes that are instantiated from the document class. You can of course send arguments to the constructors of other classes. I wouldn't recommend mixing timeline code and external classes. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 2:43 PM To: 'Flash Coders List' Subject: Re: [Flashcoders] access a mc in stage from a class cor, jason. that did the trick thanks and led to a new problem. declaring as a class document makes the contructor rum automatically when the movie loads correct? can I pass some parameters to the document class constructor? - Original Message - From: Cor c...@chello.nl To: 'Rodrigo Augusto Guerra' rodr...@alumni.org.br; 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 1:25 PM Subject: RE: [Flashcoders] access a mc in stage from a class Did you set this one Class as Document Class in the properties panel? Groeten, Cor van Dooren -- There are only 10 types of people in the world: Those who understand binary and those who don't. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: donderdag 9 september 2010 18:18 To: Flash Coders List Subject: [Flashcoders] access a mc in stage from a class hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage in order to access i´'s properties and methods? tried with addChild too but had no luck. thanks, rodrigo. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.851 / Virusdatabase: 271.1.1/3123 - datum van uitgifte: 09/08/10 19:41:00 ___ 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] access a mc in stage from a class
Forget the timeline. Associate each of your movieclips in your library with a corresponding class that extends Sprite or MovieClip. Then instantiate and add each as children to your document class. I won't go into design patterns like MVC and how you would do that, but this would be a basic setup and allow you total control over all instances. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 6:44 PM To: Flash Coders List Subject: Re: [Flashcoders] access a mc in stage from a class the first version I tried to do was like you mentioned. but had the first problem (access the mc on stage) and swiched to the document class.. the project is a recorder, so I did 3 classes, connection, mic and recorder. in the main timeline I import all the 3 classes then I create a instance of each (timeline code not document class). the problem start here because i want a mic and recorder instance ONLY if the connection class could connect. that is different from : //this will ceatae them all at once without care about connection ok or no.. mymic:CustomMic = new CustomMic() myconn:CustomConn = new CustomConn() myRecorder:CustomRec = new CustomRec() how can I have something like listening for the connection class event NetConnection.Connect.Success and then this something would create the mic and the recorder instances. I can not tie any creation of new instances of the recorder and mic class to the NetConnection.Connect.Success because this conn class will be used in other projects and it's not always that i would need them. thanks, rodrigo. - Original Message - From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 3:49 PM Subject: RE: [Flashcoders] access a mc in stage from a class Not to the constructor of a document class, but you should think about what you're trying to accomplish. I would recommend if you're moving to AS3 classes, you break this project into varying classes that are instantiated from the document class. You can of course send arguments to the constructors of other classes. I wouldn't recommend mixing timeline code and external classes. Jason Merrill Instructional Technology Architect Bank of America Global Learning Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (Note: these resources are only available for Bank of America associates) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: Thursday, September 09, 2010 2:43 PM To: 'Flash Coders List' Subject: Re: [Flashcoders] access a mc in stage from a class cor, jason. that did the trick thanks and led to a new problem. declaring as a class document makes the contructor rum automatically when the movie loads correct? can I pass some parameters to the document class constructor? - Original Message - From: Cor c...@chello.nl To: 'Rodrigo Augusto Guerra' rodr...@alumni.org.br; 'Flash Coders List' flashcoders@chattyfig.figleaf.com Sent: Thursday, September 09, 2010 1:25 PM Subject: RE: [Flashcoders] access a mc in stage from a class Did you set this one Class as Document Class in the properties panel? Groeten, Cor van Dooren -- There are only 10 types of people in the world: Those who understand binary and those who don't. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Rodrigo Augusto Guerra Sent: donderdag 9 september 2010 18:18 To: Flash Coders List Subject: [Flashcoders] access a mc in stage from a class hi, i'm trying to migrate from as2... and I need to access a mc named mc1 that is on stage. no class associated with this mc, only 1 class for the entire movie. I have the following class: package { import flash.display.*; import flash.events.*; public class foo { //constructor public function foo():void { trace(hi) mc1.x+=30; - don't work. } } how can I inform the class that I have a mc (mc1) in the stage in order to access i´'s properties and methods? tried with addChild too but had no luck. thanks, rodrigo. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com