Re: [Flashcoders] How to call class method from a movieclip?

2008-02-01 Thread Irene Johansson
Thanks people for all replies. Need to stop thinking in  old AS1 way :)

On 1/31/08, Jesse Graupmann <[EMAIL PROTECTED]> wrote:
>
> Funny! Your mom said the same thing to me last night...
>
> ;)
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Steven
> Sacks
> Sent: Wednesday, January 30, 2008 11:04 AM
> To: Flash Coders List
> Subject: Re: [Flashcoders] How to call class method from a movieclip?
>
> Jesse Graupmann wrote:
> > function callMom ()
> > {
> >  trace( "YOU NEVER CALL" );
> > }
>
> While we appreciate your code sample, Jesse, and we're all supportive of
> you, Flashcoders isn't a surrogate for your group therapy sessions.  ;)
>
> Steven Sacks
> Flash Maestro
> Los Angeles, CA
> --
> blog: http://www.stevensacks.net
> gaia: http://www.gaiaflashframework.com
>
>
> ___
> 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] How to call class method from a movieclip?

2008-01-31 Thread Jesse Graupmann
Funny! Your mom said the same thing to me last night...

;)

 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
Sent: Wednesday, January 30, 2008 11:04 AM
To: Flash Coders List
Subject: Re: [Flashcoders] How to call class method from a movieclip?

Jesse Graupmann wrote:
 > function callMom ()
 > {
 >  trace( "YOU NEVER CALL" );
 > }

While we appreciate your code sample, Jesse, and we're all supportive of 
you, Flashcoders isn't a surrogate for your group therapy sessions.  ;)

Steven Sacks
Flash Maestro
Los Angeles, CA
--
blog: http://www.stevensacks.net
gaia: http://www.gaiaflashframework.com


___
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] How to call class method from a movieclip?

2008-01-31 Thread Karina Steffens
Hi Irene,

var contentMCs:MovieClip; = new contentMC(this);

should be

var contentMCs:MovieClip = new contentMC(this);


Karina


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Irene Johansson
> Sent: 30 January 2008 15:54
> To: Flash Coders List
> Subject: Re: [Flashcoders] How to call class method from a movieclip?
> 
> Thank you for your reply.
> by doing this:
> public class myClass extends Sprite{
> 
> public function myClass() {
> var contentMCs:MovieClip; = new contentMC(this);
> }
> 
> public function myMethod(){
> }
> }
> 
> I get this error msg: 1137: Incorrect number of arguments. Expected no
> more
> than 0.
> 
> since contentMC is a
> MovieClip that is attached from library i dont know where to define
> the parameters.
> 
> Thanks for helping me
> Irene
> 
> 
> 
> On 1/30/08, Andy Herrman <[EMAIL PROTECTED]> wrote:
> >
> > If you want your contentMC class to be able to call methods on your
> > myClass then you should probably pass the myClass instance to the
> > contentMC.  Basically, add a parameter to contentMC's constructor of
> > type myClass, and pass a reference to 'this' when you create it.
> > Something like this:
> >
> > public class myClass extends Sprite{
> >
> >   public function myClass() {
> > var contentMCs:MovieClip; = new contentMC(this);
> >   }
> >
> >   public function myMethod(){
> >   }
> > }
> >
> > On an unrelated note: standard practice has class names start with a
> > capital letter, not lowercase like you have.  It helps to
> > differentiate between variable names and class names.
> >
> >   -Andy
> >
> > On Jan 30, 2008 8:42 AM, Irene Johansson <[EMAIL PROTECTED]> wrote:
> > > Hello!
> > > I am having a big problem, hope someone can help me.
> > >
> > > I have made a class which i import in my flash file. The first and
> only
> > > frame of the file looks like this:
> > >
> > > import myClassFolder.*;
> > > var myClassInstance:myClass = new myClass(this.stage);
> > > stop();
> > >
> > > Inside the class i am attaching a movieClip from a library and
> declaring
> > a
> > > methof:
> > >
> > > public class myClass extends Sprite{
> > > var contentMCs:MovieClip = new contentMC();
> > > ...
> > > }
> > > public function myMethod(){
> > > }
> > >
> > > The contentMC contains 8 frames, each of the frame has a movieClip.
> > >
> > > In the frame 2 of the contentMC MovieClip i want to call myMethod
> of the
> > > myClass.
> > > Anyone who know how to do this?
> > > Thanks in advance
> > > Irene
> > > ___
> > > 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
> 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.17/1253 - Release Date:
> 31/01/2008 09:09
> 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.19.17/1253 - Release Date: 31/01/2008
09:09
 

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to call class method from a movieclip?

2008-01-30 Thread Steven Sacks

Jesse Graupmann wrote:
> function callMom ()
> {
>trace( "YOU NEVER CALL" );
> }

While we appreciate your code sample, Jesse, and we're all supportive of 
you, Flashcoders isn't a surrogate for your group therapy sessions.  ;)


Steven Sacks
Flash Maestro
Los Angeles, CA
--
blog: http://www.stevensacks.net
gaia: http://www.gaiaflashframework.com


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] How to call class method from a movieclip?

2008-01-30 Thread Jesse Graupmann


/// IN YOUR .FLA OR SOME CLASS



function callMom ()
{
trace( "YOU NEVER CALL" );
}


var mc:MyClip = new MyClip( this );
addChild ( mc );
mc.phoneHome();  





/// IN MYCLIP.AS AND LINKED IN THE LIBRARY TO YOUR MOVIECLIP




package 
{
import flash.display.MovieClip;
public class MyClip extends MovieClip 
{
public var home:*;
public function MyClip ( home:* )
{
this.home = home;
}

public function phoneHome ():void
{
home.callMom();
}

}
}




/// ON FRAME 2 OF YOUR MOVIECLIP



phoneHome(); 




_

Jesse Graupmann
www.jessegraupmann.com 
www.justgooddesign.com/blog/ 
_



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Wednesday, January 30, 2008 8:00 AM
To: Flash Coders List
Subject: RE: [Flashcoders] How to call class method from a movieclip?

what is contentMC() ?  Looks like it doesn't take any arguments.  Where
is that defined?

Jason Merrill
Bank of America  
GT&O L&LD Solutions Design & Development 
eTools & Multimedia 

Bank of America Flash Platform Developer Community



 

>>-Original Message-
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of Irene Johansson
>>Sent: Wednesday, January 30, 2008 10:54 AM
>>To: Flash Coders List
>>Subject: Re: [Flashcoders] How to call class method from a movieclip?
>>
>>Thank you for your reply.
>>by doing this:
>>public class myClass extends Sprite{
>>
>>public function myClass() {
>>var contentMCs:MovieClip; = new contentMC(this); }
>>
>>public function myMethod(){
>>}
>>}
>>
>>I get this error msg: 1137: Incorrect number of arguments. 
>>Expected no more than 0.
>>
>>since contentMC is a
>>MovieClip that is attached from library i dont know where to 
>>define the parameters.
>>
>>Thanks for helping me
>>Irene
>>
>>
>>
>>On 1/30/08, Andy Herrman <[EMAIL PROTECTED]> wrote:
>>>
>>> If you want your contentMC class to be able to call methods on your 
>>> myClass then you should probably pass the myClass instance to the 
>>> contentMC.  Basically, add a parameter to contentMC's 
>>constructor of 
>>> type myClass, and pass a reference to 'this' when you create it.
>>> Something like this:
>>>
>>> public class myClass extends Sprite{
>>>
>>>   public function myClass() {
>>> var contentMCs:MovieClip; = new contentMC(this);
>>>   }
>>>
>>>   public function myMethod(){
>>>   }
>>> }
>>>
>>> On an unrelated note: standard practice has class names 
>>start with a 
>>> capital letter, not lowercase like you have.  It helps to 
>>> differentiate between variable names and class names.
>>>
>>>   -Andy
>>>
>>> On Jan 30, 2008 8:42 AM, Irene Johansson <[EMAIL PROTECTED]> wrote:
>>> > Hello!
>>> > I am having a big problem, hope someone can help me.
>>> >
>>> > I have made a class which i import in my flash file. The 
>>first and 
>>> > only frame of the file looks like this:
>>> >
>>> > import myClassFolder.*;
>>> > var myClassInstance:myClass = new myClass(this.stage); stop();
>>> >
>>> > Inside the class i am attaching a movieClip from a library and 
>>> > declaring
>>> a
>>> > methof:
>>> >
>>> > public class myClass extends Sprite{ var 
>>contentMCs:MovieClip = new 
>>> > contentMC(); ...
>>> > }
>>> > public function myMethod(){
>>> > }
>>> >
>>> > The contentMC contains 8 frames, each of the frame has a 
>>movieClip.
>>> >
>>> > In the frame 2 of the contentMC MovieClip i want to call 
>>myMethod of 
>>> > the myClass.
>>> > Anyone who know how to do this?
>>> > Thanks in advance
>>> > Irene

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] How to call class method from a movieclip?

2008-01-30 Thread Merrill, Jason
what is contentMC() ?  Looks like it doesn't take any arguments.  Where
is that defined?

Jason Merrill
Bank of America  
GT&O L&LD Solutions Design & Development 
eTools & Multimedia 

Bank of America Flash Platform Developer Community



 

>>-Original Message-
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf 
>>Of Irene Johansson
>>Sent: Wednesday, January 30, 2008 10:54 AM
>>To: Flash Coders List
>>Subject: Re: [Flashcoders] How to call class method from a movieclip?
>>
>>Thank you for your reply.
>>by doing this:
>>public class myClass extends Sprite{
>>
>>public function myClass() {
>>var contentMCs:MovieClip; = new contentMC(this); }
>>
>>public function myMethod(){
>>}
>>}
>>
>>I get this error msg: 1137: Incorrect number of arguments. 
>>Expected no more than 0.
>>
>>since contentMC is a
>>MovieClip that is attached from library i dont know where to 
>>define the parameters.
>>
>>Thanks for helping me
>>Irene
>>
>>
>>
>>On 1/30/08, Andy Herrman <[EMAIL PROTECTED]> wrote:
>>>
>>> If you want your contentMC class to be able to call methods on your 
>>> myClass then you should probably pass the myClass instance to the 
>>> contentMC.  Basically, add a parameter to contentMC's 
>>constructor of 
>>> type myClass, and pass a reference to 'this' when you create it.
>>> Something like this:
>>>
>>> public class myClass extends Sprite{
>>>
>>>   public function myClass() {
>>> var contentMCs:MovieClip; = new contentMC(this);
>>>   }
>>>
>>>   public function myMethod(){
>>>   }
>>> }
>>>
>>> On an unrelated note: standard practice has class names 
>>start with a 
>>> capital letter, not lowercase like you have.  It helps to 
>>> differentiate between variable names and class names.
>>>
>>>   -Andy
>>>
>>> On Jan 30, 2008 8:42 AM, Irene Johansson <[EMAIL PROTECTED]> wrote:
>>> > Hello!
>>> > I am having a big problem, hope someone can help me.
>>> >
>>> > I have made a class which i import in my flash file. The 
>>first and 
>>> > only frame of the file looks like this:
>>> >
>>> > import myClassFolder.*;
>>> > var myClassInstance:myClass = new myClass(this.stage); stop();
>>> >
>>> > Inside the class i am attaching a movieClip from a library and 
>>> > declaring
>>> a
>>> > methof:
>>> >
>>> > public class myClass extends Sprite{ var 
>>contentMCs:MovieClip = new 
>>> > contentMC(); ...
>>> > }
>>> > public function myMethod(){
>>> > }
>>> >
>>> > The contentMC contains 8 frames, each of the frame has a 
>>movieClip.
>>> >
>>> > In the frame 2 of the contentMC MovieClip i want to call 
>>myMethod of 
>>> > the myClass.
>>> > Anyone who know how to do this?
>>> > Thanks in advance
>>> > Irene
>>> > ___
>>> > 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


Re: [Flashcoders] How to call class method from a movieclip?

2008-01-30 Thread Irene Johansson
Thank you for your reply.
by doing this:
public class myClass extends Sprite{

public function myClass() {
var contentMCs:MovieClip; = new contentMC(this);
}

public function myMethod(){
}
}

I get this error msg: 1137: Incorrect number of arguments. Expected no more
than 0.

since contentMC is a
MovieClip that is attached from library i dont know where to define
the parameters.

Thanks for helping me
Irene



On 1/30/08, Andy Herrman <[EMAIL PROTECTED]> wrote:
>
> If you want your contentMC class to be able to call methods on your
> myClass then you should probably pass the myClass instance to the
> contentMC.  Basically, add a parameter to contentMC's constructor of
> type myClass, and pass a reference to 'this' when you create it.
> Something like this:
>
> public class myClass extends Sprite{
>
>   public function myClass() {
> var contentMCs:MovieClip; = new contentMC(this);
>   }
>
>   public function myMethod(){
>   }
> }
>
> On an unrelated note: standard practice has class names start with a
> capital letter, not lowercase like you have.  It helps to
> differentiate between variable names and class names.
>
>   -Andy
>
> On Jan 30, 2008 8:42 AM, Irene Johansson <[EMAIL PROTECTED]> wrote:
> > Hello!
> > I am having a big problem, hope someone can help me.
> >
> > I have made a class which i import in my flash file. The first and only
> > frame of the file looks like this:
> >
> > import myClassFolder.*;
> > var myClassInstance:myClass = new myClass(this.stage);
> > stop();
> >
> > Inside the class i am attaching a movieClip from a library and declaring
> a
> > methof:
> >
> > public class myClass extends Sprite{
> > var contentMCs:MovieClip = new contentMC();
> > ...
> > }
> > public function myMethod(){
> > }
> >
> > The contentMC contains 8 frames, each of the frame has a movieClip.
> >
> > In the frame 2 of the contentMC MovieClip i want to call myMethod of the
> > myClass.
> > Anyone who know how to do this?
> > Thanks in advance
> > Irene
> > ___
> > 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] How to call class method from a movieclip?

2008-01-30 Thread Kenneth Kawamoto
Looks to me your Class "MyClass" should be the Document class. If you 
set it as Document class, you can attach your MovieClip like this, 
because the root timeline is MyClass itself:


var contentMCs:MovieClip = new ContentMC();
addChild(contentMCs);

Then from your MovieClip, you can call MyClass function "myMethod" like 
this:


MyClass(parent).myMethod();

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Irene Johansson wrote:

Hello!
I am having a big problem, hope someone can help me.

I have made a class which i import in my flash file. The first and only
frame of the file looks like this:

import myClassFolder.*;
var myClassInstance:myClass = new myClass(this.stage);
stop();

Inside the class i am attaching a movieClip from a library and declaring a
methof:

public class myClass extends Sprite{
var contentMCs:MovieClip = new contentMC();
...
}
public function myMethod(){
}

The contentMC contains 8 frames, each of the frame has a movieClip.

In the frame 2 of the contentMC MovieClip i want to call myMethod of the
myClass.
Anyone who know how to do this?
Thanks in advance
Irene

  

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] How to call class method from a movieclip?

2008-01-30 Thread Andy Herrman
If you want your contentMC class to be able to call methods on your
myClass then you should probably pass the myClass instance to the
contentMC.  Basically, add a parameter to contentMC's constructor of
type myClass, and pass a reference to 'this' when you create it.
Something like this:

public class myClass extends Sprite{

  public function myClass() {
var contentMCs:MovieClip; = new contentMC(this);
  }

  public function myMethod(){
  }
}

On an unrelated note: standard practice has class names start with a
capital letter, not lowercase like you have.  It helps to
differentiate between variable names and class names.

  -Andy

On Jan 30, 2008 8:42 AM, Irene Johansson <[EMAIL PROTECTED]> wrote:
> Hello!
> I am having a big problem, hope someone can help me.
>
> I have made a class which i import in my flash file. The first and only
> frame of the file looks like this:
>
> import myClassFolder.*;
> var myClassInstance:myClass = new myClass(this.stage);
> stop();
>
> Inside the class i am attaching a movieClip from a library and declaring a
> methof:
>
> public class myClass extends Sprite{
> var contentMCs:MovieClip = new contentMC();
> ...
> }
> public function myMethod(){
> }
>
> The contentMC contains 8 frames, each of the frame has a movieClip.
>
> In the frame 2 of the contentMC MovieClip i want to call myMethod of the
> myClass.
> Anyone who know how to do this?
> Thanks in advance
> Irene
> ___
> 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] How to call class method from a movieclip?

2008-01-30 Thread Irene Johansson
Hello!
I am having a big problem, hope someone can help me.

I have made a class which i import in my flash file. The first and only
frame of the file looks like this:

import myClassFolder.*;
var myClassInstance:myClass = new myClass(this.stage);
stop();

Inside the class i am attaching a movieClip from a library and declaring a
methof:

public class myClass extends Sprite{
var contentMCs:MovieClip = new contentMC();
...
}
public function myMethod(){
}

The contentMC contains 8 frames, each of the frame has a movieClip.

In the frame 2 of the contentMC MovieClip i want to call myMethod of the
myClass.
Anyone who know how to do this?
Thanks in advance
Irene
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders