PDA

View Full Version : scrollpane component + buttons?


TRINI
12-30-2002, 05:38 AM
Does n e one know if it is possible to put WORKING buttons into the mx scrollPANE component?

n e help will be veerrrrry apreciated!

-TRINI

lbower
12-30-2002, 04:59 PM
Certainly!! See attached.

TRINI
12-30-2002, 06:10 PM
Here is the script on the button that doesn't work proper:

on (release) {
gotoAndPlay("Scene 1", 2);
}

All I want is for the but in the component to play frame 2 from the MAIN scene. It seems to be playing frame two from the MOVIE CLIP. How do I solve this?

lbower
12-30-2002, 06:43 PM
try

on (release) {
_root.gotoAndPlay("Scene 1", 2);
}

TRINI
12-30-2002, 07:35 PM
doesnt seem to be working unfortunetly. But thanks alot for ur help. There must be a way for a button in a movie clip to control the MAIN timeline. N E body know???????????????????????????

binkyboo
12-30-2002, 07:52 PM
Is the button your testing this script on located in Scene 1? lbower's script should work.

TRINI
12-30-2002, 07:58 PM
The button is located inside of a movieclip-inside the scrollpane component- which is in scene 1.

binkyboo
12-30-2002, 08:07 PM
on (release) {
_root.gotoAndPlay(2);
}

If you're already in Scene 1 you don't need to specify Scene 1. I'm assuming you want to go to frame two in scene one.

TRINI
12-30-2002, 08:41 PM
IT WORKS!!!! Thanks alot!

However, what if I wanted it to goto scene 2 frame 1???

Thanks again.

binkyboo
12-30-2002, 09:03 PM
on (release) {
_root.gotoAndPlay("SceneNameHere", 1);
}

TRINI
12-31-2002, 03:04 AM
For some reason, any time I try to specify a scene:

on (release) {
_root.gotoAndPlay("SceneNameHere", 1);
}

It doesn't link. But with this code:

on (release) {
_root.gotoAndPlay(2);
}


It works. I don't get it.

bird
01-06-2003, 10:54 PM
Did you ever figure out how the targeting works whn you have a button inside a movie clip inside a scrollpane?

I have tried:

on (release) {
_root.gotoAndPlay("Scene2", 11);
}


This does not work! Any help out there?

:-S

binkyboo
01-07-2003, 01:23 AM
This worked for me.

_level0.scrollContent.tmp_mc.onRelease = function() {
gotoAndPlay("Scene 2", 11);
};

bird
01-07-2003, 03:45 AM
Ok, I'm not really hip to all the AS lingo but... I'm guessing scrollContent is the name of the instance of the movie in the scrollContent param for the scrollpane. What does tmp_mc represent? Also to what does the function refer to. I am assuming this code is placed within the button?

What I am trying to do is make a button in a scrollpane movie control Scene 2 on the main time line.

Thanks for any help you can give.

bembino
01-07-2003, 05:22 AM
It's preferable not to use scenes usually. They can be a bit buggy..esp when using gotoAndPlay actions. Try this...

label the first frame of scene two something like "scene2Frame1"

then goto that frame label with your button:
on (release) {
_root.gotoAndPlay("scene2Frame1");
}
See if that works?!

bird
01-07-2003, 05:44 AM
BRILLIANT!!!! (with a but...)

but as soon as I put that into the context of the greater project where it is being loaded into a holder in another swf it failed to function. I have tried everything I know and can't seem to make it talk to just the root of it's own swf :( Any help there?

Thanks a heap...I will never use scene designations again!

bembino
01-07-2003, 06:13 AM
Yeah...as soon as you load it into another SWF "_root" is no longer its main timeline, but the main timeline of the SWF into which it was loaded.

One option is to work out backwards using what is called relative addressing...
on (release) {
this._parent._parent.gotoAndPlay("scene2Frame1");
}
I'm not sure how deep your button is so you may need to add or remove a _parent to target the right timeline.

Another method might be to create a global reference to that timeline and then use that reference for the gotoAndPlay action. For example, on frame one of your SWF (the SWF containing your scrollPane) write:
_global.swfName = this;
Where swfName is whatever name you want as long as you know what it is and it doesn't conflict with any other variable names.

Then to control it with your button say something like:
on (release) {
swfName.gotoAndPlay("scene2Frame1");
}
Something like that may work.

bird
01-07-2003, 06:42 AM
Can't thank you enough for the timely and excellent responses. I actually figured it out by putting _parent in 3 times. But I really like your global idea better as I have to do this through my movies.

:-)