I'm not sure what it could be, but you should try delegating the onRelease
function to this:

import mx.util.Delegate;

plus6_mc.plus6_btNext_mc.onRelease = Delegate.create(this,
btNext_mc_onRelease);

function btNext_mc_onRelease() {
  plus6_mc._y = -160;
  response2_mc._y = 123;
  animateIt(response2_mc)
};

The strange thing is, if this were the issue, your first code should not
work since response2_mc is not in plus6_btNext_mc's scope. My guess is that
animateIt is out of scope and that response2_mc is referenced somewhere in
plus6_btNext_mc.

One way to find out if it's scoping is to trace animateIt and response2_mc.

Hope this helps,

H

On 7/12/07, Marcelo Wolfgang <[EMAIL PROTECTED]> wrote:

Hi list,

I have some code that I've made that I don't understand why it is
failing, and I want your help

this works

var time = .3;
var easeType = mx.transitions.easing.Regular.easeOut;
var response2_mc:MovieClip = this.frmContato_response2_mc;
var plus6_mc:MovieClip = this.frmContato_plus6_mc;

plus6_mc.plus6_btNext_mc.onRelease = function() {
    plus6_mc._y = -160;
    response2_mc._y = 123;
    var startY = response2_mc._y + 10;
    var endY = response2_mc._y;
    yTween = new mx.transitions.Tween(response2_mc, "_y", easeType,
startY, endY, time, true);
    alpha_Tween = new mx.transitions.Tween(response2_mc, "_alpha",
easeType, 0, 100, time, true);
};

this don't

var time = .3;
var easeType = mx.transitions.easing.Regular.easeOut;
var response2_mc:MovieClip = this.frmContato_response2_mc;
var plus6_mc:MovieClip = this.frmContato_plus6_mc;

function animateIt(tgt){
    var startY = tgt._y + 10;
    var endY = tgt._y;
    yTween = new mx.transitions.Tween(tgt, "_y", easeType, startY, endY,
time, true);
    alpha_Tween = new mx.transitions.Tween(tgt, "_alpha", easeType, 0,
100, time, true);
}

plus6_mc.plus6_btNext_mc.onRelease = function() {
    plus6_mc._y = -160;
    response2_mc._y = 123;
    animateIt(response2_mc)
};

I have many tweens like that, is that why I want to have a function to
just call it everytime it's need, any clues why it don't work when it's
called via function?

TIA
Marcelo Wolfgang



_______________________________________________
[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

Reply via email to