Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 24th, 2002, 03:34 AM
ryan_b ryan_b is offline
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Newcastle, UK
Posts: 19 ryan_b User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wink Flash MX - Mouse Event

Hi,

Recently upgraded to MX, only to find to my horror that the flash5 version of doing 'onMouseover tell target' doesn't appear to be obvious in the new MX actionscript. Anybody know how I can set a movieclip to tell target via a rollover using the new actionscript?

Cheers,
Ryan

Reply With Quote
  #2  
Old June 26th, 2002, 09:06 PM
ptolemy ptolemy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Hamilton, Ontario
Posts: 3 ptolemy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to ptolemy
Post

You can get easy mouse over detection for any movie clip by creating a prototype function for the MovieClip class. I generally do the following:

1. Define the prototype in the first frame of the root level

Code:
MovieClip.prototype.mouseOver = function() {
  if (this.hitTest (_root._x, _root._y) == true) {
    return true;
  } else {
    return false;
  }
}


2. Now every movie clip on the stage has the ability to call mouseOver() on itself, which will return either true or false.

For example, a movie could perform these actions:

Code:
onClipEvent (mouseMove) {
  if (this.mouseOver() == true) {
    ...
  }
}


Or to make a movie clip act like a button, you could do this:

Code:
onClipEvent (mouseDown) {
  if (this.mouseOver() == true) {
    ...
  }
}


Matt

Reply With Quote
  #3  
Old July 8th, 2002, 04:05 PM
exorcyze exorcyze is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Mpls
Posts: 1 exorcyze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Use these:
Code:
mc1.onRollOver = function() {
	trace(this._name);
}
mc2.onRollOver = function() {
	trace(this._name);
}


The mouseOver event(s) are listener-based. That's why they weren't working the way you expected them to. You can look up listeners in the reference panel for more information.

Hope that helps...

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Flash MX - Mouse Event


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway