Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : Clicking Buttons within a Movie Clip problems


mludwig
6/21/2004 7:26:46 PM
I am having a problem with buttons that are placed inside a movie clip. I just
read a few threads and discovered that most people believe having 1 scene and
using multiple frame labels is the way to go for efficiency. One question I
have is: does this increase, decrease, or keep the overall SWF file size the
same?

My basic problem is that I have a movie clip that has buttons in it, and I
want those buttons to be able to play another scene, yet when I click on the
buttons, the scene does not change. Any help? Thanks.
Jack.
6/21/2004 8:04:49 PM
main timeline button -
on(release){ gotoAndStop("label1"); }

button in a clip -
on(release){ _parent.gotoAndStop("label1"); }

in a nested clip -
on(release){ _parent._parent.gotoAndStop("label1"); }

use Generate size report to see changes in swf size.
mludwig
6/21/2004 8:39:50 PM
This may be a trivial question, but what does the "_parent" stand for, or what
is it referenced to? I tried putting that portion of code in and it did not
work. I'll try it again....and does the "_parent" only work when you are using
frame labels and not jumping from scene to scene? Thanks again.

-Mark-
Jack.
6/21/2004 8:54:52 PM
[quoted text, click to view]

think of the main timeline as "mother"
a movieclip on mother timeline is a child
it references mother as _parent
a movieclip inside of the child movieclip
is therefore a granchild and references
mother as _parent._parent,

do not use scene names when navigating from movieclips, as
gotoAndPlay("Scene1","label or frame")
will always fail.

hth
mludwig
6/21/2004 9:29:11 PM
When I place the _parent in the code, it no longer acts as a destination, is
now is an expression, yet it still doesn't play the frame I want it to.

example: I want the button "services" that is in the movie clip
"mainnavigation" to play the frame labeled "services1" which is on the main
timeline; the movie clip "mainnavigation" is also on the main timeline.

here is the code that i have originally:
on (release) {
gotoAndStop ("services1");
}

here is the modififed code with your suggestion:
on (release) {
_parent.gotoAndStop ("services1")
}

Is there something that I am doing wrong with the code, or do I have to label
my movie clip something? The main problem is that the buttons work fine when
not in the movie clip, but I need them in the movie clip and when they are in
there, they do not function.

Thanks so much again,
-Mark-
mludwig
6/22/2004 1:26:03 PM
Hello,

I have a problem with making buttons within a movie clip go to different
frames within the same scene. My problem is explained in more detail above this
post, and I got some help, and I believe I was on the right track, but
unfortunately my problem is still not resolved. Anyone out there know what I
should do? Thanks.

-Mark-
Jack.
6/22/2004 4:54:02 PM
your code syntax is correct
is the clip definately a child, or is it nested ?
do you have a button within a button somewhere ?
do you have any on<event> actions on the clip ?
do you have any main timeline onPress events
applied to the clip ?
AddThis Social Bookmark Button