multiple functions on a button

Can't get function working...

Page 1 of 1

9 Replies - 5113 Views - Last Post: 19 February 2006 - 06:25 AM

#1 rigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-February 06

multiple functions on a button

Posted 15 February 2006 - 05:21 AM

Hi

Newbee on flash...

I'm creating a web site using a flash intro and flash menu. In the menu, I'm trying to make a button perform 3 different actions;

First, on rollover, play a timeline effect.
then, if clicking the button, on release go to another scene and stop on first frame
and finally, if the button is not clicked, on rollout go back to keyframe 1 and stop there.

Here's my action code for the button:

Quote

on (rollOver){
gotoAndPlay(65);
}
on (release){
gotoAndStop("Scene 29", 1);
}
on (rollOut){
gotoAndStop(1);
}

The problem is that only the rollover and rollout things happens, not the on release goto...

If I skip the rollover and rollout code, and just use the release part, it will change to scene 29.

What have I missed this time? :P

/rigg

Is This A Good Question/Topic? 0
  • +

Replies To: multiple functions on a button

#2 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: multiple functions on a button

Posted 15 February 2006 - 05:32 AM

Question: What happens when you release the button?
Answer: The mouse is again over the button.

Therefore, when you have those functions, when you release the button, the mouse state becomes rollOver because nothing is pressed but the mouse is over the button... hence, it does the RollOver functions.

My suggestion is to change the on(release).. to on(press):
on (rollOver){
   gotoAndPlay(65);
}
on (press){
   gotoAndStop("Scene 29", 1);
}
on (rollOut){
   gotoAndStop(1);
}

Was This Post Helpful? 0
  • +
  • -

#3 rigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-February 06

Re: multiple functions on a button

Posted 15 February 2006 - 06:50 AM

pioSko, on 15 Feb, 2006 - 06:29 AM, said:

Question: What happens when you release the button?
Answer: The mouse is again over the button.

...
...

My suggestion is to change the on(release).. to on(press)

No, sorry, it didn't help :(

/rigg
Was This Post Helpful? 0
  • +
  • -

#4 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: multiple functions on a button

Posted 15 February 2006 - 07:05 AM

What is the timeline effect and why does it start on frame 65 of your movie? It seems a little eratic that your movie is jumping all over the place like that.

Is it possible for you to make that timeline effect a movieclip animation and have the button play the movieclip instead of playing your whole movie?
Was This Post Helpful? 0
  • +
  • -

#5 rigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-February 06

Re: multiple functions on a button

Posted 15 February 2006 - 07:55 AM

i shall look over it tomorrow and let you know...

/rigg
Was This Post Helpful? 0
  • +
  • -

#6 rigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-February 06

Re: multiple functions on a button

Post icon  Posted 15 February 2006 - 06:54 PM

I solved this all by myself after some experimenting and bad words ;)

What happens is that when I'm rollover the button on frame 1, the timeline starts to play, so when I'm click (and release) the mouse I'm not left on frame 1, I'm somewhere between frame 65 and 75. The release action could not be on frame 1...

So, the on (release) must be action for the button in the span of frame 65 - 75.

It's working now, but I'm sure I will met trouble again and will post more questions here...

/rigg
Was This Post Helpful? 0
  • +
  • -

#7 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: multiple functions on a button

Posted 16 February 2006 - 01:59 AM

rigg, on 16 Feb, 2006 - 03:51 AM, said:

It's working now, but I'm sure I will met trouble again and will post more questions here...

The way you have structured your movie means that it's very likely that you will run into problems in the future. A less confusing and organised way is to place all animations into seperate symbols/movieclips... naming them.. and controling them with actionscript. This way you can stop and play your main timeline however and whenever you want AND the animations whenever you want... seperatly from each other.
Was This Post Helpful? 0
  • +
  • -

#8 rigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-February 06

Re: multiple functions on a button

Posted 16 February 2006 - 10:19 AM

pioSko, on 16 Feb, 2006 - 02:56 AM, said:

A less confusing and organised way is to place all animations into seperate symbols/movieclips... naming them.. and controling them with actionscript. This way you can stop and play your main timeline however and whenever you want AND the animations whenever you want... seperatly from each other.

I created and attached a small demo of what I'm doing, Including just sample buttons and text effect. From my original metod, with the text effect as a graphic using lot of keyframes I converted the text effect to a movie clip, much easier to control.

I do not understand how to play and stop the movieclip without playing the timeline

Take a look at the script, At the first button I used the graphic method and on the second button i used a movie clip, but I have to use the timeline, not to play as a sequenze but to play and stop single frames at the line.

Please tell me if I'm doing this in the wrong way...

/rigg

p/s here's a link to the actual movies on my server, note: nothing happens when clicking the buttons... My Webpage

Attached File(s)


This post has been edited by rigg: 16 February 2006 - 12:43 PM

Was This Post Helpful? 0
  • +
  • -

#9 pioSko  Icon User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: multiple functions on a button

Posted 17 February 2006 - 03:06 AM

I have attached an example of what I mean.

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#10 rigg  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 11-February 06

Re: multiple functions on a button

Posted 19 February 2006 - 06:25 AM

pioSko, on 17 Feb, 2006 - 04:03 AM, said:

I have attached an example of what I mean.

Thank you, It looks nice and understandable!

/rigg

This post has been edited by rigg: 19 February 2006 - 06:26 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1