Jay_Stealth Posted April 17, 2005 Share Posted April 17, 2005 ok i've designed a flash movie with one layer with a movie clip which is a snowflake with this codeonClipEvent(load) { this._x = Math.random()*200 // 0 to 200 this._y = Math.random()*200 // 0 to 200 speed = Math.random()*3+3; // 3 to 6 drift = Math.random()*2-1; // -1 to 1 rotate = Math.random()*6-3; // -3 to 3}onClipEvent(enterFrame) { this._y += speed; this._x += drift; this._rotation += rotate; //bring back to top if (this._y > 200) this._y =0; //one side to another if (this._x < 0) this._x = 200; if (this._x > 200) this._x = 0;} on the root layer i have this codeMovieClip.prototype.randomRGB = function(){//adds a random RGB to the movie clip (new Color(this)).setRGB(Math.random()*0xFFFFFF);}snowflake.onEnterFrame = this.randomRGB;//creating a key listener. The movie response to the hit of the spacebar. Hitting the spacebar triggers an eventspaceBar = new Object();spaceBar.onKeyDown = function(){ if (Key.getCode() == 32){//32 is the number that corresponds to the spacebar. randomRGB;// this changes the size of the grid for the duplicated movieclip. }}Key.addListener(spaceBar);//this registers the 'spaceBar' to receive key event onKeyDown.// create 30 snowflakesfor(var i=0;i<30;i++) { snowflake.duplicateMovieClip("snowflake"+i,i);}However it doesnt work how i want it to. I want the movie clip to listen to the spacebar and when pressed all of the snowflakes change to a random colour.Here is the .flaAnything would be appreciated. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now