In addition to the comment:
private var newSign:drawingSign = new drawingSign(); // as it is used to
access objects from Library

And if you have Movieclips in your library, give them a Linkage (right click
on the MC in library) and you can instantiate it everywhere.


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of ktt
Sent: vrijdag 11 september 2009 16:25
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 <[email protected]> wrote:

> From: Cor <[email protected]>
> Subject: RE: [Flashcoders] Access dynamically created MovieClip from
class?
> To: "'Flash Coders List'" <[email protected]>
> 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: [email protected]
> [mailto:[email protected]]
> 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
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



      

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to