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: [email protected]
[mailto:[email protected]] 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: [email protected]
[mailto:[email protected]] 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" <[email protected]>
To: "'Rodrigo Augusto Guerra'" <[email protected]>; "'Flash Coders 
List'" <[email protected]>
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: [email protected]
[mailto:[email protected]] 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
[email protected]
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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to