FORUMS: list search recent posts

Flash action script

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Steve Bosman
Flash action script
on Dec 2, 2010 at 4:22:02 pm

Ok I'm following the snow globe tutorial.

I'm trying to add inter activity to the movie clip inside the snow globe. right now its just stopped at frame 1 and I would like to get it to go on to the next frame using the shake. Everything I've tried just seems to break the snow. Any help would be appreciated.

Return to posts index

Steve Bosman
Re: Flash action script
on Dec 2, 2010 at 7:09:24 pm

Ok I figured it out but I figured I'd post for the next guy. Cause I always hate it when people don't post how they solved the problem. You add a "name of clip".gotoAndPlay(); placed in the "" file where shown below I know this might be basic. But I'm happy I solved it.

public function update(e:Event):void
// this if/else statement controls the mouse over and out instead of using event listeners
if(mouseY < -175 || mouseY > 175 || mouseX < -175 || mouseX > 175){
if(over) onMouseOut();
if(!over) onMouseOver();

// drag around..
this.x = parent.mouseX - mouseDownOffset.x;
this.y = parent.mouseY - mouseDownOffset.y;
// keep this thing on the table :)
if(y >= bounds.height) y = bounds.height;
// if you "shake" or move the mouse quickly, we are going to reset the snow particles
var d:Point = new Point(Math.abs(old.x - x), Math.abs(old.y - y));
if(d.x > 25 || d.y > 25 ){

// here is where you add some code to start a movie clip.
// "SnowglobCont" is the name of the Instance name of the move.
// "STOTwo" is the name of the key frame.

// update the history position
old.x = x;
old.y = y;
vel.y = (y-old.y)/2;
// if you drop this object it should have a bit of realistic falling..
vel.y += gravity;
pos.y += vel.y;
// bounce
if(pos.y > bounds.height){
pos.y = bounds.height;
vel.y *= -(Math.random()*restitution);

y = pos.y;

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved