PDA

View Full Version : Confusion about movie -v- button


Cylindric
09-24-2006, 12:09 PM
I'm trying to create a selection screen in Flash but am running into some difficulties, no doubt due to simple incompetence...

I want to have a series of buttons on the screen that are circular bitmap images. When you hover over one of them, some circular text (also pre-drawn bitmap) will expand out of the button and rotate around it. (Example (http://www.hanfordonline.co.uk/archive/ButtonTest/ButtonTest.html) and project files (http://www.hanfordonline.co.uk/archive/ButtonTest/ButtonTest.zip))

I'm getting a bit confused though, because if I set the clip to "Movie Clip" I can use the onClipEvent(enterFrame) events which I use to animate and control the thing, but I can't use click or press to get any result.

Here's a small sample of pseudo-code that basically turns the animation on when rolled over, and off when rolled out. The runes are scaled up and rotated at an increasing speed at the start, and then slowed and shrunk when stopping:
on(rollOver) {
this.runes.rolling = true;
}

on(rollOut) {
this.runes.rolling = false;
}

onClipEvent(enterFrame) {

// Rolling
if (this.runes.rolling) {

// Should be rolling, but not up to speed yet, so speed it up
if (this.runes.rollspeed < 1) {
this.runes.rollspeed = this.runes.rollspeed + 0.03;
}

} else {

// Slowing down
if (this.runes.rollspeed > 0) {
this.runes.rollspeed = this.runes.rollspeed - 0.03;
}

}

// Rotate the runes
this.runes._rotation = this.runes._rotation + (2 * this.runes.rollspeed);
this.runes._xscale = 80 + (20 * this.runes.rollspeed);
this.runes._yscale = this.runes._xscale;
}

If someone could point me in the right direction that would be great, as at the moment I'm just spinning my wheels trying to guess my way out of the problem.

The next challenge will be instancing and loading custom graphics into the icons and runes from script, but that's for another day :D

Cylindric
09-24-2006, 12:13 PM
Mini-update, I noticed that if I put in the following snippet, the trace fires, but my animation doesn't move to the specified frame.
on(press) {
trace("released!");
gotoAndStop(10);
}

I fear I've bitten off a bit more than I can chew for my first project :D