PDA

View Full Version : Button only functions on Stage not on Testmovie


Morris
06-30-2005, 11:23 AM
I hope someone can help me, it is driving me insane: I linked a number of buttons to a MC based on RollOver/Drag over. The buttons function on the Stage (Enable Simple Buttons), but do not work in TestMovie. How do I get the buttons to work properly in the Testmovie? Thanks for yout help in advance .

Here's the code I used:

this.onRollOver = this.onDragOver = function ()
{
this.gotoAndPlay(2);
}
this.onRollOut = this.onDragOut = function ()
{
this.gotoAndPlay(8);
}
stop();

hobbis
06-30-2005, 12:13 PM
If I'm correct, I think you have a scope issue.

this.gotoAndPlay() actually refers to the button, not the movie.

try this._parent.gotoAndPlay()

Morris
06-30-2005, 12:53 PM
hobbis, thanks a lot for your response! unfortunately it did not yield the desired results. i tried to upload the *.fla as a *.zip file in order to show you what i mean but it did not work. any other suggestions you might be able to give me?

hobbis
06-30-2005, 01:22 PM
Sorry, I forgot that inside a button, 'this' actually refers to the timeline of the movieclip it is contained inside. My apologies. My code would not work.

Ok, personally I would use instance names to reference your symbols on stage:

Put this on the timeline that CONTAINS your movielcips and symbols

Create a reference to the timeline, then use the reference inside your Event handler functions to get the desired scope:

var mainTimeline:MovieClip = this; //on your timeline

myButtonReference.onRelease = function() {
mainTimeline.myMovieClipReference.gotoAndPlay(2)
}

Try that.

Morris
06-30-2005, 03:09 PM
Thanks again hobbis, but I cannot get it right and am a bit confused now. Would it be too bold as to ask you to contact me at hfdegrijs@cs.com, so I can send you the *.fla? I have been working on this for days now. I sincerely appreciate your help.