The constructor should be as empty as possible.

package com.receptacle.drawingtest{
import flash.display.*;
import flash.text.TextField;
import flash.events.MouseEvent;

public class GreetingApp extends Sprite {
public function GreetingApp() {
   draw();
 }

 private function draw() {
  var rectAndCircle:Sprite = new Sprite();

rectAndCircle.graphics.lineStyle(10,0x999999,1); rectAndCircle.graphics.beginFill(0x0000FF,1); rectAndCircle.graphics.drawRect(125,0,150,75); rectAndCircle.graphics.beginFill(0xFF0000, 0.8); rectAndCircle.graphics.drawCircle(150,100,50);
  rectAndCircle.x = 125;
  rectAndCircle.y = 100;
  addChild(rectAndCircle);
  rectAndCircle.addEventListener(MouseEvent.MOUSE_OVER,m);

  var triangle:Sprite = new Sprite();
  triangle.graphics.beginFill(0xFF5500,0.8);
  triangle.graphics.moveTo(50,0);
  triangle.graphics.lineTo(100,100);
  triangle.graphics.lineTo(0,100);
  triangle.graphics.lineTo(50,0);
  triangle.graphics.endFill();
  triangle.x = 175;
  triangle.y = 75;
addChildAt(triangle, getChildIndex(rectAndCircle)); triangle.addEventListener(MouseEvent.MOUSE_OVER,m); var greeting_txt:TextField = new TextField();
  greeting_txt.text = "hello world";
  greeting_txt.x = 200;
  greeting_txt.y = 300;
  addChild(greeting_txt);
 }

 private function m(evt:MouseEvent):void  {
setChildIndex(evt.target as Sprite, numChildren-1); }

}

}

----- Original Message ----- From: "Allandt Bik-Elliott (Receptacle)" <[EMAIL PROTECTED]>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, February 27, 2008 6:29 PM
Subject: Re: [Flashcoders] quick scoping question


ah yeh - thanks - i'm still getting used to access-control

just out of interest - the GreetingApp is my class constructor method, would you still say that it should not have any functions within it?



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to