QUESTION - adding methods to already exsiting classes

This is a discussion on "QUESTION - adding methods to already exsiting classes" within the Flash & Multimedia Forum section. This forum, and the thread "QUESTION - adding methods to already exsiting classes are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 16th, 2007, 22:52
Junior Member
Join Date: Jan 2007
Location: Michigan
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Question QUESTION - adding methods to already exsiting classes

do anyone know how to add a self-crated function as a method to an already existing class in flash?
More specificly, i would like to ad this function to the MovieClip Class

Code: Select all
distanceFrom(otherMovieClip){
    var xDist:Number = this._x - otherMovieClip._x;
    var yDist:Number = this._y - otherMovieClip._y;
    var Dist:Number = Math.sqrt(Math.pow(xDist, 2)+Math.pow(yDist, 2));
    return Dist;
}
the idea is that i could write firstMoiveClip.distanceFrom(secondMovieClip) and it would return the distance between the two as a number. is this possible? if so, how would i do it?

thanks, joe3dge
Reply With Quote

Reply

Tags
action script, class, flash, method

Thread Tools

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Agile methods andrwleong Website Planning 6 Feb 20th, 2008 18:20
Question with adding audio smith11 Flash & Multimedia Forum 1 Feb 14th, 2007 17:39
Website Template Methods The Hick Man Web Page Design 1 Aug 17th, 2006 20:10
methods of ignoring HTML ama Web Page Design 5 Jul 31st, 2006 18:37
Classes Gee Bee JavaScript Forum 1 Mar 8th, 2006 08:31


All times are GMT. The time now is 19:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43