I have created a Class that has 2 functions within it
Function 1 loads a movie clip
Function 2 removes the movieclip
I have a button setup in function 1 that reads like this:
target_mc.closer_mc.onRelease = function()
removeMC();
};
you have scope issues, the function never gets called because the MovieClip
cant see it.
target_mc.closer_mc.onRelease = function()
_parent.removeMC();
};
or if you are in AS2 you can also use Delegate
target_mc.closer_mc.onRelease =
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Function call from a function
I have created a Class that has 2 functions within it
Function 1 loads a movie clip
Function 2 removes the movieclip
I have a button setup in function 1 that reads like this:
target_mc.closer_mc.onRelease
PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Lee Marshall
Sent: 07 September 2007 15:48
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Function call from a function
I have created a Class that has 2 functions within it
Function 1 loads a movie clip
Function 2
can we see all the code? probably a scoping issue.
On 9/7/07, Lee Marshall [EMAIL PROTECTED] wrote:
I have created a Class that has 2 functions within it
Function 1 loads a movie clip
Function 2 removes the movieclip
I have a button setup in function 1 that reads like this:
, 2007 10:48 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Function call from a function
I have created a Class that has 2 functions within it
Function 1 loads a movie clip
Function 2 removes the movieclip
I have a button setup in function 1 that reads like
Function function1()
{
target_mc.closer_mc.classRef = this;
target_mc.closer_mc.onRelease = function()
this.classRef.removeMC();
};
}
That's how I used to do it before I discovered Delegate. I wouldn't
You're having scope issues. When the onRelease function is called its
scope is the movie clip (closer_mc), not the class. Try this:
At the top of your class' file:
import mx.utils.Delegate;
Then define the onRelease function this way:
target_mc.closer_mc.onRelease = Delegate.create(this,
Still not working... I think it is a scoping issue.
Here's my code (Excuse the bloat, I am very much learning!)
import flash.filters.DropShadowFilter;
import mx.utils.Delegate;
class PopupIll {
//Initialise variables
public static var t:MovieClip;
public static var
Still not working... I think it is a scoping issue.
Yup. You're still using anonymous functions:
swfListen.onLoadInit = function(target_mc:MovieClip):Void {
Those don't fly in AS2 classes very well. You can use them once, but
anything within them will have only the scope of the specific
code in one place
instead of on the individual clips. So that's something.
Hal
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lee Marshall
Sent: Friday, September 07, 2007 10:24 AM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Function
target_mc.closer_mc.onRelease = Delegate.create(this, getPopHolder);
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lee Marshall
Sent: 07 September 2007 18:24
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Function call from
Should be something more like this.
target_mc.closer_mc.addEventListener(onRelease,
Delegate.create(this, getPopHolder));
Or, I would just do this instead:
target_mc.closer_mc.onRelease = Delegate.create(this, getPopHolder);
(Then of course in AS3 you do:
Sorry is this an advanced forum?
From: [EMAIL PROTECTED] on behalf of Helmut Granda
Sent: Fri 07/09/2007 16:14
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Function call from a function
you have scope issues, the function never gets called
: [Flashcoders] Function call from a function
Should be something more like this.
target_mc.closer_mc.addEventListener(onRelease,
Delegate.create(this, getPopHolder));
Or, I would just do this instead:
target_mc.closer_mc.onRelease = Delegate.create(this, getPopHolder);
(Then of course in AS3 you do
: [Flashcoders] Function call from a function
Sorry is this an advanced forum?
From: [EMAIL PROTECTED] on behalf of
Helmut Granda
Sent: Fri 07/09/2007 16:14
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Function call from a function
you have scope
-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Hal Leonard
Sent: Friday, September 07, 2007 3:53 PM
To: flashcoders@chattyfig.figleaf.com
Subject: RE: [Flashcoders] Function call from a function
Jason -
Is there any reason for not using the event Listener? Just
curious
Lee Marshall wrote:
Sorry is this an advanced forum?
Pretty much, yes. Flashnewbie is a better forum when you're just coming up
to speed. Not that we don't want you here--it's just that we usually discuss
more esoteric issues.
Newbie sounds like it's really just very basic, but there are some
On Sep 7, 2007, at 4:32 PM, Kerry Thompson wrote:
I never felt out of place, and,
once I felt I had a good enough handle on Flash's way of doing
things, I
signed up for Flashcoders.
Liar. ;-)
You went the other way. We kicked you up to FlashCoders.
--
Troy
RPSystems, Ltd.
Troy Rollins wrote:
Liar. ;-)
You went the other way. We kicked you up to FlashCoders.
There's a fair amount of truth in that. As I progressed (slowly, very
slowly), I finally reached a point where my questions were too advanced for
Newbie. Troy did, indeed, suggest that Flashcoders would
20 matches
Mail list logo