Groups | Blog | Home
all groups > flash actionscript > september 2006 >

flash actionscript : Actionscript on Buttons


Mister Peanut
9/8/2006 9:36:51 PM
:confused;

I have no idea why this isn't working... I've tried attaching this code to a
button, to the actions layer, and to a frame... nothing happens!!

on (release) {
gotoAndPlay("Home", 1);
}

I've also tried using this code on all of them, too:

home.onRelease = function (){
gotoAndPlay ("Home", 1);
}

I want this button to link the user back to the scene "Home" in frame 1. For
the life of me, I can't figure out why it isn't working.

Any suggestions would be greatly appreciated....
NSurveyor
9/8/2006 11:15:13 PM
Scenes are fairly buggy, try frame lables instead:

Click on Frame 1 of the Home scene, and in the properties panel, put: home1
for the <Frame Label>. Then, in your script, use _root.gotoAndPlay("home1");
Mister Peanut
9/8/2006 11:39:09 PM
still nothing...

In my home scene, I have an actions layer. In scene 2, I also have an actions
layer. I have labelled the frame in the actions layer in the home scene
"home1".

In the actions layer in scene 2 I have attached the following code:

home.onRelease = function (){
_root.gotoAndPlay("home1");
}

after I test the movie, a blank "Output" screen pops up (I don't know what
this is...), and the home button will not work.
Perhaps I am putting the script in the wrong place? Hmmm, it seems like it
should be straightforward, as I've done it in other sites before, but it just
won't work... Any other theories? Are scenes always so buggy?

Thanks for your time and patience...

Brad

MattMika
9/11/2006 11:34:15 AM
On Fri, 8 Sep 2006 21:36:51 +0000 (UTC), "Mister Peanut"
[quoted text, click to view]

Heres what works for me;

On the "Home" scene I have a button to go to WhatsUp page with the
following AS.

WhatsUpButton.onRelease = function() {
gotoAndPlay("WhatsUp", "WhatsUp");

//comment
gotoAndPlay("Scene", "Frame/FrameLabel");
//comment
}

First frame of scene "WhatsUp" has a frame label called "WhatsUp." I
am using this method to navigate across many scenes with no problems.

Using frame numbers is what will give you the problems, since frame 1
of the home scene may in fact not be frame 1 of the entire movie once
its exported. Use frame labels.

Read this:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_15703

Note: I am in the middle of my first flash project in over 5 years.
Lots has changed from 4 to 8 plus I never knew AS worth a damn anyway
so this IS NOT gospel, but I'm making it work...
"If you love wealth more than liberty, the
tranquillity of servitude better than the
animating contest of freedom, depart from us in
peace. We ask not your counsel or your arms.
Crouch down and lick the hand that feeds you.
May your chains rest lightly upon you and may
posterity forget that you were our countrymen."
AddThis Social Bookmark Button