Hi Wouter,
Delegate.create() doesn't _call_ a function, it just creates a Function
variable for later use. Which is like a reference to a function.
By calling:
container_mc.onRelease = Delegate.create(this, startTimer);
You're saying, in effect "when onRelease is called, trigger the code in
startTimer".
By saying:
Delegate.create(this, startTimer);
in your doFade() function, you're just creating a function reference and not
storing the value anywhere - not doing anything with it.
What you actually want to do is to call the function, which you should be
able to do with:
this.startTimer();
or even
startTimer();
HTH,
Ian
On 2/21/06, Wouter Steidl <[EMAIL PROTECTED]> wrote:
>
>
> Good evening people,
>
> I asked this on the newbie list since I suspect it to be a newbie
> question,,
> but didn't get an answer....so I hope to find the answer here:
>
> I have some code in a class that needs to fire a fuction (startTimer) from
> an onEnterFrame event....i can fire it from an onrelease usung Delegate,
> but
> not from the onEnterFrame......what am I missing here?
>
> <code>
>
> private function doFade():Void{
> container_mc.onEnterFrame = function(){
> this.fader_mc._alpha-=faderSpeed;
> if(this.fader_mc._alpha <= 0){
> this.fader_mc._alpha=0;
> Delegate.create(this, startTimer); <-- DOESN'T
> WORK
> delete this.onEnterFrame;
> }
> }
> container_mc.onRelease = Delegate.create(this, startTimer); <--
> WORKS AND FIRES THE FUNCTION WHEN I CLICK THE MOVIECLIP }
>
> </code>
>
> Thx for your help,
>
> Wout
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com