Thursday, October 16, 2008

notes class 3 september 24

Events
The event model

To get flash to have one thing to talk to something else make a listener. Listener will listen for events. Main class broadcasts when events take place.

When you create a new event it needs a new variable. Type is e. use (e:Event)


Trace only prints to the output window for debugging.
Use something else to print to a window or screen.

Variable at the top of the class is available to all functions. Inside a function will only run inside the function (local).


Public function can be seen by other functions
Private functions can only be seen by ??itself?? here is where you can use e for the Event variable.

Listener function mostly will be private.

AS3 is 10 times faster than AS2. flash AS4 will use hardware acceleration.

ENTER_FRAME is ok for checking every frame. Good for checking to see if something is on top of each other.

Faster than ENTER_FRAME: Timer.
You can ask a time to run a number of times and stop.
Time is in milliseconds.

//custom event runs a timer. frame rate independent
private function myFunction(e:Event)





// this function is called by the enterframe listener above
{
box.x += 10; // add 10 to its position
trace(e)
}


Bubbles defines how many people the event is told to when the timer runs. Can attach event to 5 objects or to the container that holds those 5 objects. Things bubble up and bubble back down.

Code has no idea of time. Timer allows things to happen at different times. import.flash.utils is parent of timer so it needs to be in the import list at the top of the main class. Flash file does not swell if you pull in all the children of one of the import parents but you could call just the parts that you want to use.



Mouse events you can’t guess when they will happen. Move from linearity to non-linearity. Can now program things to act in ways we never expected them to act. Animation can be different for every different user and every different use.

Once you know an event you know all events.


LOOK AT LOG.GREENSOCK.COM
To get motion libraries. He has good stuff.
Using tween max = 8k addition to flash file.
Tween light = 80% of tween light fo2 2k.
Tween filter light = + 2k to twen light.



Tween max
Once you import gs.TweenMax there are new keywords that will function.



import gs.easing.*

Robert Penner wrote easing equations in greensock. Import easing.
Tween.to (goes in reference to current position) and also Tween.from (goes to a particular position. Is this right?





HOMEWORK ASSIGNMENT:

No comments: