PDA

View Full Version : Actionscript 1 and Moveclip subclass help


Sozialcyke
01-31-2004, 04:18 PM
I'm trying to make my life easier by learning OOP (Object Oriented Programming) for Actionscript. So far, it has just made it more complicated.

I'm trying to create a menu system for my website. Here's the coding I have so far:


//menuItemClass constructor

function menuItemClass() {
}

menuItem.prototype = new MoveClip();

menuItem.prototype.ini(angle) {
this.angle = angle;
this.baseH = this._height;
this.baseW = this._width;
}

menuItem.prototype.move(tarAngle) {
//Complicated movement calculations I won't bore you with;
}

Object.registerClass("menuItem",menuItemClass);
_root.attachMovie("menuItem","menuItem1",1);

gallery = _root.menuItem1;
gallery.ini(0);
gallery.move(45);



Bascially, menuItemClass() is a subclass of MovieClip(). The ini() function of menuItemClass initializes the instance's location (since I don't know how to pass arguments to the constructor from inside of the attachMovie() function), and move() moves the instance to a specific spot on the stage based on some calculations. The only problem is it doesn't work. The menuItem instance gets attached to _root, but it just sits at (0,0) on the Stage.

I should point out that I'm using Flash MX with AS1, not Flash MX 2004 with AS2. I found the tutorial on Macromedia's Developer.net that explains how to do this in AS2.

Any help, or a pointer towards a reference, would be much appreciated.

Thanks in advance.

dez
02-01-2004, 01:05 AM
i'm not sure if you already know this site, but i think http://www.actionscripts.org/ might be some sort of help?

Sorry for wasting your time if it doesn't do any help.

Ian Jones
02-01-2004, 05:41 AM
Ok, I haven't investigated too deeply into AS yet, but this lnk should be useful:

http://www.debreuil.com/docs/ch01_Intro.htm

Btw, you should really use a search engine. That took me 5 seconds to find with Google.

Sozialcyke
02-02-2004, 06:16 PM
Ian, thanks for your help, but that site didn't answer my question, just so you know. You might want to understand the question before you insult someone :)

Ian Jones
02-02-2004, 11:30 PM
Bleh... your not worth the time.

CGTalk Moderation
01-17-2006, 07:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.