-
How do I go about doing this?
see I'm doing a thing where a movieclip is duplicated, renamed and then placed under another 1... insid eteh movieclip is a button , so I need to give this button actions...
I think I could do this by giving the original button the actions and defining the field with expressions like:
onrealease{
gotoandplay (framevar + 1)
(Ya I know it's wrong it's just an example)
that's not the actions I want but the real ones are kinda complex and I don't realy want to do it that way so I'm not gonna figure out the exact actions.
please help =)
-
Try this
Try this
Name the instance of the button ( suppose "btn" )
Then in the frame action :
btn.onPress = function() {
gotoandplay (framevar + 1);
}
U will be able to manipulate the action
-
almost
It works for buttons in the main timeline but I don't know how to make it work for button inside movie clips. I tried
_root.movieclip.btn.onPress = function() {
gotoandplay (framevar + 1);
}
didn't work. so how do I specify where the button is?
-
it should work
I think there is something wrong with your gotoAndPlay(); command.
'cause this is working :
_root.testmov.btn.onPress = function() {
trace("Done");
}
I believe you want to manipulate the timeline inside the movie clip, right? in that case try:
_root.movieclip.btn.onPress = function() {
_root.testmov.gotoAndPlay(framevar + 1);
}
Take care where the variable(framevar)located also.
Hope it works :-)
-
hmmm...
Actualy the gotoandplay (framevar + 1) is just an example, it's not what I realy want the button to do.
Hmmmm I realy need help on this so I'll explain what's going on in teh movie:
In the 1st frame there's the #include "artists.txt"
which duplicates a movieclip, renames changes the text inside it then changes it's position. Then it does the same thing w/ a dif name and text and sets it's x and y coordinates so that it is right under the 1st one... this is what's in "Artists.txt" so far:
list = 1;
duplicateMovieClip("lcd line", "Bad Religion", 0);
set("_root.bad religion.text", "Bad Religion");
list = list+1;
setProperty("bad religion", _x, "302");
setProperty("bad religion", _y, 35);
duplicateMovieClip("lcd line", "Pennywise", 1);
set("_root.pennywise.text", "Pennywise");
list = list+1;
setProperty("pennywise", _x, "302");
setProperty("pennywise", _y, 15*list+5);
duplicateMovieClip("lcd line", "Rage Against The Machine", 2);
set("_root.Rage Against The Machine.text", "Rage Against The Machine");
list = list+1;
setProperty("Rage Against The Machine", _x, "302");
setProperty("Rage Against The Machine", _y, 15*list+5);
duplicateMovieClip("lcd line", "The Offspring", 3);
set("_root.The Offspring.text", "The Offspring");
list = list+1;
setProperty("The Offspring", _x, "302");
setProperty("The Offspring", _y, 15*list+5);
Now I need to change the actions of the buttons inside each one.
When I try
_root.bad religion.button.onPress = function() {
}
It doesn't work, there's something wrong with the "_root.bad religion.button" part.
If you can help me out I'd realy realy apreciate it...
-
maybe try this
i've had similar problems in the past where the script looks correct, but the only thing wrong was that I had spaces in some names of the path.
My two cents:
Instead of:
_root.bad religion.button.onPress = function()
Try renaming it, so that there are no spaces. Sometimes it's funny like that:
_root.badReligion.button.onPress = function()
good luck...
-
uuuh...
This is wierd, it works fine if I use
_root.testmov.btn.onPress = function() {
trace("Done");
}
On a button inside a movieclip that's in the movie already. But it doesn't work on the duplicated movieclips... any advice?
-
Try and set the event functions straight after the clip is duplicated... like this
// duplicate clip
duplicateMovieClip("lcd line", "pennywise", 1);
set("_root.pennywise.text", "pennywise");
list = list+1;
setProperty("pennywise", _x, "302");
setProperty("pennywise", _y, 15*list+5);
// set event handler
pennywise.button.onPress = function() {
gotoandplay (framevar + 1);
}
..... etc...etc....
I haven't yet tried this but it should work...
also note: spaces in clip names will not work !
hope this helps you
-
Thanx
Thanx 4 all the help guys... it turns out the prob had nothing to do with the actionscript, it was a problem with flash, everytime I named the button it would name it back to nothing so I reinstalled and it's working fine... thanx again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|