Back in the day I used to write my own transitions. It was a pain in the butt. I used a sine function to do the tween.
Flash Professional comes with a handy class called Tween. It allows the programmer to tween a property of a movie clip or an object between two values using an “ease” function.
To tween a property of a movie clip between two values:
- Make a movie clip, name it (e.g. myMovie)
- In Actionscript you wish to do the tween include
import mx.transitions.Tween;
and
import mx.transitions.easing.*;
- To start tween create a new object:
var myTween:Object = new Tween(myMovie:Object, propertyToTween:String,
tweenFunction:Function, startValue:Number, endValue:Number, duration:Number,
durationIsInSecondsNotInFrames:Boolean);
(more…)
Friday and Saturday I spent at Wisconsin Dells.
Matt, Nicole, Angela, Matt #2, Erica, Brittany and I drove there on Friday morning, rented a cabin, not too far from Noah’s ark. We spent most of Friday at the waterpark. My favorite was Black Anaconda, which feels more like a rollercoaster than a slide. They actually have conveyer belts that accelerate you upwards. The line was very long, but it was worth the wait.
On one of the other rides there was a couple of guys standing behind us. They kept talking to Matt, who was already smashed by that time, and were absolutely obnoxious. They said they wanted to bring “concentrated fake blood” to the ride, so they could spill it on the way down to make it look like somebody got killed. Very funny, idiots.
After the waterpark we went out to the Mexican restaurant called Pedro’s and sat on the patio. Food was great and the margaritas were enormous. After the meal we hit the bars. On the way back to the car some kids tried to start a fight with Matt, but we got away in time.
Matts falling off the bench When we got back the the cabin, we sat outside and had a few more drinks. I was very tired and went to sleep. A couple hours later Brittany woke me up and said that our next cabin neighbors were asking where I was and wanted me to come out. Earlier that day I talked to them a little bit. They were from Lithuania and spoke Russian. I came out and we had a blast. Both Matts provided comic relief falling off chairs and spilling drinks. I ended up going to sleep after everybody. It was around 5am.
In the morning Matt made breakfast and drove us back to Milwaukee.
Check out the pictures from this trip.
When a parent movie clip has onPress event, none of the buttons inside that movie clip will ever receive onPress. Apparently onPress is reserved for buttons only. This also applies to onRelease, onReleaseOutside and other “button” events.
Buttons, apparently only differ from movie clips in how authoring environment handles their creation. They have automatic rollover/down/off state, but in terms of ActionScript they are no different from other movie clips.
The onPress event is different from onMouseDown in a couple respects:
- It is fired only when a the mouse is clicked within the movieclip (automatic test of .hitArea)
- It does not propagate to movie clips whose hit area overlaps the topmost onPress receiver.
onMouseDown, however gets fired on all movieclips that have it defined, whether the mouse is within their bounds or not.
In order to implement multiple nesting button-like behavior we need to define
- onMouseMove
- onMouseDown
- onMouseUp
for each movie clip that needs to behave similar to onRollOver, onRollOut, onPress, onRelease.
It took me a little bit to get this and for a while I didn’t have a systematic approach to this. I will share the code that implements these events and a little extra. This code should be placed on first frame of a movieclip. The movie clip must contain another movieclip inside named bg (for background). Background clip should have four frames labeled ‘out’, ‘over’, ‘down’ and ‘disabled’.
See ActionScript below:
(more…)
Yesterday I discovered how to fix an annoying problem where Internet Explorer captures tab keystroke if focus in Flash was on the last “tabbable” field. All I needed to do was add param name=”SeamlessTabbing” value=”false” and SeamlessTabbing=”false” to the embed and object tags.
On a related note, here’s a tutorial about how to focus on Flash text field automatically in Internet Explorer.