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 20th, 2003, 01:08 AM
ktoz ktoz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 437 ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level)ktoz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 13 h 9 sec
Reputation Power: 25
Help. Some class methods not getting called

I'm in the process of writing my first ActionScript class and have run into a problem where two of my defined methods aren't getting called. Could some kindly guru take a look and point out what I'm doing wrong?

Thanks,

Ken

P.S. the purpose of this class is to encapsulate drag behavior.

// in action layer
Dragger = function(x, y, timeline, graphicID, depth)
{
this.x = x;
this.y = y;
this.timeline = timeline;
this.graphic = this.attachGraphic(graphicID, depth);
trace(this.graphic);
this.scale = 100;
this.wasDragged = false;
this.render();
}

Dragger.prototype.attachGraphic = function (graphicID, depth)
{
var newName = graphicID + "_" + depth;
this.timeline.attachMovie(graphicID, newName, depth);
return this.timeline[newName];
}

Dragger.prototype.render = function()
{
with (this.graphic)
{
_x = this.x;
_y = this.y;
}
}

// the next two methods don't seem to get called as their embedded messages never appear in the trace window
Dragger.prototype.onPress = function()
{
trace("item pressed");
}

Dragger.prototype.onRelease = function()
{
trace("item released");
}

this.timeline.addListener(this);


// in test layer
obj = new Dragger(0,0,this,"circleMC",100);

// this.graphic renders to stage OK

// clicking in the shape defined by this.graphic produces no output

Reply With Quote
  #2  
Old June 26th, 2003, 12:26 PM
mbritton72 mbritton72 is offline
Shrill Digital God
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Raleigh, NC
Posts: 64 mbritton72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 8
Try this after your class declaration:

Dragger.prototype = new MovieClip();

or (I think) after you instantiate the class:

obj.prototype = new MovieClip();

The point is I'm pretty sure onPress handlers only apply to mc's and buttons.
__________________
I'm not impatient, I just have a low tolerance for boredom.

Last edited by mbritton72 : June 26th, 2003 at 12:28 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > Help. Some class methods not getting called


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