Jump to content


Photo

help with nested movie clip actionscript


  • Please log in to reply
2 replies to this topic

#1 greggreg

greggreg

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 05 January 2007 - 04:00 PM

hey all,

so i am trying to create and on(release){} event for a movie clip with the instance name testClip nested into the root timeline. the code looks as fallows...

testClip.on(release){
trace("yeah");
}


but when i run it i get the error....

**Error** Scene=Scene 1, layer=actions, frame=1:Line 2: Expected a field name after '.' operator.
testClip.on(release){

Total ActionScript Errors: 1 Reported Errors: 1


im not sure what field name it wants or more generally, how to make the on(Release) work.

thanks for any help!!

#2 Ben

Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 05 January 2007 - 08:13 PM

Ok, I'll help you with all the things that are wrong:

First, the on(release) statement does not require an instance name before it. So you need to remove the testClip wrong the code, since this sort of code ONLY goes on a button, which leads me to the next thing. Movieclips cannot hold button codes. So when making a symbol, do not select Movieclip, but select Button.

Ben.

#3 knedl

knedl

    Young Padawan

  • Members
  • Pip
  • 243 posts
  • Gender:Male
  • Location:Slovenia
  • Interests:Designing and programing

Posted 06 January 2007 - 05:53 AM

If you want the movie clip to "act" as a button you still have to put the up,over and out event on one layer and give it a frame label like _out,_over if you know what I mean. And once you get to the actionscript yes you have to point to the movie clip with the instance name and for the RollOver your code should look something like this:

MovieClip.onRollOver = fuction () {
}

And if you want the movie clip to animate when the cursor is over it the code should look something like this:

MovieClip.onRollOver = fuction () {
MovieClip.gotoAndPlay ("_over")
}

Offcourse the MovieClip is just a made up instance name and "_over" is just a frame label wich you need to point at when the animation starts.

And if your also using the onRollOut event the script is basicly the same just you need to point on a diffrent frame lebel for instance "_out", but remember name your frame labels in the way you'll remember like you would be working with a button.

Hope this helps you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users