Geografiek, Jason,

Thank you very much.
Now it works!

K.

--- On Fri, 9/11/09, Geografiek <geograf...@geografiek.nl> wrote:

> From: Geografiek <geograf...@geografiek.nl>
> Subject: Re: [Flashcoders] Access dynamically created MovieClip from class?
> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
> Date: Friday, September 11, 2009, 9:11 PM
> Hi k.
> That's because ClassDraw cannot find the Main class. You
> have to get  
> your class paths right.
> Maybe this earlier post helps:
> ++++
> > 1) Flash -> Preferences -> Actionscript ->
> ActionScript 3.0 Settings
> > This is a global configuration. It affects every fla
> document you  
> > export (i.e., when you compile a fla, the compiler
> will look up  
> > these paths)
> > 2) File -> Publish Settings -> (ActionScript
> version) ActionScript  
> > 3.0 Settings
> > This a per fla file configuration. It only affects the
> fla and it  
> > has a
> > higher priority than the global classpath.
> >
> > What does that mean?
> > Suppose you have these settings:
> > In your global classpath:
> > C:\Actionscript\Classes\ (it's a windows path but it
> works the same  
> > way for Mac, I think)
> >
> > In your fla classpath:
> > C:\Myprojects\someProject\src\
> >
> > So, you have a class somePackage.someClass in both
> C:\Actionscript 
> > \Classes\ and C:\Myprojects\someProject\src\.
> > The class that will be compiled is the one in
> C:\Myprojects 
> > \someProject\src\, because it has a higher priority,
> since it's set  
> > up in the fla file. Take that into account to avoid
> some hard to  
> > find bugs caused by these kind of "conflicts" (which
> are not such  
> > for the compiler but might be hard to spot and cause
> some  
> > apparently odd behavior)
> >
> > Cheers
> > Juan Pablo Califano
> 
> ++++
> HTH
> Willem van den Goorbergh
> 
> On 11-sep-2009, at 19:25, ktt wrote:
> 
> > Thank you for your help. I'm trying dynamicaly create
> a movieclip  
> > and be able to modify it, add and remove listeners
> etc. accesing it  
> > from any class.
> >
> >
> > Your example throws errors:
> > 1046: Type was not found or was not a compile-time
> constant: Main
> > 1180: Call to a possibly undefined method Main
> > 1172: Definition Main could not be found // while
> trying to import
> >
> > both classes are in the same directory.
> >
> > k.
> > --- On Fri, 9/11/09, Merrill, Jason  
> > <jason.merr...@bankofamerica.com>
> wrote:
> >
> >> From: Merrill, Jason <jason.merr...@bankofamerica.com>
> >> Subject: RE: [Flashcoders] Access dynamically
> created MovieClip  
> >> from class?
> >> To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
> >> Date: Friday, September 11, 2009, 5:52 PM
> >> Not sure what you are trying to
> >> accomplish in what you are building (because I am
> suspicious
> >> your architectural approach may be a bit off -
> maybe), but
> >> to just answer your question, in the Main class,
> define the
> >> drawingSign Movie clip as a public variable like
> this:
> >>
> >> package
> >> {
> >>     import
> flash.display.MovieClip;
> >>
> >>     public class Main
> >>     {
> >>         //define it
> as public
> >> here:
> >>         public var
> >> drawingSign:MovieClip;
> >>
> >>         public
> function
> >> Main():void
> >>         {
> >>
> >> //create it here:
> >>
> >> drawingSign = new MovieClip();
> >>
> >> //blah blah more code here.
> >>         }
> >>     }
> >> }
> >>
> >> Then, in your other class ClassDraw, import Main
> and create
> >> an instance of it:
> >>
> >> package
> >> {
> >>     import
> flash.display.MovieClip;
> >>     import Main;
> >>
> >>     public class ClassDraw
> extends
> >> MovieClip
> >>     {
> >>         private var
> >> _main:Main;
> >>
> >>         public
> function
> >> ClassDraw():void
> >>         {
> >>
> >> //create an instance of Main:
> >>
> >> _main = new Main();
> >>
> >> //access the MovieClip you want in the other
> class:
> >>
> >> trace(_main.drawingSign)
> >>
> >> //blah blah more code here.
> >>         }
> >>     }
> >> }
> >>
> >>
> >> Jason Merrill
> >>
> >> Bank of  America   Global
> Learning
> >> Learning & Performance Soluions
> >>
> >> Monthly meetings on making the most of the Adobe
> Flash
> >> Platform - presented by bank associates, Adobe
> engineers,
> >> and outside experts in the borader multimedia
> community -
> >> join the Bank of America Flash Platform Community
> >> (note: this is for Bank of America employees
> only)
> >>
> >>
> >>
> >>
> >> -----Original Message-----
> >> From: flashcoders-boun...@chattyfig.figleaf.com
> >> [mailto:flashcoders-boun...@chattyfig.figleaf.com]
> >> On Behalf Of ktt
> >> Sent: Friday, September 11, 2009 10:25 AM
> >> To: Flash Coders List
> >> Subject: RE: [Flashcoders] Access dynamically
> created
> >> MovieClip from class?
> >>
> >> Thank you the answer, but maybe I didn't define
> situation
> >> clearly:
> >>
> >> I have two separate files main.as and
> classdraw.as
> >>
> >> Movieclip is defined in main.as:
> >>
> >> var drawingSign:Movieclip = new MovieClip();
> >> drawingSign.x = 40;
> >> drawingSign.y = 40;
> >>
> //drawingSign.addEventListener(MouseEvent.CLICK,mc_clicked);
> >> addChild(drawingSign);
> >>
> >> I want to access drawingSign from my other
> classdraw.as
> >> file:
> >>
> >> package (
> >>
> >> import flash.events.*;
> >> import flash.display.*;
> >> import flash.utils.*;
> >>
> >> public class classdraw extends MovieClip {
> >>
> >> private var newSign:drawingSign = new
> drawingSign(); // as
> >> it is used to access objects from Library
> >>
> >> public function classdraw() {
> >>
> >> addChild (newSign);
> >>
> >> }
> >>
> >> But I geting errors :
> >> 1046: Type was not found or was not a
> compile-time
> >> constant: drawingSign.
> >> 1180; Call to a possibly undefined method
> drawingSign.
> >>
> >> Regards,
> >> Kioshin
> >>
> >> --- On Fri, 9/11/09, Cor <c...@chello.nl>
> >> wrote:
> >>
> >>> From: Cor <c...@chello.nl>
> >>> Subject: RE: [Flashcoders] Access dynamically
> created
> >> MovieClip from class?
> >>> To: "'Flash Coders List'" <flashcoders@chattyfig.figleaf.com>
> >>> Date: Friday, September 11, 2009, 4:58 PM
> >>> var drawingSign:Movieclip = new
> >>> MovieClip(); //you forgot the "w" of new
> >>> drawingSign.x = 40;
> >>> drawingSign.y = 40;
> >>>
> drawingSign.addEventListener(MouseEvent.CLICK,
> >>> mc_clicked);
> >>> addChild(drawingSign);
> >>>
> >>> private function
> mc_clicked(e:MouseEvent):void{
> >>>     trace("You have
> clicked drawingSign");
> >>> }
> >>>
> >>>
> >>> -----Original Message-----
> >>> From: flashcoders-boun...@chattyfig.figleaf.com
> >>> [mailto:flashcoders-boun...@chattyfig.figleaf.com]
> >>> On Behalf Of ktt
> >>> Sent: vrijdag 11 september 2009 15:40
> >>> To: Flash Coders List
> >>> Subject: [Flashcoders] Access dynamically
> created
> >> MovieClip
> >>> from class?
> >>>
> >>> Hello,
> >>>
> >>> I have created Movieclip in main actionscript
> file
> >> main.as
> >>> :
> >>>
> >>> var drawingSign:Movieclip = ne MovieClip();
> >>> drawingSign.x = 40;
> >>> drawingSign.y = 40;
> >>>
> >>> How could I access it (add listeners etc.)
> from a
> >> class
> >>> file?
> >>> Is it possible?
> >>>
> >>> Thank you in advance,
> >>> kioshin
> >>>
> >>>
> >>>
> >>>
> _______________________________________________
> >>> 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
> >>
> >> _______________________________________________
> >> 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
> 
> 
> 
> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
> Geografiek is a Dutch, Utrecht-based map and chart design
> company.
> Willem van den Goorbergh can be contacted by telephone:
> (+31) 
> 30-2719512 or cell phone: (+31)6-26372378
> or by fax: (+31)302719687
> snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
> Visit our website at: http://www.geografiek.nl
> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
> 
> 
> 
> 
> _______________________________________________
> 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

Reply via email to