Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Community Boards > Just for Kicks Challenges

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-26-2009, 10:44 PM   #1
orange gold
got as?
 
Join Date: May 2007
Posts: 507
Default Mouse Effects Using Your Computers Built In Cursor

ok... this challenge is to get little snipes of code that just messa round with the built in mouse...

for example...
make your mouse blink between mouse show and mouse hide to make a blinking effect, or get a half see through mouse, what ever you can think off!!!!!!

rules...

actionscript 2
code only
have fun!




snipets code showcase:

(the best code snipets written will go here next to the user who created them)
__________________
Feel free to PM me if you have a question
orange gold is offline   Reply With Quote
Old 01-26-2009, 10:57 PM   #2
orange gold
got as?
 
Join Date: May 2007
Posts: 507
Default

well i tried sumthing like this but its not working... it willnt even trace my interval ... any ideas???

code:

ActionScript Code:
show2 = 1 _root.onEnterFrame = function() {     myTimer = setInterval(wait, 2000);     myTimer2 = setInterval(wait2, 2000);     if (show2 == 1) {         Mouse.hide();         function wait() {             show2 = 2         }     }     if (show2 == 2) {         Mouse.show();         function wait2() {             show2 = 1         }     }     trace(myTimer)     trace(myTimer2) }
__________________
Feel free to PM me if you have a question
orange gold is offline   Reply With Quote
Old 01-26-2009, 11:04 PM   #3
orange gold
got as?
 
Join Date: May 2007
Posts: 507
Default

ok i just modified it through variables instead of setinterval blah blah blah!

lol

here it is!!!

my code snippet #1 (blinking mouse with adjustable speed)

p.s. set the mouseblinkspeed = to about 2.001 at fps 120 and you almost get my 50% alpha mouse

ActionScript Code:
mouseblinkspeed = 30 // speed that the mouse blinks at show2 = 1 myTimer = 1 myTimer2 = 1 _root.onEnterFrame = function() {     myTimer = myTimer + 1     myTimer2 = myTimer2 + 1     if (show2 == 1) {         Mouse.hide();         if (myTimer >= mouseblinkspeed) {             show2 = 2             myTimer = 1             myTimer2 = 1         }     }     if (show2 == 2) {         Mouse.show();         if (myTimer2 >= mouseblinkspeed) {             show2 = 1             myTimer = 1             myTimer2 = 1         }     } }
__________________
Feel free to PM me if you have a question

Last edited by orange gold; 01-26-2009 at 11:10 PM..
orange gold is offline   Reply With Quote
Old 02-11-2009, 10:01 PM   #4
xxneon
MCL -- FTW
 
xxneon's Avatar
 
Join Date: Dec 2006
Location: Amish Country, PA
Posts: 7,175
Send a message via ICQ to xxneon Send a message via AIM to xxneon Send a message via MSN to xxneon Send a message via Skype™ to xxneon
Default

with this it will change the mouse cursor from arrow to hand cursor to arrow .. and keep doing that on a set interval.. but the only thing i noticed is it only works when you move the mouse.. if the mouse is stationary it stops alternating.. I am thinking there is no way around this since the same behavior happens when you disable a buttons actions when you click
ActionScript Code:
var toggle_int:Number; var interval_speed = .5; //seconds MovieClip.prototype.drawRect = function(x,y,w,h,c,a){     this.moveTo(x,y);     this.beginFill(c,a);     this.lineTo(x+w,y);     this.lineTo(x+w,y+h);     this.lineTo(x,y+h);     this.lineTo(x,y);     this.endFill(); } function toggleHandCursor(toggle:Boolean){     if(toggle == true){         this.createEmptyMovieClip("hit_area",this.getNextHighestDepth());         hit_area.drawRect(0,0,1,1,0,0);         hit_area.onRollOver = function(){};         onMouseMove();     }else{         hit_area.removeMovieClip();     }     updateAfterEvent();     intervalToggle(!toggle); } function onMouseMove(){     hit_area._x = _xmouse-hit_area._width/2;     hit_area._y = _ymouse-hit_area._height/2;     updateAfterEvent(); } function intervalToggle(_toggle:Boolean){     clearInterval(toggle_int);     toggle_int = setInterval(this,"toggleHandCursor",interval_speed*1000,_toggle); } intervalToggle(true);
__________________
Always optimizing...
xxneon is offline   Reply With Quote
Old 02-12-2009, 02:57 PM   #5
xxneon
MCL -- FTW
 
xxneon's Avatar
 
Join Date: Dec 2006
Location: Amish Country, PA
Posts: 7,175
Send a message via ICQ to xxneon Send a message via AIM to xxneon Send a message via MSN to xxneon Send a message via Skype™ to xxneon
Default

got it .. once the mouse has focus .. it will make the mouse change now..

the difference with this version though is it only creates 1 hit area clip.. and then just positions it off stage so that the roll out behaviour is called.. making the mouse revert back to the arrow..
ActionScript Code:
var toggle_int:Number; var interval_speed = .5; //seconds MovieClip.prototype.drawRect = function(x,y,w,h,c,a){     this.moveTo(x,y);     this.beginFill(c,a);     this.lineTo(x+w,y);     this.lineTo(x+w,y+h);     this.lineTo(x,y+h);     this.lineTo(x,y);     this.endFill(); } function toggleHandCursor(toggle:Boolean){     if(toggle == true){         hit_area.onRollOver = function(){};         onMouseMove = move;         onMouseMove();     }else{         hit_area._x = -50;         delete onMouseMove;     }     updateAfterEvent();     intervalToggle(!toggle); } function move(){     hit_area._x = _xmouse-hit_area._width/2;     hit_area._y = _ymouse-hit_area._height/2;     updateAfterEvent(); } function intervalToggle(_toggle:Boolean){     clearInterval(toggle_int);     toggle_int = setInterval(this,"toggleHandCursor",interval_speed*1000,_toggle); } this.createEmptyMovieClip("hit_area",this.getNextHighestDepth()); hit_area.drawRect(0,0,1,1,0,0); intervalToggle(true);
__________________
Always optimizing...
xxneon is offline   Reply With Quote
Old 03-09-2009, 09:47 PM   #6
orange gold
got as?
 
Join Date: May 2007
Posts: 507
Default

ohhh i like this code hehe
keep up the good work
__________________
Feel free to PM me if you have a question
orange gold is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keeping mouse cursor inside MovieClip - How is it done? Deuzsama ActionScript 3.0 2 03-28-2008 05:56 AM
Custom mouse cursor over everything, but... MystalurDimensh ActionScript 2.0 1 09-24-2007 01:17 PM
Mouse Showing up over cursor in Actionscript 3 ! Digged ActionScript 3.0 1 07-09-2007 03:12 PM
Simple problem: How do you change mouse cursor? larsxe ActionScript 2.0 2 07-02-2007 02:30 PM
Trailing mouse Cursor!!! Jimmy87 ActionScript 2.0 1 03-18-2007 08:00 AM


All times are GMT. The time now is 11:25 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.