Be a Supporter!

AS: Symbols

  • 2,827 Views
  • 6 Replies
New Topic Respond to this Topic
Joelasticot
Joelasticot
  • Member since: Feb. 14, 2003
  • Offline.
Forum Stats
Supporter
Level 46
Game Developer
AS: Symbols 2005-06-30 19:15:30 Reply

AS: Main

This is not really about actionscript but still it's a good step in learning Flash.

What are symbols?
There are three kinds of symbols :
- Movie clips : They are animations with their own timelines and properties. They can be controlled with Actionscript. When you play a game, mostly everything you see that isn't static is a movie clip. If you pause the movie, the movie clips will continue to animate.
- Buttons : We use them when we want to give user choices or when we want the user to affect the movie. The most common usages of buttons are the play and replay buttons.
- Graphics : They are like movie clips but you can't control them with Actionscript. They are mostly used for motion tweens and such. They will play and pause with the movie.

Creating symbols
There are two ways to create symbols :
- New symbol (Ctrl + F8) : Choose new symbol from the insert menu. From the pop up, give it a name and choose its behavior (movie clip, button or graphic).
- Convert to symbol (F8) : Select something you've drawn and hit F8. The same pop up will appear but something new is there : registration. This tells flash where on your shape he must assign the center of the symbol.

Note
All the symbols you create are listed in the Library (Ctrl + L). When you click and drag a symbol from the library to the frame, it'll create an instance of it. If you double click an instance, you'll be able to edit the symbol and all its instances.

Now you know what symbols are. But how can we use them?

Movie clips
Probably the most used form of symbols, the movie clips can be controlled with Actionscript and will keep looping unless you stop them with a stop() action. They are useful when you want to animate looping things such as rain, waterfalls or wheels spinning.

Buttons
Very useful for games, in places where the user has to make choices. Also used a lot for play buttons. When you edit a button, you will see there are 4 different frames : Up, Over, Down and Hit. Up is the frame that will be shown when the button is inactive, Over is the frame for mouse contact and Down is the frame for when you click the button. The Hit frame is what has to be touched with the mouse for the button to be active.

Graphics
Graphics are useful when you want to use the same drawing a lot of times without affecting the movie filesize too much.

Symbols color
When you click a symbol and you open up the properties panel, you'll notice a Color drop-down menu with None as value. The other choices are :
- Brightness : Makes the symbol more white or black.
- Tint : Makes the symbol a certain color.
- Alpha : Makes the symbol transparent.
- Advanced : Lets you mix tint and alpha.

Basic buttons scripts
Here are three scripts you can use on buttons to control your movie. To use them, click on your button (on the frame, not in the library) and open the actions panel (F9). Then, paste one of these codes :

Play :

on(release){
play()
}

Stop :

on(release){
stop()
}

Go to scene named INTRO :

on(release){
gotoAndPlay("INTRO", 1)
}

Finally, a few links for more information :

http://www.smartwebby.com/Flash/flash_symbols.asp
http://web.image.ufl.edu/help/flash/symbols/
http://www.awdsf.com/courseware/flash/flash1_symbol_library.htm
http://www.webwasp.co.uk/tutorials/ANI---01-symbols/default.php

If you have any questions, feel free to ask here.


ey

BBS Signature
T-H
T-H
  • Member since: Jan. 7, 2004
  • Offline.
Forum Stats
Member
Level 40
Blank Slate
Response to AS: Symbols 2005-06-30 19:23:42 Reply

NIce, that will give people a more organised undertanding of whats going on in Flash.

BlackmarketKraig
BlackmarketKraig
  • Member since: Dec. 8, 2004
  • Offline.
Forum Stats
Member
Level 32
Artist
Response to AS: Symbols 2005-06-30 20:30:10 Reply

Good tutorial post, I wished you had elaborated a bit more on the usefulness of Graphics for movies, though.

It took me quite awhile to figure out that animations for movies (not games) should take place in graphics and not movie clips. When they are in graphics they will visibly animate on the main timeline and are much easier to test, but movie clips, of course, will not. In addition, as you mentioned, movie clips will not pause without some fancy AS, and that can horribly throw off the sync of a movie, or ruin the experience altogether if someone decides to right click and pause.


This sig is 100% effective protection from all hexes, curses, evil spirits and bad karma. Guaranteed.

BBS Signature
Joelasticot
Joelasticot
  • Member since: Feb. 14, 2003
  • Offline.
Forum Stats
Supporter
Level 46
Game Developer
Response to AS: Symbols 2005-06-30 20:44:39 Reply

I think I said that graphics would play and pause with the movie. And as for movie clips, I made a script to pause them if the viewer right-clicks and deselects "Play". There it is :

onClipEvent(load){
_root.Paused=0
Frame1=0
Frame2=0
}
onClipEvent(enterFrame){
Frame2=Frame1
Frame1=_root._currentframe
if(Frame1==Frame2){
stop()
}else{
play()
}
}

There might be a 1 frame delay though.


ey

BBS Signature
BlackmarketKraig
BlackmarketKraig
  • Member since: Dec. 8, 2004
  • Offline.
Forum Stats
Member
Level 32
Artist
Response to AS: Symbols 2005-06-30 20:53:30 Reply

At 6/30/05 08:44 PM, Joelasticot wrote: I think I said that graphics would play and pause with the movie.

Yeah, you did say that, I was only pointing out that graphics have other advantages and it's important to use the right type of symbol. It's all good though.

That's a neat script, btw. I look forward to trying that out shortly.


This sig is 100% effective protection from all hexes, curses, evil spirits and bad karma. Guaranteed.

BBS Signature
Toast
Toast
  • Member since: Apr. 2, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to AS: Symbols 2005-07-01 05:44:03 Reply

Nice tutorial,but it is very similiar to the AS: Basics tutorial I said I'd type : /...


BBS Signature
T-H
T-H
  • Member since: Jan. 7, 2004
  • Offline.
Forum Stats
Member
Level 40
Blank Slate
Response to AS: Symbols 2005-07-01 06:48:53 Reply

At 6/30/05 08:30 PM, BlackmarketKraig wrote: I wished you had elaborated a bit more on the usefulness of Graphics for movies, though.

They aren't that useful, they are actually pretty crappy. Only use them if you are pushing for filesize.