Volledige versie bekijken : subclass aanmaken?
Fatty Owl
%Europe/Berlin %635 %2005, 15:15
hoe kan ik een subclass aanmaken in een class? ik heb nu dit, maar ik mag geen class nesten in een andere class zie ik.class Tool {
private var line:MovieClip;
private var lineCount:Number = 100;
class brush {
public function startDraw(Size:Number, myColor:String, Alpha:Number):Void {
line = _root.createEmptyMovieClip("line"+lineCount, lineCount);
lineCount++;
line.onMouseDown = function() {
this.lineStyle(Size, myColor, Alpha);
this.onMouseMove = function() {
this.lineTo(_xmouse, _ymouse);
updateAfterEvent();
};
this.moveTo(_xmouse, _ymouse);
};
line.onMouseUp = function() {
delete this.onMouseMove;
};
}
}
}
Dauntless
%Europe/Berlin %637 %2005, 15:18
class paintBucket extends Tool
{
// zo bedoel je?
}
Fatty Owl
%Europe/Berlin %671 %2005, 16:07
dat geeft de volgende error: **Error** C:\Documents and Settings\Kobe\My Documents\AS\Tool.as: Line 4: Class and interface definitions cannot be nested.
class Brush extends Tool
**Error** C:\Documents and Settings\Kobe\My Documents\AS\Tool.as: Line 5: '{' expected
public function startDraw(Size:Number, myColor:String, Alpha:Number):Void {
**Error** C:\Documents and Settings\Kobe\My Documents\AS\Tool.as: Line 21: ActionScript 2.0 class scripts may only define class or interface constructs.
}
**Error** C:\Documents and Settings\Kobe\My Documents\AS\Tool.as: Line 4: This statement is not permitted in a class definition.
class Brush extends Tool
Total ActionScript Errors: 4 Reported Errors: 4
Flasher
%Europe/Berlin %674 %2005, 16:11
je moet hem wel in een aparte file zetten:D
Fatty Owl
%Europe/Berlin %675 %2005, 16:13
je moet hem wel in een aparte file zetten:D
tss, hoe onhandig vind ik dat...:)
ik maak wel een aparte functie inplaats van subclasses.
Dauntless
%Europe/Berlin %677 %2005, 16:16
Wat is jou ID van een subclass ? Waar zou die in jouw ogen voor moeten dienen ?
Fatty Owl
%Europe/Berlin %690 %2005, 16:33
voor orderlijk te werken :) zo:
superclass Tool
subclass Gom
subclass Brush
subclass Pencil
...
Roenes
%Europe/Berlin %727 %2005, 17:26
klopt, maar dan is het toch niet meer dan logisch om dat in aparte bestanden te doen? de code van pencil heeft toch niets te maken met de code van gom dus is het niet logisch om dat in 1 dezelfde file te doen :)
Fatty Owl
%Europe/Berlin %730 %2005, 17:31
Nee daar heb je een punt :). Maar ik vind het erg onhandig als ik al die verschilldende files on line wil zetten :). Dus probeer ik het zo lang mogelijk zonder subclasses :D
Roenes
%Europe/Berlin %734 %2005, 17:37
je AS files hoef je niet online te zetten. Die worden allemaal in je swf gestopt bij exporteren :)
Dauntless
%Europe/Berlin %734 %2005, 17:37
Euhm, Fatty , je weet toch dat je die classes helemaal niet online moet zetten hé ?
Fatty Owl
%Europe/Berlin %754 %2005, 18:06
Ooooow dat wist ik niet , thx!
Cowerd
%Europe/Berlin %812 %2005, 19:29
ik wil zo graag dat je na het exporteren van de swf de as gewoon nog kan aanpassen maar dat kan dus niet:(
Fatty Owl
%Europe/Berlin %814 %2005, 19:32
dan exporteer je hem toch opnieuw..?
Cowerd
%Europe/Berlin %814 %2005, 19:33
ja maar als je met php je as online kan editen zou dat iedeaal zijn:D
Roenes
%Europe/Berlin %895 %2005, 21:29
Maar vrij logisch dat dat niet gaat werken he ;) Omdat tijdens het exporteren de AS bestanden in je swf worden geknald. ;)
maar het zou wel handig zijn ;)
Cowerd
%Europe/Berlin %900 %2005, 21:36
Ja dat snap ik ook wel maar dat ie dat dus pas bij onLoad doet zegmaar..
Dauntless
%Europe/Berlin %982 %2005, 23:35
Met AS 3.0 kan dat btw...
Cowerd
%Europe/Berlin %002 %2005, 00:03
:D maar daar snap ik al helemaal geen hol van:P ik heb nu flex en ik snap er niks van:P
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.