Flash Help


FACS 2930 Flash Notes

This site has tutorials on some key flash interactions (ie. dragging movie clips, changing movie clip properties on button press, invisible buttons, dynamic pointer mask, making your own mouse pointer, mouse tracking, letting the user draw on ur swf, etc.) Credit goes to Nadine Wettlaufer. Has .fla file included for each example!

Rollover Effect


create a button (see below) set the 'over' state to a distinct image as the 'up' state

Creating Buttons

comand - F8 or Insert > New Symbol brings up the dialog window to create a new symbol, choose button.

Creating a Slider Timeline (Using Action Script)

If you have a lot of numbers to deal with, save some time and try getting things to work using action script.
  • History timeline that allows you to drag and display the year (+ necessary changes) as you drag along.
  • The animation aspect (in this case, the speech bubble) is embedded within the movie clip, and not the main timeline.
This is not really a tutorial in a sense that there's no set Step #1, #2, etc. It's more of an example.
Download .fla file

Class notes: flash tips (13/3/08)


Rollover buttons:
  • give mc (movie clip) symbols unique names or instances (red_btn) when brought into timeline or onto the stage. For example: red_btn
  • we can attach or adjust a property to any object. e.g alpha. _root.red_btn._alpha = 50;
  • define an input action: activate on Rollover:
red_btn.onRollover= function(){
_root.red_btn.gotoAndstop(2)
}
 
red_btn.onRollout= function(){
_root.red_btn.gotoAndstop(1)
}


Dragging movie clips:

instance name: garbage_mc
In actions layer:
garbage_mc.onPress = function (){
garbage_mc.startDrag();
}
 
garbage_mc.onRelease = function (){
garbage_mc.stopDrag();
}


Tell object to go back to position it was in:
garbage_mc.onPress = function (){
garbage_mc.startDrag();
}
in actions layer timeline:
position1=garbage_mc._x;
position2=garbage_mc._y;


Tell object to disappear when placed over trash can:
  • write a conditional statement. If the garbage is over the can make it disappear.
  • The two slashes, allow you to comment on what the action script is doing.
this function allows the trash to be draggable
garbage_mc.onPress = function (){
garbage_mc.startDrag();
}
 
garbage_mc.onRelease = function (){
garbage_mc.stopDrag();
}
 

this is a condition to check if the trash is in the bin
//garbage_mc.onRelease=function(){
if (garbage_mc.hitTest(container_mc)){
garbage_mc._visible=false;
}
else{
garbage_mc._x=position1;
garbage_mc._y=position1;
}
}//

In main timeline at the last frame in actions layer write:
// this loops between frames 5 and 10; so initial position is not reset.
gotoAndPlay(5);




Embedding Flash Into HTML


Here is the code to add your flash file into your website:

<body>
<object type="application/x-shockwave-flash" data="name_of_file.swf" width="300" height="240">
<param name="movie" value="name_of_file.swf" />
</object>

</body>

The size can be modified by changing the number values in width and height.
You can also find more information here.

Source: Visual Quickstart Guide: HTML, XHTML & CSS, Sixth Ed. by Elizabeth Castro