all groups > flash actionscript > october 2007 >
You're in the

flash actionscript

group:

Linking keyframes


Linking keyframes doglover3
10/25/2007 11:04:32 PM
flash actionscript:
I am using CS3. I asked earlier how one keyframe can be hyperlinked to go to
another keyframe (frame 325 to 120)after the "home" button is hit. The answer I
received was: place a button symbol on frame 325 with the following script: on
(release) {gotoAndPlay(120);} I tried and there MUST be a step or two
missing----I cannot do it. Where is the release button, where is the {gotoand
Play(120) and is that a colon or semi-colon at the end? A million thank you's
to whomever can assist!
Re: Linking keyframes nstanz
10/26/2007 12:03:12 AM
make sure you add this script to the button and not the frame
on(release) {
gotoAndPlay(120);
}

Or name the button "myButton" and add the following to the keyframe 325
myButton.onRelease = function() {

this.gotoAndPlay(120);
}
Re: Linking keyframes clbeech
10/26/2007 3:45:45 AM
these codes are for AS2, you must have your publish settings set for AS2 if you
are using CS3, or Flash will need AS3 code. also, in Flash CS3 you can no
longer 'attach' code to Objects, and they must be placed on the timeline.

If you are using AS2, and using the timeline, the code provided above will
attempt to move the playhead on the myButton timeline to frame120, remove the
'this' keyword as it is refering to the scope of the button instance.

So use one of the following for AS2 or AS3:


//----------AS2
myButton.onRelease = function() {
gotoAndStop(120);
}

//----------AS3
function gotoFrame(event:MouseEvent) {
gotoAndStop(120);
}
myButton.addEventListener(MouseEvent.CLICK, gotoFrame);
AddThis Social Bookmark Button