I’m sure this’ll take no time at all for someone a little more versed but it’ll help me no-end in learning the dreaded ‘as3’.
I’ve an fla that defines a doc class as Main and the following two classes in the same directory:
[SIZE=1][COLOR=dimgray]Main.as:[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]package {[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]import flash.display.Sprite;[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]import flash.display.MovieClip; [/COLOR][/SIZE]
[SIZE=1][COLOR=navy]public class Main extends Sprite {[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]public function Main():void {[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]trace(“hello”);[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]doBuild();[/COLOR][/SIZE]
[SIZE=1][COLOR=navy][COLOR=darkred]MainText();[/COLOR][/COLOR][/SIZE]
[COLOR=navy][SIZE=1]}[/SIZE][/COLOR]
[SIZE=1][COLOR=navy]public function doBuild():void {[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]//build the main page[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]var Navigation2:Sprite=new rightPanel2();[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]addChild(Navigation2);[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]trace("NAV2 = " + getChildIndex(Navigation2));[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]Navigation2.x=832;[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]Navigation2.y=2.4; [/COLOR][/SIZE]
[SIZE=1][COLOR=navy]var Navigation:Sprite=new rightPanel();[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]addChild(Navigation);[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]trace("NAV = " + getChildIndex(Navigation));[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]Navigation.x=832;[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]Navigation.y=2.4; [/COLOR][/SIZE]
[SIZE=1][COLOR=navy]}[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]}[/COLOR][/SIZE]
[SIZE=1][COLOR=navy]}[/COLOR][/SIZE]
[SIZE=1][COLOR=dimgray]MainText.as:[/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]package {[/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]import flash.display.MovieClip; [/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]public class MainText extends MovieClip {[/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]public function MainText() { [/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]trace(“ok”);[/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]}[/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]}[/COLOR][/SIZE]
[SIZE=1][COLOR=#000080]}[/COLOR][/SIZE]
When I test the app I get an error 1112: Arguement count mismatch?!?
All I’m trying to do is call the MainText function from the Main function - both public classes - should be simple enough to do right? The doBuild function works (but this is in the same package as the Main func) so it’s something to do with communicating/calling between the packages but I just can’t seem to get it working.
Please help me - this’ll be a small thing that opens up a great deal to me!
Many thanks in advance,
Partimer