Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

onRelease...removed !

This is a discussion on onRelease...removed ! within the Tutorials forums, part of the Flash English category; That's right! onPress,onRelease,onRollOver and onRollOut have been removed. Now, by now it should be clear, it's ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-10-07, 17:25
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
onRelease...removed !

That's right! onPress,onRelease,onRollOver and onRollOut have been removed.
Now, by now it should be clear, it's the DispatchEvent class to manage everything.
As usual:
you add a listener to the clip the mouse should interact with
you manage the code so that it executes the events within the methods called by the listener

The class I've developed creates a Sprite at runtime and associates the mouse events








Here is the class I've written:
Code:
package
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.*;
	
	public class NoMoreOnPress extends MovieClip
	{
		private var size:Number=100;
		
		public function NoMoreOnPress()
		{
			this.createClip();
		}
		
		public function createClip():void
		{
			var coke:Sprite=new Sprite();
			coke.graphics.beginFill(0xFF6600);
            coke.graphics.drawRect(0,0,this.size,this.size);
            coke.graphics.endFill();
			coke.x=stage.stageWidth/2-coke.width/2;
			coke.y=stage.stageHeight/2-coke.height/2;
            this.addChild(coke);
			this.addCokeListeners(coke);
		}
		
		public function addCokeListeners(coke:Sprite):void
		{
			coke.addEventListener(MouseEvent.MOUSE_OVER,mouseIsOver);
			coke.addEventListener(MouseEvent.MOUSE_OUT,mouseIsOut);
			coke.addEventListener(MouseEvent.MOUSE_DOWN,mouseIsDown);
			coke.addEventListener(MouseEvent.MOUSE_UP,mouseIsUp);
		}
		public function mouseIsOver(event:Event):void
		{
			trace('il mouse mi è sopra');
		}
		public function mouseIsOut(event:Event):void
		{
			trace('il mouse non mi tocca');
		}
		public function mouseIsDown(event:Event):void
		{
			trace('il mouse mi ha cliccato sopra');
		}
		public function mouseIsUp(event:Event):void
		{
			trace('il mouse è stato rilasciato sopra di me');
		}
	}
}
cya!
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !

Last edited by Flep; 28-08-08 at 06:48..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 20-11-07, 10:20
Junior Member
 
Join Date: Nov 2007
Posts: 10
Rep Power: 0
cyberluk is on a distinguished road
Re: onRelease...removed !

Yes, and what if I have some moving object on the stage and want to detect MouseDown, MouseUp and other events also when the cursor IS NOT pointing the object (because it's moving and mouse is not).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 20-11-07, 11:15
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Re: onRelease...removed !

I suggest:

Create a button with Actionscript 3.0

Sprite.hitArea - property of Actionscript 3.0
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
swapDepths removed ! Flep Tutorials 2 07-08-08 20:24
loadMovie...removed ! Flep Tutorials 3 07-07-08 22:40
attachMovie...removed ! Flep Tutorials 5 19-06-08 20:39
DuplicateMovieclip...removed! Flep Tutorials 0 27-09-07 13:04
onRelease rimosso Flep Articoli e tutorials 0 19-09-07 13:32


All times are GMT. The time now is 13:51.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap