Be a Supporter!

Some AS help needed...

  • 358 Views
  • 4 Replies
New Topic Respond to this Topic
SkySausage
SkySausage
  • Member since: Jul. 2, 2007
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Some AS help needed... 2007-12-06 08:17:27 Reply

I've got this little problem here...
how do i make a button stay at the 'down' frame when clicked? and not switch back to 'up' once you release the mouse? actionscript can't be placed inside a button...

can anyone help please? oh, it doesn't have to be a button, but something that works in the way i described.

thanks!~


BBS Signature
SkySausage
SkySausage
  • Member since: Jul. 2, 2007
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to Some AS help needed... 2007-12-06 08:42:13 Reply

i tried this as well:

two keyframes inside a movie clip, labels are 'up' and 'pressed'. each of the keyframes have stop action.
movieclip has actions:

onClipEvent (enterFrame){
this.gotoAndStop("over")
}
onClipEvent (mouseDown) {
this.gotoAndStop("lighted")
}

it works ok, but when i test movie the following errors appear:

**Error** Symbol=lights 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
stop();

what does it mean and how to fix it?


BBS Signature
GustTheASGuy
GustTheASGuy
  • Member since: Nov. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Some AS help needed... 2007-12-06 08:52:41 Reply

It means there's a 'stop ();' on the symbol 'lights 1' which can't be there because you need the 'onClipEvent's for code on symbols.


BBS Signature
TripleDK
TripleDK
  • Member since: Aug. 3, 2007
  • Offline.
Forum Stats
Member
Level 09
Gamer
Response to Some AS help needed... 2007-12-06 08:55:11 Reply

At 12/6/07 08:42 AM, SkySausage wrote: i tried this as well:

two keyframes inside a movie clip, labels are 'up' and 'pressed'. each of the keyframes have stop action.
movieclip has actions:

onClipEvent (enterFrame){
this.gotoAndStop("over")
}
onClipEvent (mouseDown) {
this.gotoAndStop("lighted")
}

it works ok, but when i test movie the following errors appear:

**Error** Symbol=lights 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
stop();

what does it mean and how to fix it?

Errmm... i don't think onClipEvent(mouseDown) should be in a MC as it is a Button script.
What i think you should do is make a invinsible button below the movie clip, and then on the button you make some code like:

on(press) {
_root.MovieClip.gotoAndStop(2);
}

That way you can even make a whole animation to happen. And if you want the movie clip (which the viewer think is a button) to highlight on rollover there is this script:

on(rollOver) {
_root.MovieClip.gotoAndStop(2); //Then change press animation to 3
}
on(rollOut) {
_root.MovieClip.gotoAndStop(1);
}

I'm not a god at AS, but i've made something like that, and it worked. Hoplefully you understand what i meant and hopefully you will make it work.


BBS Signature
SkySausage
SkySausage
  • Member since: Jul. 2, 2007
  • Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to Some AS help needed... 2007-12-06 09:10:10 Reply

I'm not a god at AS, but i've made something like that, and it worked. Hoplefully you understand what i meant and hopefully you will make it work.

thanks a lot!


BBS Signature