Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onRelease function not working

Status
Not open for further replies.

NIA2

Technical User
Aug 30, 2006
137
AU
Hi everyone,

I have the following code on frame 1 of the main timeline:

this.categoryIndex_mc.indexBack_mc.backToIndex_btn.onRelease = function ():Void {
trace("button pressed");
oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 0, garmentSlides_mc, 5);
new Tween(categoryIndex_mc, "_y", null, 412, 107, 3, false);
categoryIndex_mc.indexBack_mc.gotoAndStop("chooseText");
}

When I test the movie I get the hand cursor appear when I rollover the button indicating that it is in fact a button but when I press and release it, none of the code works. I added the trace statement to see what was going on but again when testing it the output window doesn't appear.

Can someone tell me if there's something wrong with the code? The following is the entire code on frame 1 of the main timeline.

Appreciate any help offered.



CODE

//-----------Initialization---------\\
import mx.transitions.Tween;
this.categoryIndex_mc._alpha = 0;
this.garmentSlides_mc._alpha = 0;
//-----------------------------------\\

//-----------Introductory animation plays---------\\

intro_mc.onEnterFrame = function () {
this.play();
delete intro_mc.onEnterFrame;
}
//-----------------------------------\\


//-----------Category list fades in---------\\

var oIntervalIDs:Object = new Object();

function fadeMovieClip (mClip:MovieClip, nRate:Number):Void {
if(mClip._alpha >= 0 && mClip._alpha < 100) {
var nAlpha:Number = mClip._alpha;
mClip._alpha = nAlpha + nRate;
updateAfterEvent();
}
else {
clearInterval(oIntervalIDs[mClip._name]);
}
}

oIntervalIDs[categoryIndex_mc._name] = setInterval(fadeMovieClip, 100, categoryIndex_mc, 5);

categoryIndex_mc.onEnterFrame = function () {
if(categoryIndex_mc._alpha > 95) {
this.indexBack_mc.gotoAndPlay("chooseText");
delete categoryIndex_mc.onEnterFrame;
}
}

//-----------------------------------\\


//-----------Slideshow fades in, category index slides out, playhead jumps "back to index" frame ---------\\

cat_btn.onRelease = function ():Void {
oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 100, garmentSlides_mc, 5);
new Tween(categoryIndex_mc, "_y", null, 107, 412, 3, false);
categoryIndex_mc.indexBack_mc.gotoAndStop("backToIndex");
}
//-----------------------------------\\


//-----------Slideshow fades out, category index slides in, playhead jumps "please choose category" frame---------\\

this.categoryIndex_mc.indexBack_mc.backToIndex_btn.onRelease = function ():Void {
trace("button pressed");
oIntervalIDs[garmentSlides_mc._name] = setInterval(fadeMovieClip, 0, garmentSlides_mc, 5);
new Tween(categoryIndex_mc, "_y", null, 412, 107, 3, false);
categoryIndex_mc.indexBack_mc.gotoAndStop("chooseText");
}

//-----------------------------------\\
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top