Bruce Gust
asked on
Button within a movie clip
I've got a movie clip on my main timeline. The buttons in teh movie clip are scripted like this:
on (release) {
_root.gotoAndStop("Promo", 1);
}
I'm trying to go back to the main timeline, find the scene "Promo" and play it. Nothing complicated, but I can't get it to work.
What am I missing?
on (release) {
_root.gotoAndStop("Promo",
}
I'm trying to go back to the main timeline, find the scene "Promo" and play it. Nothing complicated, but I can't get it to work.
What am I missing?
you are using the gotoAndStop if you want it to play the promo sence then you need to use gotoAndPlay.
ASKER
I changed that, but the button still isn't working. Do I have the "_root" thing wrong?
Are you using AS2 or AS3. If AS3 try using parent or _level0.
Alternatively best practice is to have most your actionscript on your main timeline, on a actions layer.
To reference the button within the movieclip first ensure th mc has an instance name and the button within it has an instance name. To add an instance select the object and look at the property panel.
//Code for AS2
mymovieClip_mc.myButton_bt n.onReleas e = function()
{
_root.gotoAndPlay("promo", 1);
}
//Code for AS3, you need to reference the frame number first then the scene, but ensure you import the events class as shown.
import flash.events.*;
stop();
myMovieClip_mc.myButton_bt n.addEvent Listener(M ouseEvent. CLICK, myButton_CLICK);
function myButton_CLICK(e:MouseEven t)
{
gotoAndPlay(1, "promo");
}
To reference the button within the movieclip first ensure th mc has an instance name and the button within it has an instance name. To add an instance select the object and look at the property panel.
//Code for AS2
mymovieClip_mc.myButton_bt
{
_root.gotoAndPlay("promo",
}
//Code for AS3, you need to reference the frame number first then the scene, but ensure you import the events class as shown.
import flash.events.*;
stop();
myMovieClip_mc.myButton_bt
function myButton_CLICK(e:MouseEven
{
gotoAndPlay(1, "promo");
}
your easiest way through is to just place a label on frame 1 of scene Promo. Call the label "Promo"
Then your button script just uses the label like so:
on (release) {
_root.gotoAndPlay("Promo") ;
}
Scenes have flaky support when it comes to navigation. Always use a label.
Then your button script just uses the label like so:
on (release) {
_root.gotoAndPlay("Promo")
}
Scenes have flaky support when it comes to navigation. Always use a label.
ASKER
ccarrey, I tried your suggestion and named the first frame of every scene, it didn't make a difference.
john, I tried your script and it didn't work either.
I have zipped up my "stuff" and placed it at the following URL. Diet Cokes all around for the person who can tell me where I'm blowing it.
I didn't include the videos thinking that a person interested in solving my dilemma would be able to correct the code without having to see the video.
http://www.hihatwebdesign.com/VideoGallery.zip
john, I tried your script and it didn't work either.
I have zipped up my "stuff" and placed it at the following URL. Diet Cokes all around for the person who can tell me where I'm blowing it.
I didn't include the videos thinking that a person interested in solving my dilemma would be able to correct the code without having to see the video.
http://www.hihatwebdesign.com/VideoGallery.zip
Wasn't able to open that zip - looks like it's corrupted or not uploaded completely. If you could try re-uploading I'm happy to take a look at the FLA
ASKER
I uploaded a new copy, It's the same URL. Check it out and I do appreciate your time.
Thanks!
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ccarey
I must be still missing something. If you go to http://www.hihatwebdesign.com/VideoGallery.zip again, I've uploaded the version that is incorporating your suggestions. I don't doubt that I SHOULD work, but I'm overlooking something and I don't know what.
Thanks for your time!
I must be still missing something. If you go to http://www.hihatwebdesign.com/VideoGallery.zip again, I've uploaded the version that is incorporating your suggestions. I don't doubt that I SHOULD work, but I'm overlooking something and I don't know what.
Thanks for your time!
You haven't put a label on the Promo scene, only Intro and Contestants, but as far as I can see none of the buttons target these scenes anyway.
Expand the timeline like I've done above and you'll be able to clearly see your labels. Put a label on the Promo scene and you should be fine.
Expand the timeline like I've done above and you'll be able to clearly see your labels. Put a label on the Promo scene and you should be fine.
ASKER
Got it!
Thanks so much!
Thanks so much!
ASKER
Too, too cool!